Permalink
Browse files

MDL-39249 Return to the correct page after successful update deployment

The method available_update_deployer::make_execution_widget() used to
have hard-coded return URL. Now it accepts the return URL as the second
parameter and passes it to the mdeploy.php utility.

The callerurl parameter is now correctly passed and used.
  • Loading branch information...
1 parent 3a8c438 commit 5d7a4bab3f25b3f24418df07dede7ca04060cd71 @mudrd8mz mudrd8mz committed Apr 19, 2013
Showing with 11 additions and 6 deletions.
  1. +1 −1 admin/plugins.php
  2. +2 −2 admin/renderer.php
  3. +8 −3 lib/pluginlib.php
View
@@ -152,7 +152,7 @@
$deployer = available_update_deployer::instance();
if ($deployer->enabled()) {
$myurl = new moodle_url($PAGE->url, array('updatesonly' => $updatesonly, 'contribonly' => $contribonly));
- $deployer->initialize($myurl, $myurl);
+ $deployer->initialize($myurl, new moodle_url('/admin'));
$deploydata = $deployer->submitted_data();
if (!empty($deploydata)) {
View
@@ -279,10 +279,10 @@ public function upgrade_plugin_confirm_deploy_page(available_update_deployer $de
$output .= $this->output->container(get_string('updatepluginconfirmexternal', 'core_plugin', $repotype), 'updatepluginconfirmexternal');
}
- $widget = $deployer->make_execution_widget($data['updateinfo']);
+ $widget = $deployer->make_execution_widget($data['updateinfo'], $data['returnurl']);
$output .= $this->output->render($widget);
- $output .= $this->output->single_button($data['returnurl'], get_string('cancel', 'core'), 'get');
+ $output .= $this->output->single_button($data['callerurl'], get_string('cancel', 'core'), 'get');
$output .= $this->container_end();
$output .= $this->footer();
View
@@ -2003,9 +2003,10 @@ public function make_confirm_widget(available_update_info $info) {
* Prepares a renderable widget to execute installation of an available update.
*
* @param available_update_info $info component version to deploy
+ * @param moodle_url $returnurl URL to return after the installation execution
* @return renderable
*/
- public function make_execution_widget(available_update_info $info) {
+ public function make_execution_widget(available_update_info $info, moodle_url $returnurl = null) {
global $CFG;
if (!$this->initialized()) {
@@ -2022,7 +2023,11 @@ public function make_execution_widget(available_update_info $info) {
list($passfile, $password) = $this->prepare_authorization();
- $upgradeurl = new moodle_url('/admin');
+ if (is_null($returnurl)) {
+ $returnurl = new moodle_url('/admin');
+ } else {
+ $returnurl = $returnurl;
+ }
$params = array(
'upgrade' => true,
@@ -2035,7 +2040,7 @@ public function make_execution_widget(available_update_info $info) {
'dirroot' => $CFG->dirroot,
'passfile' => $passfile,
'password' => $password,
- 'returnurl' => $upgradeurl->out(true),
+ 'returnurl' => $returnurl->out(false),
);
if (!empty($CFG->proxyhost)) {

0 comments on commit 5d7a4ba

Please sign in to comment.