From 050ea1f0651ba79cca4b124aed30b3f6acda8369 Mon Sep 17 00:00:00 2001 From: Sebastien VIALLEMONTEIL Date: Fri, 11 Jan 2019 10:29:52 +0100 Subject: [PATCH] Cleaning up backup and restore feature. It's only possible to backup and restore metadata for courses and modules. --- .../backup_local_metadata_plugin.class.php | 26 ++++--------------- backup/moodle2/backup_metadata_task.class.php | 8 +++--- .../restore_local_metadata_plugin.class.php | 8 +++--- version.php | 10 +++---- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/backup/moodle2/backup_local_metadata_plugin.class.php b/backup/moodle2/backup_local_metadata_plugin.class.php index 34e5dc4..57b75fd 100644 --- a/backup/moodle2/backup_local_metadata_plugin.class.php +++ b/backup/moodle2/backup_local_metadata_plugin.class.php @@ -19,27 +19,17 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** Database: - * - * local_metadata(id, instanceid, fieldid, data, dataformat) + * local_metadata(id, instanceid, fieldid, data, dataformat). */ defined('MOODLE_INTERNAL') || die(); /** - * Provides the information to backup metadata + * Provides the information to backup metadata. */ class backup_local_metadata_plugin extends backup_local_plugin { - // public function define_plugin_structure($connection) - // { - // global $CFG; - // $fp = fopen($CFG->dataroot . '/test.txt', 'a+'); - // fwrite($fp, $connection . PHP_EOL); - // fclose($fp); - // parent::define_plugin_structure($connection); - // } - /** - * Returns the format information to attach to module element + * Returns the format information to attach to module element. */ protected function define_module_plugin_structure() { @@ -47,7 +37,7 @@ protected function define_module_plugin_structure() } /** - * Returns the format information to attach to course element + * Returns the format information to attach to course element. */ protected function define_course_plugin_structure() { @@ -55,14 +45,8 @@ protected function define_course_plugin_structure() } /** - * Returns the format information to attach to module element + * Building the XML structure. */ - protected function define_groups_plugin_structure() - { - var_dump('Hello from groups'); - die; - } - protected function build_structure($id, $name = '') { $plugin = $this->get_plugin_element(); diff --git a/backup/moodle2/backup_metadata_task.class.php b/backup/moodle2/backup_metadata_task.class.php index cc70828..93577dc 100644 --- a/backup/moodle2/backup_metadata_task.class.php +++ b/backup/moodle2/backup_metadata_task.class.php @@ -25,15 +25,15 @@ class backup_metadata_task extends backup_task { /** - * Define (add) particular settings this local plugin can have + * Define (add) particular settings this local plugin can have. */ protected function define_my_settings() { - // No particular settings for this local plugin + // No particular settings for this local plugin. } /** - * Define (add) particular steps this local plugin can have + * Define (add) particular steps this local plugin can have. */ protected function define_my_steps() { @@ -42,7 +42,7 @@ protected function define_my_steps() /** * Code the transformations to perform in the local plugin in - * order to get transportable (encoded) links + * order to get transportable (encoded) links. */ public static function encode_content_links($content) { diff --git a/backup/moodle2/restore_local_metadata_plugin.class.php b/backup/moodle2/restore_local_metadata_plugin.class.php index 34227ce..cda7187 100644 --- a/backup/moodle2/restore_local_metadata_plugin.class.php +++ b/backup/moodle2/restore_local_metadata_plugin.class.php @@ -20,18 +20,18 @@ */ /** Database: * - * local_metadata(id, instanceid, fieldid, data, dataformat) + * local_metadata(id, instanceid, fieldid, data, dataformat). */ defined('MOODLE_INTERNAL') || die(); /** - * Provides the information to restore metadata + * Provides the information to restore metadata. */ class restore_local_metadata_plugin extends restore_local_plugin { const TABLE = 'local_metadata'; /** - * Returns the format information to attach to module element + * Returns the format information to attach to module element. */ protected function define_module_plugin_structure() { @@ -39,7 +39,7 @@ protected function define_module_plugin_structure() } /** - * Returns the format information to attach to course element + * Returns the format information to attach to course element. */ protected function define_course_plugin_structure() { diff --git a/version.php b/version.php index 20be28c..dd5faad 100644 --- a/version.php +++ b/version.php @@ -22,8 +22,8 @@ */ defined('MOODLE_INTERNAL') || die; -$plugin->version = 2018120100; -$plugin->release = '3.6.0 (Build 2018120300)'; -$plugin->maturity = MATURITY_STABLE; -$plugin->requires = 2016052300; // Moodle 3.1 release and upwards. -$plugin->component = 'local_metadata'; \ No newline at end of file +$plugin->version = 2019011100; +$plugin->release = '3.6.0 (Build 2019011100)'; +$plugin->maturity = MATURITY_STABLE; +$plugin->requires = 2016052300; // Moodle 3.1 release and upwards. +$plugin->component = 'local_metadata';