diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-09-11 01:09:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 01:09:32 +0300 |
commit | ae865053ef9f501e13cedd5ad9a6e66c0a0fc832 (patch) | |
tree | 8925b3d6a0073814f24619db8d76e1a874828637 | |
parent | c554350dd0f712c55f1e91d14d2619552609ef4f (diff) |
Simplify updater further should climulti not work (#16419)
-rw-r--r-- | plugins/CoreUpdater/Controller.php | 6 | ||||
-rw-r--r-- | plugins/CoreUpdater/Updater.php | 18 |
2 files changed, 9 insertions, 15 deletions
diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index 207bf9f329..0609fdc994 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -172,11 +172,9 @@ class Controller extends \Piwik\Plugin\Controller return $view->render(); } - public function oneClickUpdatePartTwo($sendHeader = true) + public function oneClickUpdatePartTwo() { - if ($sendHeader) { - Json::sendHeaderJSON(); - } + Json::sendHeaderJSON(); $task = "Couldn't update Marketplace plugins."; diff --git a/plugins/CoreUpdater/Updater.php b/plugins/CoreUpdater/Updater.php index 17af015fab..1fd9952151 100644 --- a/plugins/CoreUpdater/Updater.php +++ b/plugins/CoreUpdater/Updater.php @@ -146,15 +146,9 @@ class Updater // in case this works. For explample $response is in this case not an array but a string because the "communcation" // with the controller went wrong: "Got invalid response from API request: https://ABC/?module=CoreUpdater&action=oneClickUpdatePartTwo&nonce=ABC. Response was \'curl_exec: SSL certificate problem: unable to get local issuer certificate. Hostname requested was: ABC" try { - $response = null; - Context::executeWithQueryParameters(array('nonce' => $nonce), function () use (&$response) { - $response = FrontController::getInstance()->dispatch('CoreUpdater', 'oneClickUpdatePartTwo', array($sendHeader = false)); - }); - if (!empty($response)) { - $response = @json_decode($response, $assoc = true); - if (!empty($response) && is_array($response)) { - $messages = array_merge($messages, $response); - } + $response = $this->oneClickUpdatePartTwo($newVersion); + if (!empty($response) && is_array($response)) { + $messages = array_merge($messages, $response); } } catch (Exception $e) { // ignore any error should this fail too. this might be the case eg if @@ -178,7 +172,7 @@ class Updater return $messages; } - public function oneClickUpdatePartTwo() + public function oneClickUpdatePartTwo($newVersion = null) { $messages = []; @@ -188,7 +182,9 @@ class Updater return $messages; } - $newVersion = Version::VERSION; + if (empty($newVersion)) { + $newVersion = Version::VERSION; + } // we also need to make sure to create a new instance here as otherwise we would change the "global" // environment, but we only want to change piwik version temporarily for this task here |