Skip to content

Commit

Permalink
Removing wrapper method that didn't contribute anything.
Browse files Browse the repository at this point in the history
Adding doc blocks for the sequence bootstrapping takes.
  • Loading branch information
markstory committed Nov 26, 2010
1 parent b371de8 commit a8ba73d
Showing 1 changed file with 64 additions and 67 deletions.
131 changes: 64 additions & 67 deletions cake/libs/configure.php
Expand Up @@ -42,11 +42,74 @@ class Configure {

/**
* Initializes configure and runs the bootstrap process.
* Bootstrapping includes the following steps:
*
* - Setup App array in Configure.
* - Include app/config/core.php.
* - Configure core cache configurations.
* - Load App cache files.
* - Include app/config/bootstrap.php.
* - Setup error/exception handlers.
*
* @return void
*/
public static function bootstrap($boot = true) {
self::__loadBootstrap($boot);
if ($boot) {
self::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR, 'www_root' => WWW_ROOT));

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."), 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('debug') >= 1) {
$duration = '+10 seconds';
} else {
$duration = '+999 days';
}

if (Cache::config('_cake_core_') === false) {
Cache::config('_cake_core_', array_merge((array)$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((array)$cache['settings'], array(
'prefix' => $prefix . 'cake_model_', 'path' => $path . DS . 'models' . DS,
'serialize' => true, 'duration' => $duration
)));
}
}

App::init();
App::build();
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."), CONFIGS), E_USER_ERROR);
}

if (!empty(self::$_values['Error']['handler'])) {
set_error_handler(self::$_values['Error']['handler']);
}
if (!empty(self::$_values['Exception']['handler'])) {
set_exception_handler(self::$_values['Exception']['handler']);
}
}
}

/**
Expand Down Expand Up @@ -316,70 +379,4 @@ private static function __writeConfig($content, $name, $write = true) {
}
}

/**
* 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
*/
private static function __loadBootstrap($boot) {
if ($boot) {
Configure::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR, 'www_root' => WWW_ROOT));

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."), 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('debug') >= 1) {
$duration = '+10 seconds';
} else {
$duration = '+999 days';
}

if (Cache::config('_cake_core_') === false) {
Cache::config('_cake_core_', array_merge((array)$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((array)$cache['settings'], array(
'prefix' => $prefix . 'cake_model_', 'path' => $path . DS . 'models' . DS,
'serialize' => true, 'duration' => $duration
)));
}
}

App::init();
App::build();
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."), CONFIGS), E_USER_ERROR);
}

if (!empty(self::$_values['Error']['handler'])) {
set_error_handler(self::$_values['Error']['handler']);
}
if (!empty(self::$_values['Exception']['handler'])) {
set_exception_handler(self::$_values['Exception']['handler']);
}
}
}
}

0 comments on commit a8ba73d

Please sign in to comment.