public function runAnalysis()
 {
     $ret_array = array();
     $ajaxTask = $this->getState('ajax');
     $log = $this->getState('log');
     switch ($ajaxTask) {
         case 'start':
             $tag = 'alice';
             AliceUtilLogger::WriteLog(true);
             AliceUtilLogger::WriteLog(_AE_LOG_INFO, 'Starting analysis');
             AliceCoreKettenrad::reset(array('maxrun' => 0));
             AliceUtilTempvars::reset($tag);
             $kettenrad = AliceCoreKettenrad::load($tag);
             $options = array('logToAnalyze' => AEUtilLogger::logName($log));
             $kettenrad->setup($options);
             $kettenrad->tick();
             if ($kettenrad->getState() != 'running') {
                 $kettenrad->tick();
             }
             $ret_array = $kettenrad->getStatusArray();
             $kettenrad->resetWarnings();
             // So as not to have duplicate warnings reports
             AliceCoreKettenrad::save($tag);
             break;
         case 'step':
             $tag = 'alice';
             $kettenrad = AliceCoreKettenrad::load($tag);
             $kettenrad->tick();
             $ret_array = $kettenrad->getStatusArray();
             $kettenrad->resetWarnings();
             // So as not to have duplicate warnings reports
             AliceCoreKettenrad::save($tag);
             if ($ret_array['HasRun'] == 1) {
                 // Let's get tests result
                 $config = AliceFactory::getConfiguration();
                 $feedback = $config->get('volatile.alice.feedback');
                 $ret_array['Results'] = json_encode($feedback);
                 // Clean up
                 AliceFactory::nuke();
                 AliceUtilTempvars::reset($tag);
             }
             break;
         default:
             break;
     }
     return $ret_array;
 }
Esempio n. 2
0
 /**
  * Loads the factory from the storage (if it exists) and returns a reference to the
  * Kettenrad object.
  *
  * @param null $tag
  *
  * @return AliceCoreKettenrad A reference to the Kettenrad object
  */
 public static function &load($tag = null)
 {
     if (!$tag) {
         $tag = 'alice';
     }
     AliceUtilLogger::openLog($tag);
     AliceUtilLogger::WriteLog(_AE_LOG_DEBUG, "Kettenrad :: Attempting to load from file");
     $serialized_factory = AliceUtilTempvars::get($tag);
     if ($serialized_factory !== false) {
         AliceUtilLogger::WriteLog(_AE_LOG_DEBUG, " -- Loaded stored Alice Factory");
         AliceFactory::unserialize($serialized_factory);
     } else {
         // There is no serialized factory. Nuke the in-memory factory.
         AliceUtilLogger::WriteLog(_AE_LOG_DEBUG, " -- Stored Alice Factory not found - hard reset");
         AliceFactory::nuke();
     }
     unset($serialized_factory);
     return AliceFactory::getKettenrad();
 }