Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-39249-upgrade-wizard' of git://github.com/mudrd8mz/…
…moodle
  • Loading branch information
danpoltawski committed Apr 22, 2013
2 parents 997f302 + 7b1e064 commit 816659e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion admin/plugins.php
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions admin/renderer.php
Expand Up @@ -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();
Expand Down
13 changes: 9 additions & 4 deletions lib/pluginlib.php
Expand Up @@ -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()) {
Expand All @@ -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,
Expand All @@ -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)) {
Expand Down Expand Up @@ -2206,7 +2211,7 @@ protected function data_to_params($data) {
if (!empty($this->callerurl)) {
$data['callerurl'] = $this->callerurl->out(false);
}
if (!empty($this->callerurl)) {
if (!empty($this->returnurl)) {
$data['returnurl'] = $this->returnurl->out(false);
}

Expand Down

0 comments on commit 816659e

Please sign in to comment.