Esempio n. 1
0
 protected function _prepare()
 {
     // Initialize counters
     $registry = AliceFactory::getConfiguration();
     $registry->set('volatile.step_counter', 0);
     $registry->set('volatile.operation_counter', 0);
     // Initialize temporary storage
     AliceUtilTempvars::reset();
     // Force load the tag
     $kettenrad = AliceFactory::getKettenrad();
     $tag = $kettenrad->getTag();
     $this->setState('prepared');
 }
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();
 }