diff options
author | paladox <paladox@users.noreply.github.com> | 2019-05-03 00:10:48 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2019-05-03 00:10:48 +0300 |
commit | c9f70ee230fc2ae367718b305483fea3c673dab8 (patch) | |
tree | 171248a2c66aad990c3b1dceb3cb5a8d517ddb44 /core | |
parent | 3492c37659ff9d5368d8b43827466e0edae6f392 (diff) |
CronArchive: Catch UnexpectedWebsiteFoundException (#14403)
* CronArchive: Catch UnexpectedWebsiteFoundException
This is to allow the archive to continue if the site was deleted from matomo.
Fixes #14393
* Update CronArchive.php
Diffstat (limited to 'core')
-rw-r--r-- | core/CronArchive.php | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/core/CronArchive.php b/core/CronArchive.php index 49df8bab61..706dd4c5c6 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -459,17 +459,22 @@ class CronArchive // to process the archives for this website (only if there were visits since midnight) if (!$hasWebsiteDayFinishedSinceLastRun && !$isOldReportInvalidatedForWebsite) { - if ($this->isWebsiteUsingTheTracker($idSite)) { - - if(!$this->hadWebsiteTrafficSinceMidnightInTimezone($idSite)) { - $this->logger->info("Skipped website id $idSite as archiving is not needed"); - - $this->skippedDayNoRecentData++; - $this->skipped++; - continue; + try { + if ($this->isWebsiteUsingTheTracker($idSite)) { + + if(!$this->hadWebsiteTrafficSinceMidnightInTimezone($idSite)) { + $this->logger->info("Skipped website id $idSite as archiving is not needed"); + + $this->skippedDayNoRecentData++; + $this->skipped++; + continue; + } + } else { + $this->logger->info("- website id $idSite is not using the tracker"); } - } else { - $this->logger->info("- website id $idSite is not using the tracker"); + } catch (UnexpectedWebsiteFoundException $e) { + $this->logger->info("Skipped website id $idSite, got: UnexpectedWebsiteFoundException"); + continue; } } elseif ($hasWebsiteDayFinishedSinceLastRun) { @@ -716,7 +721,13 @@ class CronArchive /** * Trigger archiving for non-day periods */ - $success = $this->processArchiveForPeriods($idSite, $lastTimestampWebsiteProcessedPeriods); + try { + $success = $this->processArchiveForPeriods($idSite, $lastTimestampWebsiteProcessedPeriods); + } catch (UnexpectedWebsiteFoundException $e) { + // this website was deleted in the meantime + $this->logger->info("Skipped website id $idSite, got: UnexpectedWebsiteFoundException, " . $timerWebsite->__toString()); + return false; + } // Record successful run of this website's periods archiving if ($success) { |