Exemplo n.º 1
0
 public function bootstrap($env)
 {
     putenv('RUN_CLI_MODE=true');
     define('RUN_CLI_MODE', true);
     defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../../../application'));
     // Define application environment
     defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : $env);
     // bootstrap include_path and constants
     require realpath(APPLICATION_PATH . '/../library/library.php');
     /** Zend_Application */
     require_once 'Zend/Application.php';
     require_once 'Centurion/Application.php';
     require_once 'Zend/Loader/Autoloader.php';
     $autoloader = Zend_Loader_Autoloader::getInstance()->registerNamespace('Centurion_')->setDefaultAutoloader(create_function('$class', "include str_replace('_', '/', \$class) . '.php';"));
     $classFileIncCache = realpath(APPLICATION_PATH . '/../data/cache') . '/pluginLoaderCache.tmp';
     if (file_exists($classFileIncCache)) {
         $fp = fopen($classFileIncCache, 'r');
         flock($fp, LOCK_SH);
         $data = file_get_contents($classFileIncCache);
         flock($fp, LOCK_UN);
         fclose($fp);
         $data = @unserialize($data);
         if ($data !== false) {
             Centurion_Loader_PluginLoader::setStaticCachePlugin($data);
         }
     }
     Centurion_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     // Create application, bootstrap, and run
     $this->_application = new Centurion_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/');
     $this->_application->bootstrap('db');
     $this->_application->bootstrap('FrontController');
     $this->_application->bootstrap('contrib');
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     self::$_classFileIncCache = realpath(APPLICATION_PATH . '/../data/cache') . '/pluginLoaderCache.tmp';
     if (file_exists(self::$_classFileIncCache)) {
         unlink(self::$_classFileIncCache);
     }
     Centurion_Loader_PluginLoader::setIncludeFileCache(self::$_classFileIncCache);
 }