From 115d6033fcaf7b91a388b6e6b021a99fec27a7cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Wed, 29 Apr 2020 15:34:02 +0200 Subject: [PATCH] MDL-68558 admin: Allow to go back to plugins check page on failed deps Once the admin reaches the Plugin dependencies check with a failed plugin dependency, the "Continue" button should take him/her to the previous page where the dependency can be sorted out, or the plugin installation cancelled. Also the "Cancel this installation" should work on this page, too. None of this was happening correctly because the page with failed dependencies is loaded with "confirmplugincheck" set to 1 as a result of confirming the previous step. We must explicitly override it back to 0 to navigate the user back to the previous step. --- admin/index.php | 6 ++++-- admin/renderer.php | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/admin/index.php b/admin/index.php index 19b35227913..f9643fa8324 100644 --- a/admin/index.php +++ b/admin/index.php @@ -509,7 +509,8 @@ if (!$cache and $version > $CFG->version) { // upgrade // Always verify plugin dependencies! $failed = array(); if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed, $CFG->branch)) { - echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url); + echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url, + array('confirmplugincheck' => 0))); die(); } unset($failed); @@ -701,7 +702,8 @@ if (!$cache and moodle_needs_upgrading()) { $failed = array(); if (!$pluginman->all_plugins_ok($version, $failed, $CFG->branch)) { $output = $PAGE->get_renderer('core', 'admin'); - echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url); + echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url, + array('confirmplugincheck' => 0))); die(); } unset($failed); diff --git a/admin/renderer.php b/admin/renderer.php index cc766ce87f4..69af9545d91 100644 --- a/admin/renderer.php +++ b/admin/renderer.php @@ -1110,7 +1110,7 @@ class core_admin_renderer extends plugin_renderer_base { if (!empty($installabortable[$plugin->component])) { $status .= $this->output->single_button( - new moodle_url($this->page->url, array('abortinstall' => $plugin->component)), + new moodle_url($this->page->url, array('abortinstall' => $plugin->component, 'confirmplugincheck' => 0)), get_string('cancelinstallone', 'core_plugin'), 'post', array('class' => 'actionbutton cancelinstallone d-block mt-1') @@ -1209,7 +1209,7 @@ class core_admin_renderer extends plugin_renderer_base { if ($installabortable) { $out .= $this->output->single_button( - new moodle_url($this->page->url, array('abortinstallx' => 1)), + new moodle_url($this->page->url, array('abortinstallx' => 1, 'confirmplugincheck' => 0)), get_string('cancelinstallall', 'core_plugin', count($installabortable)), 'post', array('class' => 'singlebutton cancelinstallall mr-1')