From a6bcf32e7bed242a4e52bf6d178408abb085799b Mon Sep 17 00:00:00 2001 From: Sebastien VIALLEMONTEIL Date: Fri, 11 Jan 2019 12:19:56 +0100 Subject: [PATCH] Fixing syntax for moodle code validator, hoping Travis tests will pass... --- .../backup_local_metadata_plugin.class.php | 9 +++------ backup/moodle2/backup_metadata_stepslib.php | 3 +-- backup/moodle2/backup_metadata_task.class.php | 11 ++++------- .../restore_local_metadata_plugin.class.php | 18 ++++++------------ 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/backup/moodle2/backup_local_metadata_plugin.class.php b/backup/moodle2/backup_local_metadata_plugin.class.php index 57b75fd..ae83df2 100644 --- a/backup/moodle2/backup_local_metadata_plugin.class.php +++ b/backup/moodle2/backup_local_metadata_plugin.class.php @@ -31,24 +31,21 @@ class backup_local_metadata_plugin extends backup_local_plugin /** * Returns the format information to attach to module element. */ - protected function define_module_plugin_structure() - { + protected function define_module_plugin_structure() { return $this->build_structure(backup::VAR_MODID, 'module'); } /** * Returns the format information to attach to course element. */ - protected function define_course_plugin_structure() - { + protected function define_course_plugin_structure() { return $this->build_structure(backup::VAR_COURSEID, 'course'); } /** * Building the XML structure. */ - protected function build_structure($id, $name = '') - { + protected function build_structure($id, $name = '') { $plugin = $this->get_plugin_element(); $name = trim($name) !== '' ? $name . '_' : ''; $pluginwrapper = new backup_nested_element($this->get_recommended_name()); diff --git a/backup/moodle2/backup_metadata_stepslib.php b/backup/moodle2/backup_metadata_stepslib.php index cf3fa53..0167f69 100644 --- a/backup/moodle2/backup_metadata_stepslib.php +++ b/backup/moodle2/backup_metadata_stepslib.php @@ -22,8 +22,7 @@ class backup_metadata_structure_step extends backup_structure_step { - protected function define_structure() - { + protected function define_structure() { return new backup_nested_element('metadata'); } } diff --git a/backup/moodle2/backup_metadata_task.class.php b/backup/moodle2/backup_metadata_task.class.php index 93577dc..c71243e 100644 --- a/backup/moodle2/backup_metadata_task.class.php +++ b/backup/moodle2/backup_metadata_task.class.php @@ -20,23 +20,21 @@ */ defined('MOODLE_INTERNAL') || die(); -require_once $CFG->dirroot . '/local/metadata/backup/moodle2/backup_metadata_stepslib.php'; +require_once ($CFG->dirroot . '/local/metadata/backup/moodle2/backup_metadata_stepslib.php'); class backup_metadata_task extends backup_task { /** * Define (add) particular settings this local plugin can have. */ - protected function define_my_settings() - { + protected function define_my_settings() { // No particular settings for this local plugin. } /** * Define (add) particular steps this local plugin can have. */ - protected function define_my_steps() - { + protected function define_my_steps() { $this->add_step(new backup_metadata_structure_step('metadata_structure', 'metadata.xml')); } @@ -44,8 +42,7 @@ protected function define_my_steps() * Code the transformations to perform in the local plugin in * order to get transportable (encoded) links. */ - public static function encode_content_links($content) - { + public static function encode_content_links($content) { return $content; } } diff --git a/backup/moodle2/restore_local_metadata_plugin.class.php b/backup/moodle2/restore_local_metadata_plugin.class.php index cda7187..dfc20f3 100644 --- a/backup/moodle2/restore_local_metadata_plugin.class.php +++ b/backup/moodle2/restore_local_metadata_plugin.class.php @@ -33,21 +33,18 @@ class restore_local_metadata_plugin extends restore_local_plugin /** * Returns the format information to attach to module element. */ - protected function define_module_plugin_structure() - { + protected function define_module_plugin_structure() { return $this->get_paths('module'); } /** * Returns the format information to attach to course element. */ - protected function define_course_plugin_structure() - { + protected function define_course_plugin_structure() { return $this->get_paths('course'); } - protected function get_paths($name) - { + protected function get_paths($name) { $paths = []; $elename = trim($name) !== '' ? ($name . '_') : ''; $elepath = $this->get_pathfor($elename . 'metadata'); @@ -55,15 +52,13 @@ protected function get_paths($name) return $paths; // And we return the interesting paths. } - public function process_module_metadata($data) - { + public function process_module_metadata($data) { $data = (object)$data; $data->instanceid = $this->task->get_moduleid(); $this->insert_into_db($data); } - public function process_course_metadata($data) - { + public function process_course_metadata($data) { global $DB; $data = (object)$data; $courseid = $this->task->get_courseid(); @@ -77,8 +72,7 @@ public function process_course_metadata($data) } } - protected function insert_into_db($data) - { + protected function insert_into_db($data) { global $DB; $DB->insert_record(self::TABLE, $data); }