mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removing wrapper method that didn't contribute anything.
Adding doc blocks for the sequence bootstrapping takes.
This commit is contained in:
parent
b371de8cf4
commit
a8ba73da62
1 changed files with 64 additions and 67 deletions
|
@ -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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -316,70 +379,4 @@ class Configure {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue