From da19393614e86d9490de3c02df9d5ee9427b8d4c Mon Sep 17 00:00:00 2001 From: phpnut Date: Sat, 8 Mar 2008 22:50:30 +0000 Subject: [PATCH] "Fixes #4285, Importing a vendor in bootstrap.php fails to work. If you want to use custom paths that are set in app/bootstrap.php you must first use the following code to set these paths before calling App::import() but after the $*Paths variables; * Configure::buildPaths(compact('modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths')); * You would only use the *Paths in the above code that you have set." git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6525 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/bootstrap.php | 11 +++++------ cake/libs/configure.php | 26 +++++++++++++++++++++----- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/cake/bootstrap.php b/cake/bootstrap.php index b3bb119e2..b50a198c0 100644 --- a/cake/bootstrap.php +++ b/cake/bootstrap.php @@ -44,11 +44,10 @@ if (!defined('PHP5')) { require LIBS . 'cache.php'; Configure::getInstance(); - - require LIBS . 'session.php'; - require LIBS . 'security.php'; - require LIBS . 'string.php'; - $url = null; - require CAKE . 'dispatcher.php'; + + App::import('Core', 'Session'); + App::import('Core', 'Security'); + App::import('Core', 'String'); + App::import('Core', 'Dispatcher'); ?> \ No newline at end of file diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 7e69bfcea..fa0604782 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -558,7 +558,7 @@ class Configure extends Object { * @param array $paths paths defines in config/bootstrap.php * @access private */ - function __buildPaths($paths) { + function buildPaths($paths) { $_this =& Configure::getInstance(); $core = $_this->corePaths(); $basePaths = array( @@ -636,7 +636,9 @@ class Configure extends Object { $config = Cache::config('_cake_core_' , array_merge($cache, $settings)); } } - $_this->__buildPaths(compact('modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths')); + if (empty($_this->controllerPaths)) { + $_this->buildPaths(compact('modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths')); + } } /** * Caches the object map when the instance of the Configure class is destroyed @@ -1074,7 +1076,7 @@ class App extends Object { * @access private */ function __paths($type) { - if ($type === 'Core') { + if (strtolower($type) === 'core') { $path = Configure::corePaths(); foreach ($path as $key => $value) { @@ -1086,8 +1088,22 @@ class App extends Object { } return $paths; } - $paths = Configure::read(strtolower($type) . 'Paths'); - return $paths; + $paths = Configure::read(strtolower($type) . 'Paths'); + + if (empty($paths)) { + if (strtolower($type) === 'plugin') { + $paths = array(APP . 'plugins' . DS); + } elseif (strtolower($type) === 'vendor') { + $paths = array(APP . 'vendors' . DS, VENDORS, APP . 'plugins' . DS); + } elseif (strtolower($type) === 'controller') { + $paths = array(APP . 'controllers' . DS, APP); + } elseif (strtolower($type) === 'model') { + $paths = array(APP . 'models' . DS, APP); + } elseif (strtolower($type) === 'view') { + $paths = array(APP . 'views' . DS); + } + } + return $paths; } /** * Removes file location from map if file has been deleted