示例#1
0
 /**
  * Steps the CUBE, performing yet another small chunk of backup work necessary
  *
  */
 function tick()
 {
     if (!$this->_initialised) {
         $this->setError(JText::_('CUBE_NOTINIT'));
     } elseif (!$this->getError() && !$this->_isFinished) {
         $algorithmRunner = new JoomlapackCUBEAlgorunner();
         $algo = $algorithmRunner->selectAlgorithm($this->_activeDomain);
         switch ($this->_activeDomain) {
             case 'init':
             case 'finale':
                 $ret = 1;
                 break;
             default:
                 if (!is_object($this->_object)) {
                     $algorithmRunner->setError('Current object is not an object on ' . $this->_activeDomain);
                     $ret = 2;
                 } else {
                     $ret = $algorithmRunner->runAlgorithm($algo, $this->_object);
                     $this->_currentStep = $algorithmRunner->currentStep;
                     $this->_currentSubstep = $algorithmRunner->currentSubstep;
                 }
                 break;
         }
         switch ($ret) {
             case 0:
                 // more work to do, return OK
                 JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "CUBE :: More work required in domain '" . $this->_activeDomain);
                 break;
             case 1:
                 // Engine part finished
                 JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "CUBE :: Domain '" . $this->_activeDomain . "' has finished");
                 $this->_getNextObject();
                 if ($this->_activeDomain == "finale") {
                     // We have finished the whole process.
                     JoomlapackCUBE::_finalise();
                     JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "CUBE :: Just finished");
                 }
                 break;
             case 2:
                 // An error occured...
                 JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "CUBE :: Error occured in domain '" . $this->_activeDomain);
                 $this->setError($algorithmRunner->getError());
                 $this->reset();
                 //$this->_isFinished = true;
                 break;
         }
     }
     return $this->_makeCUBEArray();
 }