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:
authordiosmosis <diosmosis@users.noreply.github.com>2020-04-16 23:24:39 +0300
committerGitHub <noreply@github.com>2020-04-16 23:24:39 +0300
commit37182bfda5529ddb4ba2aaedd09beb1e5ae94fbb (patch)
treef6609b714e4e6cac35769f98e8f47f5e95071b5f /plugins/CoreUpdater
parente943702e1e54bfc71d423bfd2ec2a48c0a4610f7 (diff)
merge 3.x to 4.x (#15821)
* Avoid possible error subtable already exists but not loaded (#15779) * Make sure to always set JSON_PIWIK to native JSON when possible (#15785) * make sure to always set JSON_PIWIK to native JSON when possible * rebuilt piwik.js * Force POST for bulk requests, fix alwaysUseSendBeacon not respected for bulk requests (#15784) * Force POST for bulk requests, fix alwaysUseSendBeacon not respected for bulk requests * rebuilt piwik.js * Make sure to clean up tracking failures before sending email notification (#15798) Feedback from a customer... Eg the daily `cleanupTrackingFailures()` action might be only executed after the weekly `notifyTrackingFailures` therefore we should try to clean up failures first and then check if any are left. Avoids the case where a user opens hours later the email they receive and then there are no tracking failures reported. This could still happen but it's a bit less likely. * 3.13.5-b1 * Faster segmented suggested values when browser archiving is disabled (#15786) * Faster segmented suggested values when browser archiving is disabled * make sure no segment is set * remove wrong var type * fix/add tests * add more segment values * detect if we should flatten or not * add docs * Fix problem when comparing segments or opening popovers (#15809) refs #15805 * purge all old archives regardless of done value (#15800) * purge all old archives regardless of done value, we only care about the newest usable one * Fix test and start on new one. * Add coverage for change in tests. * there is no longer an inner join so should not need the idsite check * Add more parameters to the computeNbUnique event (#15808) * 3.13.5-b2 * One click update in two parts so new code is loaded for second. (#15770) * One click update in two parts so new code is loaded for second. * remove no longer needed code Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com> Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com> Co-authored-by: Stefan Giehl <stefan@matomo.org>
Diffstat (limited to 'plugins/CoreUpdater')
-rw-r--r--plugins/CoreUpdater/Controller.php12
-rw-r--r--plugins/CoreUpdater/Updater.php65
2 files changed, 51 insertions, 26 deletions
diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php
index d7ebb79489..306a27ed23 100644
--- a/plugins/CoreUpdater/Controller.php
+++ b/plugins/CoreUpdater/Controller.php
@@ -12,6 +12,7 @@ use Exception;
use Piwik\AssetManager;
use Piwik\Common;
use Piwik\Config;
+use Piwik\DataTable\Renderer\Json;
use Piwik\DbHelper;
use Piwik\Filechecks;
use Piwik\FileIntegrity;
@@ -172,6 +173,17 @@ class Controller extends \Piwik\Plugin\Controller
return $view->render();
}
+ public function oneClickUpdatePartTwo()
+ {
+ Piwik::checkUserHasSuperUserAccess();
+
+ Json::sendHeaderJSON();
+
+ $messages = $this->updater->oneClickUpdatePartTwo();
+
+ echo json_encode($messages);
+ }
+
public function oneClickResults()
{
Filesystem::deleteAllCacheOnUpdate();
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;
}