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:
authorThomas Steur <tsteur@users.noreply.github.com>2020-11-18 08:27:21 +0300
committerGitHub <noreply@github.com>2020-11-18 08:27:21 +0300
commit28c39f4ce080618cf1c89e0a400b352a28fcf8b3 (patch)
treecdd7c2bbf7a2eee3966d5d80b267d68fd124e9cf
parentb01ce3bb4ec6e350b44ceef93899ab4cf4946ebe (diff)
Detect when both auto archiving and browser archiving is enabled (#16738)4.0.0-rc5
* Detect when both auto archiving and browser archiving is enabled * add translation keys
-rw-r--r--plugins/Diagnostics/Diagnostic/CronArchivingCheck.php21
-rw-r--r--plugins/Diagnostics/lang/en.json2
2 files changed, 21 insertions, 2 deletions
diff --git a/plugins/Diagnostics/Diagnostic/CronArchivingCheck.php b/plugins/Diagnostics/Diagnostic/CronArchivingCheck.php
index 9d44e1393e..77e5514207 100644
--- a/plugins/Diagnostics/Diagnostic/CronArchivingCheck.php
+++ b/plugins/Diagnostics/Diagnostic/CronArchivingCheck.php
@@ -11,7 +11,11 @@ namespace Piwik\Plugins\Diagnostics\Diagnostic;
use Piwik\ArchiveProcessor\Rules;
use Piwik\CliMulti;
use Piwik\Config;
+use Piwik\CronArchive;
+use Piwik\Date;
use Piwik\Http;
+use Piwik\Metrics\Formatter;
+use Piwik\Option;
use Piwik\SettingsPiwik;
use Piwik\Translation\Translator;
use Piwik\Url;
@@ -37,11 +41,24 @@ class CronArchivingCheck implements Diagnostic
$this->translator->translate('Installation_FasterReportLoading') . ')';
if (SettingsPiwik::isMatomoInstalled()) {
- $isBrowserTriggerDisabled = !Rules::isBrowserTriggerEnabled();
- if (!$isBrowserTriggerDisabled) {
+ $isBrowserTriggerEnabled = Rules::isBrowserTriggerEnabled();
+ if ($isBrowserTriggerEnabled) {
$comment = $this->translator->translate('Diagnostics_BrowserTriggeredArchivingEnabled', [
'<a href="https://matomo.org/docs/setup-auto-archiving/" target="_blank" rel="noreferrer noopener">', '</a>']);
$result[] = DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment);
+
+ $archiveLastStarted = Option::get(CronArchive::OPTION_ARCHIVING_STARTED_TS);
+ $thirtySixHoursAgoInSeconds = 36 * 3600;
+ if ($archiveLastStarted && $archiveLastStarted > (time() - $thirtySixHoursAgoInSeconds)) {
+ // auto archive was used recently... if they maybe only once ran core:archive then eventually it will correct
+ // itself and no longer show this
+ $formatter = new Formatter();
+ $lastStarted = $formatter->getPrettyTimeFromSeconds(time() - $archiveLastStarted, true);
+ $label = $this->translator->translate('Diagnostics_BrowserAndAutoArchivingEnabledLabel');
+ $comment = $this->translator->translate('Diagnostics_BrowserAndAutoArchivingEnabledComment', [
+ '<a href="https://matomo.org/docs/setup-auto-archiving/" target="_blank" rel="noreferrer noopener">', '</a>', $lastStarted]);
+ $result[] = DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment);
+ }
}
}
diff --git a/plugins/Diagnostics/lang/en.json b/plugins/Diagnostics/lang/en.json
index cf7f935f23..ba8b14ed45 100644
--- a/plugins/Diagnostics/lang/en.json
+++ b/plugins/Diagnostics/lang/en.json
@@ -8,6 +8,8 @@
"ConfigFileIntroduction": "Here you can view the Matomo configuration. If you are running Matomo in a load balanced environment, the page might be different depending on from which server this page is loaded. Rows with a different background color are changed config values that are specified for example in the %1$s file.",
"HideUnchanged": "If you want to see only changed values you can %1$shide all unchanged values%2$s.",
"Sections": "Sections",
+ "BrowserAndAutoArchivingEnabledLabel": "Browser and Auto-archiving enabled",
+ "BrowserAndAutoArchivingEnabledComment": "It looks like both browser and auto archiving are enabled. Auto archiving last started %3$s ago. If %1$sauto archiving%2$s is enabled, you should disable browser archiving in \"General Settings\".",
"DatabaseReaderConnection": "Database Reader Connection",
"DatabaseUtf8Requirement": "This is required to be able to store 4-byte UTF8 characters. Unless utf8mb4 is available special characters, such as emojis, less common characters of asian languages, various historic scripts or mathematical symbols will be replaced with %1$s. You can read more details about this topic in %2$sthis FAQ%3$s.",
"DatabaseUtf8mb4CharsetRecommended": "Your database doesn't support utf8mb4 charset yet.",