diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-11-11 00:13:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-11 00:13:29 +0300 |
commit | 9dbf0f393d0548d3b26e842808eefce6b0961a2a (patch) | |
tree | 2f8a81a3376279a062a705abfce22dadf7c95d1b /plugins | |
parent | f698f0c82da4ceebbcc3294d6f4f5eb5726142b0 (diff) |
Show invalidation information in system check (#16690)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Diagnostics/Diagnostic/ReportInformational.php | 17 | ||||
-rw-r--r-- | plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png | 4 |
2 files changed, 19 insertions, 2 deletions
diff --git a/plugins/Diagnostics/Diagnostic/ReportInformational.php b/plugins/Diagnostics/Diagnostic/ReportInformational.php index 264e441917..37daaacb8a 100644 --- a/plugins/Diagnostics/Diagnostic/ReportInformational.php +++ b/plugins/Diagnostics/Diagnostic/ReportInformational.php @@ -8,6 +8,7 @@ namespace Piwik\Plugins\Diagnostics\Diagnostic; use Piwik\Access; +use Piwik\Archive\ArchiveInvalidator; use Piwik\ArchiveProcessor\Rules; use Piwik\Common; use Piwik\CronArchive; @@ -47,11 +48,27 @@ class ReportInformational implements Diagnostic $results[] = DiagnosticResult::informationalResult('Had visits in last 5 days', $this->hadVisitsInLastDays(5)); $results[] = DiagnosticResult::informationalResult('Archive Time Last Started', Option::get(CronArchive::OPTION_ARCHIVING_STARTED_TS)); $results[] = DiagnosticResult::informationalResult('Archive Time Last Finished', Option::get(CronArchive::OPTION_ARCHIVING_FINISHED_TS)); + $numQueued = $this->getNumInvalidationEntries(ArchiveInvalidator::INVALIDATION_STATUS_QUEUED); + $numInProgress = $this->getNumInvalidationEntries(ArchiveInvalidator::INVALIDATION_STATUS_IN_PROGRESS); + $results[] = DiagnosticResult::informationalResult('Num invalidations', sprintf('%s queued, %s in progress', $numQueued, $numInProgress)); } return $results; } + private function getNumInvalidationEntries($status) + { + $table = Common::prefixTable('archive_invalidations'); + + try { + $numEntries = Db::fetchOne('SELECT count(*) from ' . $table . ' WHERE `status` = ?' , $status); + } catch ( \Exception $e ) { + $numEntries = ''; + } + + return $numEntries; + } + private function hadVisitsInLastDays($numDays) { $table = Common::prefixTable('log_visit'); diff --git a/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png b/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png index a2cb14b12d..772280779a 100644 --- a/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png +++ b/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c76ce7fafabe97279dcb89cd95bd565242486a5ce61ba5a3415bc82430f9c67b -size 377534 +oid sha256:cf45155d18d773995af6800df3aea2b1a6f481b61a2087bf3f3eaf3596f5cf51 +size 381947 |