diff options
Diffstat (limited to 'plugins/Diagnostics/Diagnostic/CronArchivingCheck.php')
-rw-r--r-- | plugins/Diagnostics/Diagnostic/CronArchivingCheck.php | 21 |
1 files changed, 19 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); + } } } |