mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
"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
This commit is contained in:
parent
dfe2ead19e
commit
da19393614
2 changed files with 26 additions and 11 deletions
|
@ -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');
|
||||
?>
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue