Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CoreUpdater/Updater.php')
-rw-r--r--plugins/CoreUpdater/Updater.php65
1 files changed, 39 insertions, 26 deletions
diff --git a/plugins/CoreUpdater/Updater.php b/plugins/CoreUpdater/Updater.php
index 7baee1d46a..d3f8f54e1c 100644
--- a/plugins/CoreUpdater/Updater.php
+++ b/plugins/CoreUpdater/Updater.php
@@ -23,6 +23,7 @@ use Piwik\Plugins\Marketplace\Marketplace;
use Piwik\SettingsServer;
use Piwik\Translation\Translator;
use Piwik\Unzip;
+use Piwik\Url;
use Piwik\Version;
class Updater
@@ -114,21 +115,6 @@ class Updater
$this->verifyDecompressedArchive($extractedArchiveDirectory);
$messages[] = $this->translator->translate('CoreUpdater_VerifyingUnpackedFiles');
- if (Marketplace::isMarketplaceEnabled()) {
- // we need to load the marketplace already here, otherwise it will use the new, updated file in Piwik 3
-
- // 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
- $environment = StaticContainer::getContainer()->make('Piwik\Plugins\Marketplace\Environment');
- $environment->setPiwikVersion($newVersion);
- /** @var \Piwik\Plugins\Marketplace\Api\Client $marketplaceClient */
- $marketplaceClient = StaticContainer::getContainer()->make('Piwik\Plugins\Marketplace\Api\Client', array(
- 'environment' => $environment
- ));
- require_once PIWIK_DOCUMENT_ROOT . '/plugins/CorePluginsAdmin/PluginInstaller.php';
- require_once PIWIK_DOCUMENT_ROOT . '/plugins/Marketplace/Api/Exception.php';
- }
-
$this->installNewFiles($extractedArchiveDirectory);
$messages[] = $this->translator->translate('CoreUpdater_InstallingTheLatestVersion');
@@ -138,9 +124,45 @@ class Updater
throw new UpdaterException($e, $messages);
}
+ $partTwoUrl = Url::getCurrentUrlWithoutQueryString() . Url::getCurrentQueryStringWithParametersModified([
+ 'action' => 'oneClickUpdatePartTwo',
+ ]);
+
+ $response = Http::sendHttpRequest($partTwoUrl, 300);
+ $response = @json_decode($response, $assoc = true);
+
+ $messages = array_merge($messages, $response);
+
+ try {
+ $disabledPluginNames = $this->disableIncompatiblePlugins($newVersion);
+ if (!empty($disabledPluginNames)) {
+ $messages[] = $this->translator->translate('CoreUpdater_DisablingIncompatiblePlugins', implode(', ', $disabledPluginNames));
+ }
+ } catch (Exception $e) {
+ throw new UpdaterException($e, $messages);
+ }
+
+ return $messages;
+ }
+
+ public function oneClickUpdatePartTwo()
+ {
+ $messages = [];
+
+ $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
+ $environment = StaticContainer::getContainer()->make('Piwik\Plugins\Marketplace\Environment');
+ $environment->setPiwikVersion($newVersion);
+ /** @var \Piwik\Plugins\Marketplace\Api\Client $marketplaceClient */
+ $marketplaceClient = StaticContainer::getContainer()->make('Piwik\Plugins\Marketplace\Api\Client', array(
+ 'environment' => $environment
+ ));
+
try {
- if (Marketplace::isMarketplaceEnabled() && !empty($marketplaceClient)) {
+ if (Marketplace::isMarketplaceEnabled()) {
$messages[] = $this->translator->translate('CoreUpdater_CheckingForPluginUpdates');
$pluginManager = PluginManager::getInstance();
$pluginManager->loadAllPluginsAndGetTheirInfo();
@@ -152,7 +174,7 @@ class Updater
foreach ($pluginsWithUpdate as $pluginWithUpdate) {
$pluginName = $pluginWithUpdate['name'];
$messages[] = $this->translator->translate('CoreUpdater_UpdatingPluginXToVersionY',
- array($pluginName, $pluginWithUpdate['version']));
+ array($pluginName, $pluginWithUpdate['version']));
$pluginInstaller = new PluginInstaller($marketplaceClient);
$pluginInstaller->installOrUpdatePluginFromMarketplace($pluginName);
}
@@ -163,15 +185,6 @@ class Updater
throw new UpdaterException($e, $messages);
}
- try {
- $disabledPluginNames = $this->disableIncompatiblePlugins($newVersion);
- if (!empty($disabledPluginNames)) {
- $messages[] = $this->translator->translate('CoreUpdater_DisablingIncompatiblePlugins', implode(', ', $disabledPluginNames));
- }
- } catch (Exception $e) {
- throw new UpdaterException($e, $messages);
- }
-
return $messages;
}