Skip to content

Commit

Permalink
Cleaning up backup and restore feature. It's only possible to backup …
Browse files Browse the repository at this point in the history
…and restore metadata for courses and modules.
  • Loading branch information
Sebastien VIALLEMONTEIL committed Jan 11, 2019
1 parent a638a02 commit 050ea1f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 34 deletions.
26 changes: 5 additions & 21 deletions backup/moodle2/backup_local_metadata_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,34 @@
* @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()
{
return $this->build_structure(backup::VAR_MODID, 'module');
}

/**
* Returns the format information to attach to course element
* Returns the format information to attach to course element.
*/
protected function define_course_plugin_structure()
{
return $this->build_structure(backup::VAR_COURSEID, 'course');
}

/**
* 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();
Expand Down
8 changes: 4 additions & 4 deletions backup/moodle2/backup_metadata_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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)
{
Expand Down
8 changes: 4 additions & 4 deletions backup/moodle2/restore_local_metadata_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@
*/
/** 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()
{
return $this->get_paths('module');
}

/**
* Returns the format information to attach to course element
* Returns the format information to attach to course element.
*/
protected function define_course_plugin_structure()
{
Expand Down
10 changes: 5 additions & 5 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
$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 050ea1f

Please sign in to comment.