MDL-32329 improved plugin dependencies check on upgrade
Previously, it was the renderer method that actually called all_plugins_ok(). I believe that renderer methods should not be responsible for such an important step in the install/upgrade code flow. So dependencies are now checked by admin/index.php on upgrade, too.
This commit is contained in:
@@ -252,6 +252,15 @@ if ($version > $CFG->version) { // upgrade
|
||||
|
||||
$reloadurl = new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1));
|
||||
|
||||
// check plugin dependencies first
|
||||
$failed = array();
|
||||
if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl);
|
||||
die();
|
||||
}
|
||||
unset($failed);
|
||||
|
||||
if ($fetchupdates) {
|
||||
// no sesskey support guaranteed here
|
||||
if (empty($CFG->disableupdatenotifications)) {
|
||||
@@ -304,6 +313,16 @@ if (moodle_needs_upgrading()) {
|
||||
}
|
||||
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
// check plugin dependencies first
|
||||
$failed = array();
|
||||
if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
|
||||
echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url);
|
||||
die();
|
||||
}
|
||||
unset($failed);
|
||||
|
||||
// dependencies check passed, let's rock!
|
||||
echo $output->upgrade_plugin_check_page(plugin_manager::instance(), available_update_checker::instance(),
|
||||
$version, $showallplugins,
|
||||
new moodle_url($PAGE->url),
|
||||
|
||||
+7
-11
@@ -219,19 +219,15 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$output .= $this->box_end();
|
||||
$output .= $this->upgrade_reload($reloadurl);
|
||||
|
||||
if ($pluginman->all_plugins_ok($version)) {
|
||||
if ($pluginman->some_plugins_updatable()) {
|
||||
$output .= $this->container_start('upgradepluginsinfo');
|
||||
$output .= $this->help_icon('upgradepluginsinfo', 'core_admin', get_string('upgradepluginsfirst', 'core_admin'));
|
||||
$output .= $this->container_end();
|
||||
}
|
||||
$button = new single_button($continueurl, get_string('upgradestart', 'admin'), 'get');
|
||||
$button->class = 'continuebutton';
|
||||
$output .= $this->render($button);
|
||||
} else {
|
||||
$output .= $this->box(get_string('pluginschecktodo', 'admin'), 'environmentbox errorbox');
|
||||
if ($pluginman->some_plugins_updatable()) {
|
||||
$output .= $this->container_start('upgradepluginsinfo');
|
||||
$output .= $this->help_icon('upgradepluginsinfo', 'core_admin', get_string('upgradepluginsfirst', 'core_admin'));
|
||||
$output .= $this->container_end();
|
||||
}
|
||||
|
||||
$button = new single_button($continueurl, get_string('upgradestart', 'admin'), 'get');
|
||||
$button->class = 'continuebutton';
|
||||
$output .= $this->render($button);
|
||||
$output .= $this->footer();
|
||||
|
||||
return $output;
|
||||
|
||||
Reference in New Issue
Block a user