public function handleBackup($pass)
 {
     if ($this->backupPassword !== null) {
         if ($this->backupPassword != $pass) {
             $this->logger->addWarning('Unauthorized try to backup database (auto)');
             return;
         }
     }
     if ($this->cache->load('databaseBackup') !== null) {
         $this->logger->addNotice('Another try to backup database (auto)');
         return;
     }
     try {
         $this->databaseBackup->backup('auto', true);
         $this->cache->save('databaseBackup', 'done', [Cache::EXPIRE => '23 hours']);
     } catch (\Exception $e) {
         $this->logger->addError(sprintf('Database backup failure (auto). %s', $e));
     }
 }
예제 #2
0
 /**
  * {@inheritdoc}
  * @return Boolean Whether the record has been processed
  */
 public function addNotice($message, array $context = [])
 {
     return $this->parentLogger->addNotice($message, ['channel' => $this->name] + $context);
 }