mirror of
https://github.com/moodle/moodle.git
synced 2025-03-18 22:50:19 +01:00
MDL-81870 core: validate component during upgrade task savepoint.
This commit is contained in:
parent
f49d120761
commit
5f8aaf220f
@ -504,6 +504,7 @@ $string['pagenotexist'] = '<p>An unusual error occurred trying to view a page th
|
||||
$string['passwordexceeded'] = 'The password can\'t be more than {$a} characters.';
|
||||
$string['pathdoesnotstartslash'] = 'No valid arguments supplied, path does not start with slash!';
|
||||
$string['pleasereport'] = 'If you have time, please let us know what you were trying to do when the error occurred:';
|
||||
$string['pluginnotexist'] = '{$a} plugin doesn\'t exist';
|
||||
$string['pluginrequirementsnotmet'] = 'Plugin "{$a->pluginname}" ({$a->pluginversion}) could not be installed. It requires a newer version of Moodle (currently you are using {$a->currentmoodle}, you need {$a->requiremoodle}).';
|
||||
$string['pluginunsupported'] = 'Plugin "{$a->pluginname}" {$a->pluginversion} does not support this version of Moodle {$a->moodleversion}. Seek plugin information to find supported versions.';
|
||||
$string['prefixcannotbeempty'] = '<p>Error: database table prefix cannot be empty ({$a})</p>
|
||||
|
@ -459,17 +459,16 @@ function upgrade_block_savepoint($result, $version, $blockname, $allowabort=true
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugins upgrade savepoint, marks end of blocks upgrade blocks
|
||||
* Plugins upgrade savepoint, marks end of plugin upgrade blocks
|
||||
* It stores plugin version, resets upgrade timeout
|
||||
* and abort upgrade if user cancels page loading.
|
||||
*
|
||||
* @category upgrade
|
||||
* @param bool $result false if upgrade step failed, true if completed
|
||||
* @param string or float $version main version
|
||||
* @param string|float $version main version
|
||||
* @param string $type The type of the plugin.
|
||||
* @param string $plugin The name of the plugin.
|
||||
* @param bool $allowabort allow user to abort script execution here
|
||||
* @return void
|
||||
*/
|
||||
function upgrade_plugin_savepoint($result, $version, $type, $plugin, $allowabort=true) {
|
||||
global $DB;
|
||||
@ -480,6 +479,11 @@ function upgrade_plugin_savepoint($result, $version, $type, $plugin, $allowabort
|
||||
throw new upgrade_exception($component, $version);
|
||||
}
|
||||
|
||||
// Ensure we're dealing with a real component.
|
||||
if (core_component::get_component_directory($component) === null) {
|
||||
throw new moodle_exception('pluginnotexist', 'error', '', $component);
|
||||
}
|
||||
|
||||
$dbversion = $DB->get_field('config_plugins', 'value', array('plugin'=>$component, 'name'=>'version'));
|
||||
|
||||
if ($dbversion >= $version) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user