示例#1
0
 protected function _backupData($store)
 {
     switch ($this->_serverLocation) {
         case 'local':
             $this->_out->logNotice("doing 'local' data backup");
             $this->_backupDataFromLocal($store);
             break;
         case 'remote':
             $this->_out->logNotice("doing 'remote' data backup");
             $this->_backupDataFromRemote($store);
             break;
         default:
             // try to detect best possibility
             $s = $this->_db->getAttribute(PDO::ATTR_CONNECTION_STATUS);
             $this->_out->logNotice("connection status: {$s}");
             if (stripos($s, "localhost") === false && stripos($s, "127.0.0.1") === false) {
                 // remote
                 $this->_out->logNotice("detected 'remote' data backup");
                 $this->_backupDataFromRemote($store);
             } else {
                 // maybe local will work
                 try {
                     $this->_out->logNotice("trying 'local' data backup");
                     $this->_backupDataFromLocal($store);
                 } catch (Exception $ex) {
                     $this->_out->logNotice("fallback to 'remote' data backup");
                     $this->_backupDataFromRemote($store);
                 }
             }
     }
 }
示例#2
0
 protected function _runPhase($phase, $order)
 {
     self::$out->logNotice("phase start: {$phase}");
     self::$out->mark();
     foreach ($order as $role => $driver) {
         if (method_exists($driver, $phase)) {
             $driver->{$phase}($role, $this->_roles);
         }
     }
     $sec = self::$out->time();
     self::$out->logNotice("phase {$phase} executed in {$sec} seconds");
     return true;
 }