aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--restorebackup.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/restorebackup.php b/restorebackup.php
index 82d8a38..ee6f48a 100644
--- a/restorebackup.php
+++ b/restorebackup.php
@@ -27,7 +27,6 @@ require_once(__DIR__ . "/classes/editform.php");
require_once($CFG->libdir . "/adminlib.php");
admin_externalpage_setup("pluginsoverview");
-
require_login();
/* Link generation */
@@ -47,6 +46,20 @@ if ($mform->is_cancelled()) {
redirect($managerservice);
}
+/* Processing the received file */
+$data = $mform->get_data();
+if (boolval($data) && confirm_sesskey()) {
+ $content = $mform->get_file_content("backupfile");
+ $callbacks = unserialize(gzuncompress(base64_decode($content)));
+
+ $DB->delete_records("local_webhooks_service");
+ foreach ($callbacks as $callback) {
+ $DB->insert_record("local_webhooks_service", $callback);
+ }
+
+ redirect($managerservice, new lang_string("restorefinished", "moodle"));
+}
+
/* Page template */
$titlepage = new lang_string("backup", "moodle");
$PAGE->set_pagelayout("admin");