summaryrefslogtreecommitdiff
path: root/lib.php
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-11-23 17:42:47 +0300
committerValentin Popov <info@valentineus.link>2017-11-23 17:44:30 +0300
commit4bf6f61131af5a3b7847e5e0491eb218120faba2 (patch)
tree663c5bc0aea8c5573a75d4621dbc0487957b1000 /lib.php
parent3da34ec7f132cae85d5b49a2f39b33fb7f090ce1 (diff)
downloadlocal_webhooks-4bf6f61131af5a3b7847e5e0491eb218120faba2.tar.xz
local_webhooks-4bf6f61131af5a3b7847e5e0491eb218120faba2.zip
External backup function
Diffstat (limited to 'lib.php')
-rw-r--r--lib.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib.php b/lib.php
index ab20526..c423e9b 100644
--- a/lib.php
+++ b/lib.php
@@ -109,6 +109,32 @@ function local_webhooks_update_record($data, $insert = true) {
}
/**
+ * Make a backup copy of all the services.
+ *
+ * @return string
+ */
+function local_webhooks_create_backup() {
+ $listservices = local_webhooks_get_list_records();
+ $listservices = local_webhooks_archiving_data($listservices);
+ return $listservices;
+}
+
+/**
+ * Restore the data from the backup.
+ *
+ * @param string $data
+ */
+function local_webhooks_restore_backup($listservices = "") {
+ $listservices = local_webhooks_unarchive_data($listservices);
+
+ local_webhooks_remove_list_records();
+
+ foreach ($listservices as $servicerecord) {
+ local_webhooks_update_record($servicerecord, true);
+ }
+}
+
+/**
* Compress an array into a string.
*
* @param array $data