Exemplo n.º 1
0
 /**
  * (non-PHPdoc)
  * @see \mithra62\Bootstrap::getServices()
  */
 public function getServices()
 {
     $this->container = parent::getServices();
     $this->container['settings'] = function ($c) {
         $settings = new Settings($c['db'], $c['lang']);
         $db_info = $this->getDbConfig();
         $settings->setOverrides($c['platform']->getConfigOverrides())->setEncrypt($c['encrypt'])->setValidate($c['settings_validate'])->setTable($db_info['settings_table_name']);
         return $settings;
     };
     $this->container['backups'] = function ($c) {
         $backups = new Backups($c['files']);
         return $backups;
     };
     $this->container['backup'] = function ($c) {
         $backup = new Backup($c['db']);
         $backup->setServices($c);
         return $backup;
     };
     $this->container['restore'] = function ($c) {
         $restore = new Restore($c['db']);
         $restore->setServices($c);
         return $restore;
     };
     $this->container['errors'] = function ($c) {
         $errors = new Errors();
         $errors->setValidation($c['validate']);
         return $errors;
     };
     $this->container['notify'] = function ($c) {
         $notify = new Notify();
         $view_dir = realpath(dirname(__FILE__) . '/view');
         $notify->setMail($c['email'])->setViewPath($view_dir)->setSettings($c['settings']->get());
         return $notify;
     };
     $this->container['settings_validate'] = function ($c) {
         $validate = new valSettings();
         $validate->setRegex($this->container['regex']);
         return $validate;
     };
     return $this->container;
 }
Exemplo n.º 2
0
 public function sendBackupState(array $emails, array $backup_meta, array $errors)
 {
     $type = 'files';
     $frequency = $this->settings['file_backup_alert_threshold'];
     if (isset($errors['backup_state_db_backups'])) {
         $type = 'database';
         $frequency = $this->settings['db_backup_alert_threshold'];
     }
     $services = $this->backup->getServices();
     $vars = array('last_backup_date' => $backup_meta[$type]['newest_backup_taken'], 'backup_frequency' => $frequency, 'backup_type' => $type, 'site_name' => $services['platform']->getSiteName(), 'site_url' => $services['platform']->getSiteUrl());
     $email = $this->getMail()->setSubject($this->settings['backup_missed_schedule_notify_email_subject'])->setMessage($this->settings['backup_missed_schedule_notify_email_message'])->setTo($emails)->setMailtype($this->settings['backup_missed_schedule_notify_email_mailtype']);
     $email->send($vars);
 }