Merge branch 'configure-changes' into 1.3

This commit is contained in:
Mark Story 2010-02-15 12:11:05 -05:00
commit e1eb827ee8

View file

@ -384,8 +384,6 @@ class Configure extends Object {
* @access private * @access private
*/ */
function __loadBootstrap($boot) { function __loadBootstrap($boot) {
$libPaths = $modelPaths = $behaviorPaths = $controllerPaths = $componentPaths = $viewPaths = $helperPaths = $pluginPaths = $vendorPaths = $localePaths = $shellPaths = null;
if ($boot) { if ($boot) {
Configure::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR, 'www_root' => WWW_ROOT)); Configure::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR, 'www_root' => WWW_ROOT));
@ -429,19 +427,10 @@ class Configure extends Object {
} }
Cache::config('default'); Cache::config('default');
} }
App::build();
if (!include(CONFIGS . 'bootstrap.php')) { 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); 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 (App::path('controllers') == array()) {
App::build(array(
'models' => $modelPaths, 'views' => $viewPaths, 'controllers' => $controllerPaths,
'helpers' => $helperPaths, 'components' => $componentPaths, 'behaviors' => $behaviorPaths,
'plugins' => $pluginPaths, 'vendors' => $vendorPaths, 'locales' => $localePaths,
'shells' => $shellPaths, 'libs' => $libPaths
));
}
} }
} }
} }
@ -740,39 +729,23 @@ class App extends Object {
} }
if (!$paths) { if (!$paths) {
$paths = array(); $paths = array();
$openBasedir = ini_get('open_basedir'); $libs = dirname(__FILE__) . DS;
if ($openBasedir) { $cake = dirname($libs) . DS;
$all = explode(PATH_SEPARATOR, $openBasedir); $path = dirname($cake) . DS;
$all = array_flip(array_flip(array_merge(array(CAKE_CORE_INCLUDE_PATH), $all)));
} else { $paths['cake'][] = $cake;
$all = explode(PATH_SEPARATOR, ini_get('include_path')); $paths['libs'][] = $libs;
$all = array_flip(array_flip((array_merge(array(CAKE_CORE_INCLUDE_PATH), $all)))); $paths['models'][] = $libs . 'model' . DS;
} $paths['datasources'][] = $libs . 'model' . DS . 'datasources' . DS;
foreach ($all as $path) { $paths['behaviors'][] = $libs . 'model' . DS . 'behaviors' . DS;
if ($path !== DS) { $paths['controllers'][] = $libs . 'controller' . DS;
$path = rtrim($path, DS); $paths['components'][] = $libs . 'controller' . DS . 'components' . DS;
} $paths['views'][] = $libs . 'view' . DS;
if (empty($path) || $path === '.') { $paths['helpers'][] = $libs . 'view' . DS . 'helpers' . DS;
continue; $paths['plugins'][] = $path . 'plugins' . DS;
} $paths['vendors'][] = $path . 'vendors' . DS;
$cake = $path . DS . 'cake' . DS; $paths['shells'][] = $cake . 'console' . DS . 'libs' . DS;
$libs = $cake . 'libs' . DS;
if (is_dir($libs)) {
$paths['cake'][] = $cake;
$paths['libs'][] = $libs;
$paths['models'][] = $libs . 'model' . DS;
$paths['datasources'][] = $libs . 'model' . DS . 'datasources' . DS;
$paths['behaviors'][] = $libs . 'model' . DS . 'behaviors' . DS;
$paths['controllers'][] = $libs . 'controller' . DS;
$paths['components'][] = $libs . 'controller' . DS . 'components' . DS;
$paths['views'][] = $libs . 'view' . DS;
$paths['helpers'][] = $libs . 'view' . DS . 'helpers' . DS;
$paths['plugins'][] = $path . DS . 'plugins' . DS;
$paths['vendors'][] = $path . DS . 'vendors' . DS;
$paths['shells'][] = $cake . 'console' . DS . 'libs' . DS;
break;
}
}
Cache::write('core_paths', array_filter($paths), '_cake_core_'); Cache::write('core_paths', array_filter($paths), '_cake_core_');
} }
if ($type && isset($paths[$type])) { if ($type && isset($paths[$type])) {