/**
  * Initializes the environment and loads the Cake core.
  *
  * @return boolean Success.
  * @access private
  */
 function __bootstrap()
 {
     define('ROOT', $this->params['root']);
     define('APP_DIR', $this->params['app']);
     define('APP_PATH', $this->params['working'] . DS);
     define('WWW_ROOT', APP_PATH . $this->params['webroot'] . DS);
     $includes = array(CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'object.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'inflector.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'configure.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'file.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'cache.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'string.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'class_registry.php', CORE_PATH . 'cake' . DS . 'console' . DS . 'error.php');
     foreach ($includes as $inc) {
         if (!(require $inc)) {
             $this->stderr("Failed to load Cake core file {$inc}");
             return false;
         }
     }
     Configure::getInstance(file_exists(CONFIGS . 'bootstrap.php'));
     if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
         include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
         Configure::buildPaths(array());
     }
     Configure::write('debug', 1);
     return true;
 }
Example #2
0
 /**
  * testBuildPaths method
  *
  * @access public
  * @return void
  */
 function testBuildPaths()
 {
     Configure::buildPaths(array());
     $models = Configure::read('modelPaths');
     $this->assertTrue(!empty($models));
 }
Example #3
0
 /**
  * Loads app/config/bootstrap.php.
  * If the alternative paths are set in this file
  * they will be added to the paths vars.
  *
  * @param boolean $boot Load application bootstrap (if true)
  * @return void
  * @access private
  */
 function __loadBootstrap($boot)
 {
     $modelPaths = $behaviorPaths = $controllerPaths = $componentPaths = $viewPaths = $helperPaths = $pluginPaths = $vendorPaths = $localePaths = $shellPaths = null;
     if ($boot) {
         Configure::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR));
         if (!(include CONFIGS . 'core.php')) {
             trigger_error(sprintf(__("Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR);
         }
         if (!(include CONFIGS . 'bootstrap.php')) {
             trigger_error(sprintf(__("Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR);
         }
         if (Configure::read('Cache.disable') !== true) {
             $cache = Cache::config('default');
             if (empty($cache['settings'])) {
                 trigger_error('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', E_USER_WARNING);
                 $cache = Cache::config('default', array('engine' => 'File'));
             }
             $path = $prefix = $duration = null;
             if (!empty($cache['settings']['path'])) {
                 $path = realpath($cache['settings']['path']);
             } else {
                 $prefix = $cache['settings']['prefix'];
             }
             if (Configure::read() >= 1) {
                 $duration = '+10 seconds';
             } else {
                 $duration = '+999 days';
             }
             if (Cache::config('_cake_core_') === false) {
                 Cache::config('_cake_core_', array_merge($cache['settings'], array('prefix' => $prefix . 'cake_core_', 'path' => $path . DS . 'persistent' . DS, 'serialize' => true, 'duration' => $duration)));
             }
             if (Cache::config('_cake_model_') === false) {
                 Cache::config('_cake_model_', array_merge($cache['settings'], array('prefix' => $prefix . 'cake_model_', 'path' => $path . DS . 'models' . DS, 'serialize' => true, 'duration' => $duration)));
             }
             Cache::config('default');
         }
         Configure::buildPaths(compact('modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths', 'localePaths', 'shellPaths'));
     }
 }