diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2017-12-07 05:30:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-07 05:30:14 +0300 |
commit | b743af045f73d390d96a58e29089f993b1cded33 (patch) | |
tree | 4b2bea383252b520df470ce9a73bd8cc9469d7bc | |
parent | e375ced813687f9f7438bbb0bda860eb60fea576 (diff) |
Respect maintenance mode when archiving
-rw-r--r-- | core/CronArchive.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/CronArchive.php b/core/CronArchive.php index 4d82fab385..abd498f9d8 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -279,11 +279,21 @@ class CronArchive $this->invalidator = StaticContainer::get('Piwik\Archive\ArchiveInvalidator'); } + private function isMaintenanceModeEnabled() + { + return Config::getInstance()->General['maintenance_mode'] == 1; + } + /** * Initializes and runs the cron archiver. */ public function main() { + if ($this->isMaintenanceModeEnabled() == 1) { + $this->logger->info("Archiving won't run because maintenance mode is enabled"); + return; + } + $self = $this; Access::doAsSuperUser(function () use ($self) { $self->init(); @@ -356,6 +366,12 @@ class CronArchive $this->logger->info("Starting Piwik reports archiving..."); do { + + if ($this->isMaintenanceModeEnabled() == 1) { + $this->logger->info("Archiving will stop now because maintenance mode is enabled"); + return; + } + $idSite = $this->websites->getNextSiteId(); if (null === $idSite) { |