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:
authordizzy <diosmosis@users.noreply.github.com>2021-03-11 02:05:55 +0300
committerGitHub <noreply@github.com>2021-03-11 02:05:55 +0300
commitcdbdb027ff834c860b130275c6fd3cc74c7a5db2 (patch)
tree9e8fea30f73ca6e8d19f31a225ab50f1c5ebb571 /plugins/CoreUpdater
parente0609165dbf16f71e3b684dcc133e4c10ce146d3 (diff)
Add --skip-cache-clear option to core:update command so we dont have to clear caches when updating on an empty ec2 instance (for example). (#17326)
Diffstat (limited to 'plugins/CoreUpdater')
-rw-r--r--plugins/CoreUpdater/Commands/Update.php48
-rw-r--r--plugins/CoreUpdater/lang/en.json4
2 files changed, 33 insertions, 19 deletions
diff --git a/plugins/CoreUpdater/Commands/Update.php b/plugins/CoreUpdater/Commands/Update.php
index 2962a143f5..e528796685 100644
--- a/plugins/CoreUpdater/Commands/Update.php
+++ b/plugins/CoreUpdater/Commands/Update.php
@@ -42,6 +42,7 @@ class Update extends ConsoleCommand
$this->setDescription(Piwik::translate('CoreUpdater_ConsoleCommandDescription'));
$this->addOption('yes', null, InputOption::VALUE_NONE, Piwik::translate('CoreUpdater_ConsoleParameterDescription'));
+ $this->addOption('skip-cache-clear', null, InputOption::VALUE_NONE, Piwik::translate('CoreUpdater_SkipCacheClearDesc'));
}
/**
@@ -49,33 +50,44 @@ class Update extends ConsoleCommand
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $this->executeClearCaches();
-
- $yes = $input->getOption('yes');
-
+ $skipCacheClear = $input->getOption('skip-cache-clear');
try {
- $this->makeUpdate($input, $output, true);
+ if ($skipCacheClear) {
+ $output->writeln(Piwik::translate('CoreUpdater_SkipCacheClear'));
- if (!$yes) {
- $yes = $this->askForUpdateConfirmation($input, $output);
+ Filesystem::$skipCacheClearOnUpdate = true;
}
- if ($yes) {
- $output->writeln("\n" . Piwik::translate('CoreUpdater_ConsoleStartingDbUpgrade'));
+ $this->executeClearCaches();
- $this->makeUpdate($input, $output, false);
+ $yes = $input->getOption('yes');
- $this->writeSuccessMessage($output, array(Piwik::translate('CoreUpdater_PiwikHasBeenSuccessfullyUpgraded')));
- } else {
- $this->writeSuccessMessage($output, array(Piwik::translate('CoreUpdater_DbUpgradeNotExecuted')));
- }
+ try {
+ $this->makeUpdate($input, $output, true);
+
+ if (!$yes) {
+ $yes = $this->askForUpdateConfirmation($input, $output);
+ }
- $this->writeAlertMessageWhenCommandExecutedWithUnexpectedUser($output);
+ if ($yes) {
+ $output->writeln("\n" . Piwik::translate('CoreUpdater_ConsoleStartingDbUpgrade'));
+ $this->makeUpdate($input, $output, false);
- } catch(NoUpdatesFoundException $e) {
- // Do not fail if no updates were found
- $this->writeSuccessMessage($output, array($e->getMessage()));
+ $this->writeSuccessMessage($output, array(Piwik::translate('CoreUpdater_PiwikHasBeenSuccessfullyUpgraded')));
+ } else {
+ $this->writeSuccessMessage($output, array(Piwik::translate('CoreUpdater_DbUpgradeNotExecuted')));
+ }
+
+ $this->writeAlertMessageWhenCommandExecutedWithUnexpectedUser($output);
+
+
+ } catch (NoUpdatesFoundException $e) {
+ // Do not fail if no updates were found
+ $this->writeSuccessMessage($output, array($e->getMessage()));
+ }
+ } finally {
+ Filesystem::$skipCacheClearOnUpdate = false;
}
}
diff --git a/plugins/CoreUpdater/lang/en.json b/plugins/CoreUpdater/lang/en.json
index 0526bfc9a9..08338b261e 100644
--- a/plugins/CoreUpdater/lang/en.json
+++ b/plugins/CoreUpdater/lang/en.json
@@ -95,6 +95,8 @@
"ReceiveEmailBecauseIsSuperUser": "You receive this email because you are a Super User on the Matomo at: %s",
"ConvertToUtf8mb4": "Convert database to UTF8mb4 charset",
"TriggerDatabaseConversion": "Trigger database conversion in background",
- "Utf8mb4ConversionHelp": "Your database is currently not using utf8mb4 charset. This makes it impossible to store 4-byte characters, such as emojis, less common characters of asian languages, various historic scripts or mathematical symbols. Those are currently replaced with %1$s.<br /><br />Your database supports the utf8mb4 charset and it would be possible to convert it.<br /><br />If you are able to run console commands we recommend using this command: %2$s<br /><br />Alternatively you can enable the conversion here. It will then be triggered automatically as a scheduled task in the background.<br /><br />Attention: Converting the database might take up to a couple of hours depending on the database size. As tracking might not work during this process, we do not recommend to use the trigger for bigger instances.<br /><br />You can find more information about this topic in this %3$sFAQ%4$s."
+ "Utf8mb4ConversionHelp": "Your database is currently not using utf8mb4 charset. This makes it impossible to store 4-byte characters, such as emojis, less common characters of asian languages, various historic scripts or mathematical symbols. Those are currently replaced with %1$s.<br /><br />Your database supports the utf8mb4 charset and it would be possible to convert it.<br /><br />If you are able to run console commands we recommend using this command: %2$s<br /><br />Alternatively you can enable the conversion here. It will then be triggered automatically as a scheduled task in the background.<br /><br />Attention: Converting the database might take up to a couple of hours depending on the database size. As tracking might not work during this process, we do not recommend to use the trigger for bigger instances.<br /><br />You can find more information about this topic in this %3$sFAQ%4$s.",
+ "SkipCacheClearDesc": "Skips clearing of caches before updating. This is only useful if you can ensure that instances running this command have not created a cache at all yet, and if clearing the cache for many Matomo accounts can become a bottleneck.",
+ "SkipCacheClear": "Skipping clearing caches."
}
}