Skip to content

Commit

Permalink
Merge branch '1.3' into 1.3-bake-integration
Browse files Browse the repository at this point in the history
Conflicts:
	cake/console/libs/tasks/controller.php
  • Loading branch information
markstory committed Jul 7, 2009
2 parents 8d1457e + f1a4352 commit 5c9b5fe
Show file tree
Hide file tree
Showing 61 changed files with 9,583 additions and 2,281 deletions.
2 changes: 1 addition & 1 deletion cake/basics.php
Expand Up @@ -830,7 +830,7 @@ function array_diff_key() {
function array_intersect_key($arr1, $arr2) {
$res = array();
foreach ($arr1 as $key => $value) {
if (isset($arr2[$key])) {
if (array_key_exists($key, $arr2)) {
$res[$key] = $arr1[$key];
}
}
Expand Down
10 changes: 5 additions & 5 deletions cake/console/cake.php
Expand Up @@ -198,7 +198,7 @@ function _initEnvironment() {
*/
function __buildPaths() {
$paths = array();
$pluginPaths = Configure::read('pluginPaths');
$pluginPaths = App::path('plugins');
if (!class_exists('Folder')) {
require LIBS . 'folder.php';
}
Expand All @@ -214,15 +214,15 @@ function __buildPaths() {
}
}

$vendorPaths = array_values(Configure::read('vendorPaths'));
$vendorPaths = array_values(App::path('vendors'));
foreach ($vendorPaths as $vendorPath) {
$path = rtrim($vendorPath, DS) . DS . 'shells' . DS;
if (file_exists($path)) {
$paths[] = $path;
}
}

$this->shellPaths = array_values(array_unique(array_merge($paths, Configure::read('shellPaths'))));
$this->shellPaths = array_values(array_unique(array_merge($paths, App::path('shells'))));
}
/**
* Initializes the environment and loads the Cake core.
Expand Down Expand Up @@ -259,7 +259,7 @@ function __bootstrap() {
Configure::getInstance(file_exists(CONFIGS . 'bootstrap.php'));

if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
Configure::buildPaths(array());
}

Expand Down Expand Up @@ -548,7 +548,7 @@ function help() {

foreach ($this->shellPaths as $path) {
if (is_dir($path)) {
$shells = Configure::listObjects('file', $path);
$shells = App::objects('file', $path);
$path = str_replace(CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS, 'CORE' . DS, $path);
$path = str_replace(APP, 'APP' . DS, $path);
$path = str_replace(ROOT, 'ROOT', $path);
Expand Down
32 changes: 16 additions & 16 deletions cake/console/libs/api.php
Expand Up @@ -82,7 +82,7 @@ function main() {
$class = Inflector::camelize($file);
}

$objects = Configure::listObjects('class', $path);
$objects = App::objects('class', $path);
if (in_array($class, $objects)) {
if (in_array($type, array('behavior', 'component', 'helper')) && $type !== $file) {
if (!preg_match('/' . Inflector::camelize($type) . '$/', $class)) {
Expand Down Expand Up @@ -151,17 +151,17 @@ function help() {

$commands = array(
'path' => "\t<type>\n" .
"\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n".
"\t\tAvailable values:\n\n".
"\t\tbehavior\tLook for class in CakePHP behavior path\n".
"\t\tcache\tLook for class in CakePHP cache path\n".
"\t\tcontroller\tLook for class in CakePHP controller path\n".
"\t\tcomponent\tLook for class in CakePHP component path\n".
"\t\thelper\tLook for class in CakePHP helper path\n".
"\t\tmodel\tLook for class in CakePHP model path\n".
"\t\tview\tLook for class in CakePHP view path\n",
"\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n".
"\t\tAvailable values:\n\n".
"\t\tbehavior\tLook for class in CakePHP behavior path\n".
"\t\tcache\tLook for class in CakePHP cache path\n".
"\t\tcontroller\tLook for class in CakePHP controller path\n".
"\t\tcomponent\tLook for class in CakePHP component path\n".
"\t\thelper\tLook for class in CakePHP helper path\n".
"\t\tmodel\tLook for class in CakePHP model path\n".
"\t\tview\tLook for class in CakePHP view path\n",
'className' => "\t<className>\n" .
"\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n"
"\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n"
);

$this->out($head);
Expand Down Expand Up @@ -196,16 +196,16 @@ function __parseClass($path) {

$contents = $File->read();

if (preg_match_all('%(/\\*\\*[\\s\\S]*?\\*/)(\\s+function\\s+\\w+)(\\(.+\\))%', $contents, $result, PREG_PATTERN_ORDER)) {
if (preg_match_all('%(/\\*\\*[\\s\\S]*?\\*/)(\\s+function\\s+\\w+)(\\(.*\\))%', $contents, $result, PREG_PATTERN_ORDER)) {
foreach ($result[2] as $key => $method) {
$method = str_replace('function ', '', trim($method));

if (strpos($method, '__') === false && $method[0] != '_') {
$parsed[$method] = array(
'comment' => r(array('/*', '*/', '*'), '', trim($result[1][$key])),
'method' => $method,
'parameters' => trim($result[3][$key]),
);
'comment' => r(array('/*', '*/', '*'), '', trim($result[1][$key])),
'method' => $method,
'parameters' => trim($result[3][$key])
);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/console.php
Expand Up @@ -58,7 +58,7 @@ class ConsoleShell extends Shell {
function initialize() {
require_once CAKE . 'dispatcher.php';
$this->Dispatcher = new Dispatcher();
$this->models = Configure::listObjects('model');
$this->models = App::objects('model');
App::import('Model', $this->models);

foreach ($this->models as $model) {
Expand Down
13 changes: 8 additions & 5 deletions cake/console/libs/tasks/controller.php
Expand Up @@ -142,7 +142,7 @@ function __interactive() {
$this->hr();
$this->out(sprintf(__('Baking %sController', true), $controllerName));
$this->hr();

$helpers = $components = array();
$actions = '';
$wannaUseSession = 'y';
Expand All @@ -169,7 +169,7 @@ function __interactive() {
$actions = 'scaffold';
} else {
list($wannaBakeCrud, $wannaBakeAdminCrud) = $this->_askAboutMethods();

$helpers = $this->doHelpers();
$components = $this->doComponents();

Expand Down Expand Up @@ -256,7 +256,7 @@ function _askAboutMethods() {
array('y','n'), 'n'
);
$wannaBakeAdminCrud = $this->in(
__("Would you like to create the basic class methods for admin routing?", true),
__("Would you like to create the basic class methods for admin routing?", true),
array('y','n'), 'n'
);
return array($wannaBakeCrud, $wannaBakeAdminCrud);
Expand All @@ -272,7 +272,10 @@ function _askAboutMethods() {
* @access private
*/
function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$currentModelName = $this->_modelName($controllerName);
$currentModelName = $modelImport = $this->_modelName($controllerName);
if ($this->plugin) {
$modelImport = $this->plugin . '.' . $modelImport;
}
if (!App::import('Model', $currentModelName)) {
$this->err(__('You must have a model for this class to build basic methods. Please try again.', true));
$this->_stop();
Expand All @@ -285,7 +288,7 @@ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$singularHumanName = Inflector::humanize($currentModelName);
$pluralHumanName = Inflector::humanize($controllerName);

$this->Template->set(compact('admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName',
$this->Template->set(compact('admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName',
'pluralHumanName', 'modelObj', 'wannaUseSession', 'currentModelName'));
$actions = $this->Template->generate('actions', 'controller_actions');
return $actions;
Expand Down
4 changes: 2 additions & 2 deletions cake/console/libs/testsuite.php
Expand Up @@ -93,7 +93,7 @@ function initialize() {
require_once CAKE . 'tests' . DS . 'lib' . DS . 'test_manager.php';
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cli_reporter.php';

$plugins = Configure::listObjects('plugin');
$plugins = App::objects('plugin');
foreach ($plugins as $p) {
$this->plugins[] = Inflector::underscore($p);
}
Expand Down Expand Up @@ -316,7 +316,7 @@ function __findFolderByCategory($category) {
} else {
$scoredCategory = Inflector::underscore($category);
$folder = APP . 'plugins' . DS . $scoredCategory . DS;
$pluginPaths = Configure::read('pluginPaths');
$pluginPaths = App::path('plugins');
foreach ($pluginPaths as $path) {
if (file_exists($path . $scoredCategory . DS . 'tests')) {
$folder = $path . $scoredCategory . DS . 'tests';
Expand Down
4 changes: 2 additions & 2 deletions cake/dispatcher.php
Expand Up @@ -620,13 +620,13 @@ function cached($url) {
if ($pos > 0) {
$plugin = substr($url, 0, $pos - 1);
$url = str_replace($plugin . '/', '', $url);
$pluginPaths = Configure::read('pluginPaths');
$pluginPaths = App::path('plugins');
$count = count($pluginPaths);
for ($i = 0; $i < $count; $i++) {
$paths[] = $pluginPaths[$i] . $plugin . DS . 'vendors' . DS;
}
}
$paths = array_merge($paths, Configure::read('vendorPaths'));
$paths = array_merge($paths, App::path('vendors'));

foreach ($paths as $path) {
if (is_file($path . $url) && file_exists($path . $url)) {
Expand Down
1 change: 0 additions & 1 deletion cake/libs/cache/file.php
Expand Up @@ -168,7 +168,6 @@ function read($key) {

if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
$this->__File->close();
$this->__File->delete();
return false;
}
$data = $this->__File->read(true);
Expand Down

0 comments on commit 5c9b5fe

Please sign in to comment.