Skip to content

Commit

Permalink
Fixing syntax for moodle code validator, hoping Travis tests will pas…
Browse files Browse the repository at this point in the history
…s...
  • Loading branch information
Sebastien VIALLEMONTEIL committed Jan 11, 2019
1 parent 050ea1f commit edf1ed4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 56 deletions.
9 changes: 3 additions & 6 deletions backup/moodle2/backup_local_metadata_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions backup/moodle2/backup_metadata_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
11 changes: 4 additions & 7 deletions backup/moodle2/backup_metadata_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,29 @@
*/
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'));
}

/**
* 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;
}
}
18 changes: 6 additions & 12 deletions backup/moodle2/restore_local_metadata_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,32 @@ 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');
$paths[] = new restore_path_element($elename . 'metadata', $elepath);
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();
Expand All @@ -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);
}
Expand Down
59 changes: 30 additions & 29 deletions version.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @package local_metadata
* @author Mike Churchward <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright 2017 onwards Mike Churchward ([email protected])
*/

defined('MOODLE_INTERNAL') || die;
$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';
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @package local_metadata
* @author Mike Churchward <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright 2017 onwards Mike Churchward ([email protected])
*/

defined('MOODLE_INTERNAL') || die;
$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';

0 comments on commit edf1ed4

Please sign in to comment.