MDL-49329 admin: Do not force admin to reconfirm the core upgrade
authorDavid Mudrák <david@moodle.com>
Fri, 9 Oct 2015 16:46:01 +0000 (18:46 +0200)
committerDavid Mudrák <david@moodle.com>
Fri, 9 Oct 2015 21:37:33 +0000 (23:37 +0200)
lib/upgradelib.php

index 49dd3fb..f378675 100644 (file)
@@ -2401,8 +2401,17 @@ function upgrade_install_plugins(array $installable, $confirmed, $heading='', $c
         if (!$pluginman->install_plugins($installable, true, true)) {
             throw new moodle_exception('install_plugins_failed', 'core_plugin', $return);
         }
+
         // Always redirect to admin/index.php to perform the database upgrade.
-        redirect(new moodle_url('/admin/index.php?cache=0'));
+        // Do not throw away the existing $PAGE->url parameters such as
+        // confirmupgrade or confirmrelease if $PAGE->url is a superset of the
+        // URL we must go to.
+        $mustgoto = new moodle_url('/admin/index.php', array('cache' => 0, 'confirmplugincheck' => 0));
+        if ($mustgoto->compare($PAGE->url, URL_MATCH_PARAMS)) {
+            redirect($PAGE->url);
+        } else {
+            redirect($mustgoto);
+        }
 
     } else {
         $output = $PAGE->get_renderer('core', 'admin');