MDL-65646 core: Move component storage to json
This commit is contained in:
@@ -173,7 +173,7 @@ abstract class backup_structure_step extends backup_step {
|
||||
* looking for /mod/modulenanme subplugins. This new method is a generalization of the
|
||||
* existing one for activities, supporting all subplugins injecting information everywhere.
|
||||
*
|
||||
* @param string $subplugintype type of subplugin as defined in plugin's db/subplugins.php.
|
||||
* @param string $subplugintype type of subplugin as defined in plugin's db/subplugins.json.
|
||||
* @param backup_nested_element $element element in the backup tree (anywhere) that
|
||||
* we are going to add subplugin information to.
|
||||
* @param bool $multiple to define if multiple subplugins can produce information
|
||||
@@ -206,11 +206,10 @@ abstract class backup_structure_step extends backup_step {
|
||||
}
|
||||
|
||||
// Check the requested subplugintype is a valid one.
|
||||
$subpluginsfile = core_component::get_component_directory($plugintype . '_' . $pluginname) . '/db/subplugins.php';
|
||||
if (!file_exists($subpluginsfile)) {
|
||||
throw new backup_step_exception('plugin_missing_subplugins_php_file', array($plugintype, $pluginname));
|
||||
$subplugins = core_component::get_subplugins("{$plugintype}_{$pluginname}");
|
||||
if (null === $subplugins) {
|
||||
throw new backup_step_exception('plugin_missing_subplugins_configuration', [$plugintype, $pluginname]);
|
||||
}
|
||||
include($subpluginsfile);
|
||||
if (!array_key_exists($subplugintype, $subplugins)) {
|
||||
throw new backup_step_exception('incorrect_subplugin_type', $subplugintype);
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ abstract class restore_structure_step extends restore_step {
|
||||
* looking for /mod/modulenanme subplugins. This new method is a generalization of the
|
||||
* existing one for activities, supporting all subplugins injecting information everywhere.
|
||||
*
|
||||
* @param string $subplugintype type of subplugin as defined in plugin's db/subplugins.php.
|
||||
* @param string $subplugintype type of subplugin as defined in plugin's db/subplugins.json.
|
||||
* @param restore_path_element $element element in the structure restore tree that
|
||||
* we are going to add subplugin information to.
|
||||
* @param string $plugintype type of the plugin.
|
||||
@@ -336,11 +336,10 @@ abstract class restore_structure_step extends restore_step {
|
||||
}
|
||||
|
||||
// Check the requested subplugintype is a valid one.
|
||||
$subpluginsfile = core_component::get_component_directory($plugintype . '_' . $pluginname) . '/db/subplugins.php';
|
||||
if (!file_exists($subpluginsfile)) {
|
||||
throw new restore_step_exception('plugin_missing_subplugins_php_file', array($plugintype, $pluginname));
|
||||
$subplugins = core_component::get_subplugins("{$plugintype}_{$pluginname}");
|
||||
if (null === $subplugins) {
|
||||
throw new restore_step_exception('plugin_missing_subplugins_configuration', array($plugintype, $pluginname));
|
||||
}
|
||||
include($subpluginsfile);
|
||||
if (!array_key_exists($subplugintype, $subplugins)) {
|
||||
throw new restore_step_exception('incorrect_subplugin_type', $subplugintype);
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ class backup_step_testcase extends advanced_testcase {
|
||||
$this->assertTrue(false, 'base_step_exception expected');
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof backup_step_exception);
|
||||
$this->assertEquals('plugin_missing_subplugins_php_file', $e->errorcode);
|
||||
$this->assertEquals('plugin_missing_subplugins_configuration', $e->errorcode);
|
||||
}
|
||||
// Wrong BC (defaulting to mod and modulename) use not having subplugins.
|
||||
try {
|
||||
@@ -250,7 +250,7 @@ class backup_step_testcase extends advanced_testcase {
|
||||
$this->assertTrue(false, 'base_step_exception expected');
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof backup_step_exception);
|
||||
$this->assertEquals('plugin_missing_subplugins_php_file', $e->errorcode);
|
||||
$this->assertEquals('plugin_missing_subplugins_configuration', $e->errorcode);
|
||||
}
|
||||
// Wrong subplugin type.
|
||||
try {
|
||||
@@ -362,7 +362,7 @@ class backup_step_testcase extends advanced_testcase {
|
||||
$this->assertTrue(false, 'base_step_exception expected');
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof restore_step_exception);
|
||||
$this->assertEquals('plugin_missing_subplugins_php_file', $e->errorcode);
|
||||
$this->assertEquals('plugin_missing_subplugins_configuration', $e->errorcode);
|
||||
}
|
||||
// Wrong BC (defaulting to mod and modulename) use not having subplugins.
|
||||
try {
|
||||
@@ -371,7 +371,7 @@ class backup_step_testcase extends advanced_testcase {
|
||||
$this->assertTrue(false, 'base_step_exception expected');
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof restore_step_exception);
|
||||
$this->assertEquals('plugin_missing_subplugins_php_file', $e->errorcode);
|
||||
$this->assertEquals('plugin_missing_subplugins_configuration', $e->errorcode);
|
||||
}
|
||||
// Wrong subplugin type.
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user