Пример #1
0
 /**
  * Implements the _run() abstract method
  */
 protected function _run()
 {
     if ($this->getState() == 'postrun') {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Already finished");
         $this->setStep('');
         $this->setSubstep('');
     } else {
         $this->setState('running');
     }
     // Make sure we have a dumper instance loaded!
     if (is_null($this->dump_engine) && !empty($this->database_list)) {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Iterating next database");
         // Create a new instance
         $this->dump_engine = AEFactory::getDumpEngine(true);
         // Configure the dumper instance and pass on the volatile database root registry key
         $registry = AEFactory::getConfiguration();
         $rootkeys = array_keys($this->database_list);
         $root = array_shift($rootkeys);
         $registry->set('volatile.database.root', $root);
         $this->database_config = array_shift($this->database_list);
         $this->database_config['root'] = $root;
         $this->database_config['process_empty_prefix'] = $root == '[SITEDB]' ? true : false;
         $this->dump_engine->setup($this->database_config);
         // Error propagation
         $this->propagateFromObject($this->dump_engine);
         if ($this->getError()) {
             return false;
         }
     } elseif (is_null($this->dump_engine) && empty($this->database_list)) {
         $this->setError('Current dump engine died while resuming the step');
         return false;
     }
     // Try to step the instance
     $retArray = $this->dump_engine->tick();
     // Error propagation
     $this->propagateFromObject($this->dump_engine);
     if ($this->getError()) {
         return false;
     }
     $this->setStep($retArray['Step']);
     $this->setSubstep($retArray['Substep']);
     // Check if the instance has finished
     if (!$retArray['HasRun']) {
         // The instance has finished
         // Set the number of parts
         $this->database_config['parts'] = $this->dump_engine->partNumber + 1;
         // Push the definition
         array_push($this->dumpedDatabases, $this->database_config);
         // Go to the next entry in the list and dispose the old AkeebaDumperDefault instance
         $this->dump_engine = null;
         // Are we past the end of the list?
         if (empty($this->database_list)) {
             AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: No more databases left to iterate");
             $this->setState('postrun');
         }
     }
 }