Beispiel #1
0
 /**
  * Sends the email notification upon Cron completion
  * @param array $emails
  * @param array $backup_paths
  * @param string $backup_type
  * @throws EmailException
  * @throws \Exception
  */
 public function sendBackupCronNotification(array $emails, array $backup_paths, $backup_type = 'database')
 {
     try {
         $backup_details = array();
         foreach ($backup_paths as $type => $backup) {
             $path_parts = pathinfo($backup);
             if (!empty($path_parts['dirname']) && !empty($path_parts['basename']) && !empty($path_parts['filename']) && !empty($path_parts['extension'])) {
                 $backup_details = $this->backup->getDetails()->getDetails($path_parts['basename'], $path_parts['dirname']);
             }
         }
         $services = $this->backup->getServices();
         $vars = array('backup_paths' => $backup_paths, 'backup_details' => $backup_details, 'backup_type' => $backup_type, 'site_name' => $services['platform']->getSiteName(), 'site_url' => $services['platform']->getSiteUrl());
         $email = $this->getMail()->setSubject($this->settings['cron_notify_email_subject'])->setMessage($this->settings['cron_notify_email_message'])->setTo($emails)->setMailtype($this->settings['cron_notify_email_mailtype']);
         $email->send($vars);
     } catch (EmailException $e) {
         $e->logException($e);
         throw new EmailException($e->getMessage());
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage());
     }
 }