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.
This commit is contained in:
David Mudrák
2013-04-20 03:00:19 +02:00
parent 3a8c4380c0
commit 5d7a4bab3f
3 changed files with 11 additions and 6 deletions
+8 -3
View File
@@ -2003,9 +2003,10 @@ class available_update_deployer {
* 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 @@ class available_update_deployer {
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 @@ class available_update_deployer {
'dirroot' => $CFG->dirroot,
'passfile' => $passfile,
'password' => $password,
'returnurl' => $upgradeurl->out(true),
'returnurl' => $returnurl->out(false),
);
if (!empty($CFG->proxyhost)) {