mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
"Correcting order when building default file paths.
Fixed Configure::listObjects() to only return files form the proper paths. Updated Schema class" git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6026 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
fcdc5ad640
commit
cd3fee384d
2 changed files with 31 additions and 12 deletions
|
@ -147,6 +147,15 @@ class Configure extends Object {
|
|||
$path = $_this->{$pathVar};
|
||||
}
|
||||
$objects = array();
|
||||
$search = array_merge(array(APP), $_this->corePaths($type));
|
||||
|
||||
foreach ($search as $delete) {
|
||||
if (in_array($delete, $path)) {
|
||||
$remove = array_flip($path);
|
||||
unset($remove[$delete]);
|
||||
$path = array_flip($remove);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ((array)$path as $dir) {
|
||||
$items = $_this->__list($dir, $types[$type]['suffix']);
|
||||
|
@ -498,27 +507,38 @@ class Configure extends Object {
|
|||
|
||||
if (!$basePaths) {
|
||||
$cache = true;
|
||||
$paths = $_this->corePaths();
|
||||
$core = $_this->corePaths();
|
||||
|
||||
$basePaths = array(
|
||||
'plugin' => APP . 'plugins' . DS,
|
||||
'behavior' => array_merge(array(BEHAVIORS), $paths['behavior']),
|
||||
'component' => array_merge(array(COMPONENTS), $paths['component']),
|
||||
'helper' => array_merge(array(HELPERS, APP), $paths['helper']),
|
||||
'controller' => array_merge(array(CONTROLLERS, APP), $paths['controller']),
|
||||
'view' => array_merge(array(VIEWS), $paths['view']),
|
||||
'model' => array_merge(array(MODELS, APP), $paths['model']));
|
||||
'behavior' => array(BEHAVIORS),
|
||||
'component' => array(COMPONENTS),
|
||||
'helper' => array(HELPERS),
|
||||
'controller' => array(CONTROLLERS),
|
||||
'view' => array(VIEWS),
|
||||
'model' => array(MODELS));
|
||||
}
|
||||
|
||||
foreach ($basePaths as $type => $default) {
|
||||
$pathsVar = $type . 'Paths';
|
||||
$merge = array();
|
||||
|
||||
if (isset($core[$type])) {
|
||||
$merge = $core[$type];
|
||||
}
|
||||
if ($type === 'model' || $type === 'controller' || $type === 'helper') {
|
||||
$merge = array_merge(array(APP), $merge);
|
||||
}
|
||||
|
||||
if (!is_array($default)) {
|
||||
$default = array($default);
|
||||
}
|
||||
$_this->{$pathsVar} = $default;
|
||||
|
||||
if (isset($paths[$pathsVar]) && !empty($paths[$pathsVar])) {
|
||||
$_this->{$pathsVar} = array_merge((array)$paths[$pathsVar], $_this->{$pathsVar});
|
||||
$_this->{$pathsVar} = array_merge($_this->{$pathsVar}, (array)$paths[$pathsVar], $merge);
|
||||
} else {
|
||||
$_this->{$pathsVar} = array_merge($_this->{$pathsVar}, $merge);
|
||||
}
|
||||
}
|
||||
if ($cache) {
|
||||
|
|
|
@ -167,7 +167,6 @@ class CakeSchema extends Object {
|
|||
$db =& ConnectionManager::getDataSource($connection);
|
||||
|
||||
$prefix = null;
|
||||
loadModel(null);
|
||||
$tables = array();
|
||||
$currentTables = $db->sources();
|
||||
if (isset($db->config['prefix'])) {
|
||||
|
@ -181,7 +180,7 @@ class CakeSchema extends Object {
|
|||
if (is_array($models)) {
|
||||
foreach ($models as $model) {
|
||||
if (!class_exists($model)) {
|
||||
loadModel($model);
|
||||
App::import('Model', $model);
|
||||
}
|
||||
if (class_exists($model)) {
|
||||
$Object =& new $model();
|
||||
|
@ -314,11 +313,11 @@ class CakeSchema extends Object {
|
|||
$out .="\n";
|
||||
}
|
||||
}
|
||||
$out .="\n}\n\n";
|
||||
$out .="}\n";
|
||||
|
||||
|
||||
$File =& new File($path . DS . $file, true);
|
||||
$content = "<?php \n/*<!--". $name ." schema generated on: " . date('Y-m-d H:m:s') . " : ". time() . "-->*/\n{$out}?>";
|
||||
$content = "<?php \n/* SVN FILE: \$Id$ */\n/*". $name ." schema generated on: " . date('Y-m-d H:m:s') . " : ". time() . "*/\n{$out}?>";
|
||||
$content = $File->prepare($content);
|
||||
if ($File->write($content)) {
|
||||
return $content;
|
||||
|
|
Loading…
Add table
Reference in a new issue