diff --git a/.gitignore b/.gitignore index 4938c739d..c7d8011c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /app/Config /app/tmp +/lib/Cake/Console/Templates/skel/tmp/ /plugins /vendors .DS_Store diff --git a/app/Config/Schema/db_acl.php b/app/Config/Schema/db_acl.php index 65bb5b6ff..7133acb19 100644 --- a/app/Config/Schema/db_acl.php +++ b/app/Config/Schema/db_acl.php @@ -1,5 +1,6 @@ array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'), 'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10), diff --git a/app/Config/Schema/i18n.php b/app/Config/Schema/i18n.php index d6480a1c0..377645796 100644 --- a/app/Config/Schema/i18n.php +++ b/app/Config/Schema/i18n.php @@ -1,5 +1,6 @@ array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'), 'locale' => array('type'=>'string', 'null' => false, 'length' => 6, 'key' => 'index'), diff --git a/app/Config/Schema/sessions.php b/app/Config/Schema/sessions.php index 247535a22..4e2ba5f55 100644 --- a/app/Config/Schema/sessions.php +++ b/app/Config/Schema/sessions.php @@ -1,5 +1,6 @@ array('type'=>'string', 'null' => false, 'key' => 'primary'), 'data' => array('type'=>'text', 'null' => true, 'default' => NULL), diff --git a/app/Config/acl.ini.php b/app/Config/acl.ini.php index 5150edd82..1241aeff3 100644 --- a/app/Config/acl.ini.php +++ b/app/Config/acl.ini.php @@ -1,12 +1,11 @@ ; -; SVN FILE: $Id$ ;/** ; * ACL Configuration ; * ; * ; * PHP 5 ; * -; * CakePHP(tm) : Rapid Development Framework http://cakephp.org +; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) ; * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) ; * ; * Licensed under The MIT License @@ -14,7 +13,7 @@ ; * ; * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) ; * @link http://cakephp.org CakePHP(tm) Project -; * @package app.config +; * @package app.Config ; * @since CakePHP(tm) v 0.10.0.1076 ; * @license MIT License (http://www.opensource.org/licenses/mit-license.php) ; */ diff --git a/app/Config/bootstrap.php b/app/Config/bootstrap.php index 20688cf68..fce18ccba 100644 --- a/app/Config/bootstrap.php +++ b/app/Config/bootstrap.php @@ -18,7 +18,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package app.config + * @package app.Config * @since CakePHP(tm) v 0.10.8.2117 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ @@ -30,16 +30,16 @@ Cache::config('default', array('engine' => 'File')); * The settings below can be used to set additional paths to models, views and controllers. * * App::build(array( - * 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), - * 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'), - * 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'), - * 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), - * 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), - * 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), - * 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'), - * 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), - * 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), - * 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), + * 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), + * 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'), + * 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'), + * 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), + * 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), + * 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), + * 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'), + * 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), + * 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), + * 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), * 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/') * )); * @@ -62,4 +62,4 @@ Cache::config('default', array('engine' => 'File')); * CakePlugin::loadAll(); // Loads all plugins at once * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit * - */ \ No newline at end of file + */ diff --git a/app/Config/core.php b/app/Config/core.php index 812f642ad..2b03097dc 100644 --- a/app/Config/core.php +++ b/app/Config/core.php @@ -14,7 +14,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package app.config + * @package app.Config * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/app/Config/database.php.default b/app/Config/database.php.default index 6dcff0c48..3ce441be3 100644 --- a/app/Config/database.php.default +++ b/app/Config/database.php.default @@ -14,7 +14,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package app.config + * @package app.Config * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ @@ -54,6 +54,8 @@ * For MySQL, Postgres specifies the character encoding to use when connecting to the * database. Uses database default not specified. * + * unix_socket => + * For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port` */ class DATABASE_CONFIG { diff --git a/app/Config/email.php.default b/app/Config/email.php.default index f55496ae4..0d5d11a5b 100644 --- a/app/Config/email.php.default +++ b/app/Config/email.php.default @@ -14,7 +14,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package app.config + * @package app.Config * @since CakePHP(tm) v 2.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ @@ -30,6 +30,7 @@ * transport => The name of a supported transport; valid options are as follows: * Mail - Send using PHP mail function * Smtp - Send using SMTP + * Debug - Do not send the email, just return the result * * You can add custom transports (or override existing transports) by adding the * appropriate file to app/Network/Email. Transports should be named 'YourTransport.php', @@ -43,18 +44,23 @@ class EmailConfig { public $default = array( 'transport' => 'Mail', - 'from' => 'you@localhost' + 'from' => 'you@localhost', + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', ); public $smtp = array( 'transport' => 'Smtp', - 'from' => array('My Site', 'site@localhost'), + 'from' => array('site@localhost' => 'My Site'), 'host' => 'localhost', 'port' => 25, 'timeout' => 30, 'username' => 'user', 'password' => 'secret', - 'client' => null + 'client' => null, + 'log' => false + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', ); public $fast = array( @@ -82,7 +88,10 @@ class EmailConfig { 'timeout' => 30, 'username' => 'user', 'password' => 'secret', - 'client' => null + 'client' => null, + 'log' => true, + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', ); } diff --git a/app/Config/routes.php b/app/Config/routes.php index 0a7a011b8..d984d96ef 100644 --- a/app/Config/routes.php +++ b/app/Config/routes.php @@ -16,7 +16,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package app.config + * @package app.Config * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/app/Console/cake b/app/Console/cake index 5e1075b93..9ef7530a9 100755 --- a/app/Console/cake +++ b/app/Console/cake @@ -11,15 +11,23 @@ # Redistributions of files must retain the above copyright notice. # # @copyright Copyright 2005-2011, Cake Software Foundation, Inc. -# @link http://cakephp.org CakePHP(tm) Project -# @package app.console -# @since CakePHP(tm) v 2.0 -# @license MIT License (http://www.opensource.org/licenses/mit-license.php) +# @link http://cakephp.org CakePHP(tm) Project +# @package app.Console +# @since CakePHP(tm) v 2.0 +# @license MIT License (http://www.opensource.org/licenses/mit-license.php) # ################################################################################ -LIB=${0/%cake/} +LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0") + +while [ -h "$LIB" ]; do + DIR=$(dirname -- "$LIB") + SYM=$(readlink "$LIB") + LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") +done + +LIB=$(dirname -- "$LIB")/ APP=`pwd` -exec php -q ${LIB}cake.php -working "${APP}" "$@" +exec php -q "$LIB"cake.php -working "$APP" "$@" -exit; \ No newline at end of file +exit; diff --git a/app/Console/cake.bat b/app/Console/cake.bat index 9ff7e50a7..53e95a3c0 100644 --- a/app/Console/cake.bat +++ b/app/Console/cake.bat @@ -1,32 +1,32 @@ -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: -:: Bake is a shell script for running CakePHP bake script -:: PHP 5 -:: -:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org) -:: Copyright 2005-2011, Cake Software Foundation, Inc. -:: -:: Licensed under The MIT License -:: Redistributions of files must retain the above copyright notice. -:: -:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc. -:: @link http://cakephp.org CakePHP(tm) Project -:: @package app.console -:: @since CakePHP(tm) v 2.0 -:: @license MIT License (http://www.opensource.org/licenses/mit-license.php) -:: -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: In order for this script to work as intended, the cake\console\ folder must be in your PATH - -@echo. -@echo off - -SET app=%0 -SET lib=%~dp0 - -php -q "%lib%cake.php" -working "%CD% " %* - -echo. - -exit /B %ERRORLEVEL% \ No newline at end of file +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: +:: Bake is a shell script for running CakePHP bake script +:: PHP 5 +:: +:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org) +:: Copyright 2005-2011, Cake Software Foundation, Inc. +:: +:: Licensed under The MIT License +:: Redistributions of files must retain the above copyright notice. +:: +:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc. +:: @link http://cakephp.org CakePHP(tm) Project +:: @package app.Console +:: @since CakePHP(tm) v 2.0 +:: @license MIT License (http://www.opensource.org/licenses/mit-license.php) +:: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: In order for this script to work as intended, the cake\console\ folder must be in your PATH + +@echo. +@echo off + +SET app=%0 +SET lib=%~dp0 + +php -q "%lib%cake.php" -working "%CD% " %* + +echo. + +exit /B %ERRORLEVEL% diff --git a/app/webroot/.htaccess b/app/webroot/.htaccess index 8e7f16397..f2646d170 100644 --- a/app/webroot/.htaccess +++ b/app/webroot/.htaccess @@ -2,5 +2,5 @@ RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^(.*)$ index.php/$1 [QSA,L] - \ No newline at end of file + RewriteRule ^(.*)$ index.php?/$1 [QSA,L] + diff --git a/app/webroot/css/cake.generic.css b/app/webroot/css/cake.generic.css index d7342db30..dfc30cab6 100644 --- a/app/webroot/css/cake.generic.css +++ b/app/webroot/css/cake.generic.css @@ -354,6 +354,7 @@ input[type=submit] { } form .submit input[type=submit] { background:#62af56; + background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230)); background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230); background-image: -moz-linear-gradient(top, #76BF6B, #3B8230); border-color: #2d6324; @@ -414,6 +415,7 @@ p.error, background-repeat: repeat-x; background-image: -moz-linear-gradient(top, #ffcc00, #E6B800); background-image: -ms-linear-gradient(top, #ffcc00, #E6B800); + background-image: -webkit-gradient(linear, left top, left bottom, from(#ffcc00), to(#E6B800)); background-image: -webkit-linear-gradient(top, #ffcc00, #E6B800); background-image: -o-linear-gradient(top, #ffcc00, #E6B800); background-image: linear-gradient(top, #ffcc00, #E6B800); @@ -442,6 +444,7 @@ p.error, background-repeat: repeat-x; background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35); + background-image: -webkit-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35)); background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); background-image: linear-gradient(top, #ee5f5b, #c43c35); @@ -453,6 +456,7 @@ p.error, border: 1px solid rgba(0, 0, 0, 0.5); background: #3B8230; background-repeat: repeat-x; + background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230)); background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230); background-image: -moz-linear-gradient(top, #76BF6B, #3B8230); background-image: -ms-linear-gradient(top, #76BF6B, #3B8230); @@ -505,6 +509,7 @@ input[type=submit], font-weight:normal; padding: 4px 8px; background: #dcdcdc; + background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#dcdcdc)); background-image: -webkit-linear-gradient(top, #fefefe, #dcdcdc); background-image: -moz-linear-gradient(top, #fefefe, #dcdcdc); background-image: -ms-linear-gradient(top, #fefefe, #dcdcdc); @@ -534,6 +539,7 @@ input[type=submit]:active, .actions ul li a:active, .actions a:active { background: #eee; + background-image: -webkit-gradient(linear, left top, left bottom, from(#dfdfdf), to(#eee)); background-image: -webkit-linear-gradient(top, #dfdfdf, #eee); background-image: -moz-linear-gradient(top, #dfdfdf, #eee); background-image: -ms-linear-gradient(top, #dfdfdf, #eee); diff --git a/app/webroot/test.php b/app/webroot/test.php index b6caa107f..e141912c3 100644 --- a/app/webroot/test.php +++ b/app/webroot/test.php @@ -84,7 +84,7 @@ if (!empty($failed)) { } if (Configure::read('debug') < 1) { - die(__d('cake', 'Debug setting does not allow access to this url.')); + die(__d('cake_dev', 'Debug setting does not allow access to this url.')); } require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php'; diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index f81889dcb..eb25b02c9 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -66,8 +66,8 @@ class FileEngine extends CacheEngine { public function init($settings = array()) { parent::init(array_merge( array( - 'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> false, - 'serialize'=> true, 'isWindows' => false + 'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> true, + 'serialize'=> true, 'isWindows' => false, 'mask' => 0664 ), $settings )); @@ -124,21 +124,16 @@ class FileEngine extends CacheEngine { $expires = time() + $duration; $contents = $expires . $lineBreak . $data . $lineBreak; - if (!$handle = fopen($this->_File->getPathName(), 'c')) { - return false; + if ($this->settings['lock']) { + $this->_File->flock(LOCK_EX); } + $success = $this->_File->ftruncate(0) && $this->_File->fwrite($contents) && $this->_File->fflush(); + if ($this->settings['lock']) { - flock($handle, LOCK_EX); + $this->_File->flock(LOCK_UN); } - $success = ftruncate($handle, 0) && fwrite($handle, $contents) && fflush($handle); - - if ($this->settings['lock']) { - flock($handle, LOCK_UN); - } - - fclose($handle); return $success; } @@ -162,6 +157,9 @@ class FileEngine extends CacheEngine { $cachetime = intval($this->_File->current()); if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { + if ($this->settings['lock']) { + $this->_File->flock(LOCK_UN); + } return false; } @@ -273,7 +271,8 @@ class FileEngine extends CacheEngine { } /** - * Sets the current cache key this class is managing + * Sets the current cache key this class is managing, and creates a writable SplFileObject + * for the cache file the key is refering to. * * @param string $key The key * @param boolean $createKey Whether the key should be created if it doesn't exists, or not @@ -285,12 +284,22 @@ class FileEngine extends CacheEngine { if (!$createKey && !$path->isFile()) { return false; } - $old = umask(0); if (empty($this->_File) || $this->_File->getBaseName() !== $key) { - $this->_File = $path->openFile('a+'); - } - umask($old); + $exists = file_exists($path->getPathname()); + try { + $this->_File = $path->openFile('c+'); + } catch (Exception $e) { + trigger_error($e->getMessage(), E_USER_WARNING); + return false; + } + unset($path); + if (!$exists && !chmod($this->_File->getPathname(), (int) $this->settings['mask'])) { + trigger_error(__d( + 'cake_dev', 'Could not apply permission mask "%s" on cache file "%s"', + array($this->_File->getPathname(), $this->settings['mask'])), E_USER_WARNING); + } + } return true; } diff --git a/lib/Cake/Cache/Engine/MemcacheEngine.php b/lib/Cake/Cache/Engine/MemcacheEngine.php index af0bbb2a6..7013a5f4b 100644 --- a/lib/Cake/Cache/Engine/MemcacheEngine.php +++ b/lib/Cake/Cache/Engine/MemcacheEngine.php @@ -89,12 +89,15 @@ class MemcacheEngine extends CacheEngine { /** * Parses the server address into the host/port. Handles both IPv6 and IPv4 - * addresses + * addresses and Unix sockets * * @param string $server The server address string. * @return array Array containing host, port */ protected function _parseServerString($server) { + if ($server[0] == 'u') { + return array($server, 0); + } if (substr($server, 0, 1) == '[') { $position = strpos($server, ']:'); if ($position !== false) { diff --git a/lib/Cake/Config/config.php b/lib/Cake/Config/config.php index adcc00e16..362222f5c 100644 --- a/lib/Cake/Config/config.php +++ b/lib/Cake/Config/config.php @@ -16,4 +16,4 @@ * @since CakePHP(tm) v 1.1.11.4062 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -return $config['Cake.version'] = '2.0.0-RC1'; +return $config['Cake.version'] = '2.0.0'; diff --git a/lib/Cake/Configure/PhpReader.php b/lib/Cake/Configure/PhpReader.php index a19c0771e..b6682d910 100644 --- a/lib/Cake/Configure/PhpReader.php +++ b/lib/Cake/Configure/PhpReader.php @@ -11,7 +11,7 @@ * Redistributions of files must retain the above copyright notice * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests + * @link http://book.cakephp.org/2.0/en/development/configuration.html#loading-configuration-files CakePHP(tm) Configuration * @package Cake.Configure * @since CakePHP(tm) v 2.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) @@ -72,10 +72,10 @@ class PhpReader implements ConfigReaderInterface { } else { $file = $this->_path . $key; } - if (!file_exists($file)) { - $file .= '.php'; - if (!file_exists($file)) { - throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', substr($file, 0, -4), $file)); + $file .= '.php'; + if (!is_file($file)) { + if (!is_file(substr($file, 0, -4))) { + throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', $file, substr($file, 0, -4))); } } include $file; diff --git a/lib/Cake/Console/Command/AclShell.php b/lib/Cake/Console/Command/AclShell.php index a07b4e118..42fa202f1 100644 --- a/lib/Cake/Console/Command/AclShell.php +++ b/lib/Cake/Console/Command/AclShell.php @@ -427,7 +427,7 @@ class AclShell extends Shell { 'help' => __d('cake_console', 'Check the permissions between an ACO and ARO.'), 'parser' => array( 'description' => array( - __d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).') + __d('cake_console', 'Use this command to check ACL permissions.') ), 'arguments' => array( 'aro' => array('help' => __d('cake_console', 'ARO to check.'), 'required' => true), diff --git a/lib/Cake/Console/Command/BakeShell.php b/lib/Cake/Console/Command/BakeShell.php index 5d039de83..82e67b3e5 100644 --- a/lib/Cake/Console/Command/BakeShell.php +++ b/lib/Cake/Console/Command/BakeShell.php @@ -26,7 +26,7 @@ App::uses('Model', 'Model'); * Bake is a command-line code generation utility for automating programmer chores. * * @package Cake.Console.Command - * @link http://book.cakephp.org/view/1522/Code-Generation-with-Bake + * @link http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html */ class BakeShell extends Shell { @@ -51,6 +51,9 @@ class BakeShell extends Shell { */ public function startup() { parent::startup(); + Configure::write('debug', 2); + Configure::write('Cache.disable', 1); + $task = Inflector::classify($this->command); if (isset($this->{$task}) && !in_array($task, array('Project', 'DbConfig'))) { if (isset($this->params['connection'])) { @@ -65,8 +68,6 @@ class BakeShell extends Shell { * @return mixed */ public function main() { - Configure::write('Cache.disable', 1); - if (!is_dir($this->DbConfig->path)) { $path = $this->Project->execute(); if (!empty($path)) { diff --git a/lib/Cake/Console/Command/CommandListShell.php b/lib/Cake/Console/Command/CommandListShell.php index 84bd71616..ff73c96b2 100644 --- a/lib/Cake/Console/Command/CommandListShell.php +++ b/lib/Cake/Console/Command/CommandListShell.php @@ -1,6 +1,6 @@ after(array($event => $table, 'errors' => $error)); if (!empty($error)) { - $this->out($error); + $this->err($error); } else { $this->out(__d('cake_console', '%s updated.', $table)); } diff --git a/lib/Cake/Console/Command/Task/BakeTask.php b/lib/Cake/Console/Command/Task/BakeTask.php index 4f75272ec..ea3a8973e 100644 --- a/lib/Cake/Console/Command/Task/BakeTask.php +++ b/lib/Cake/Console/Command/Task/BakeTask.php @@ -15,6 +15,8 @@ * @since CakePHP(tm) v 1.3 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ + +App::uses('Shell', 'Console'); /** * Base class for Bake Tasks. * @@ -44,12 +46,13 @@ class BakeTask extends Shell { public $interactive = false; /** - * Disable caching for baking. + * Disable caching and enable debug for baking. * This forces the most current database schema to be used. * * @return void */ function startup() { + Configure::write('debug', 2); Configure::write('Cache.disable', 1); parent::startup(); } diff --git a/lib/Cake/Console/Command/Task/ControllerTask.php b/lib/Cake/Console/Command/Task/ControllerTask.php index 859b73a11..1946b0890 100644 --- a/lib/Cake/Console/Command/Task/ControllerTask.php +++ b/lib/Cake/Console/Command/Task/ControllerTask.php @@ -302,7 +302,7 @@ class ControllerTask extends BakeTask { /** * Assembles and writes a Controller file * - * @param string $controllerName Controller name + * @param string $controllerName Controller name already pluralized and correctly cased. * @param string $actions Actions to add, or set the whole controller to use $scaffold (set $actions to 'scaffold') * @param array $helpers Helpers to use in controller * @param array $components Components to use in controller @@ -321,7 +321,7 @@ class ControllerTask extends BakeTask { $contents = $this->Template->generate('classes', 'controller'); $path = $this->getPath(); - $filename = $path . $this->_controllerName($controllerName) . 'Controller.php'; + $filename = $path . $controllerName . 'Controller.php'; if ($this->createFile($filename, $contents)) { return $contents; } diff --git a/lib/Cake/Console/Command/Task/DbConfigTask.php b/lib/Cake/Console/Command/Task/DbConfigTask.php index 02041ea3d..4a274beaa 100644 --- a/lib/Cake/Console/Command/Task/DbConfigTask.php +++ b/lib/Cake/Console/Command/Task/DbConfigTask.php @@ -353,16 +353,16 @@ class DbConfigTask extends Shell { */ public function getConfig() { App::uses('ConnectionManager', 'Model'); + $configs = ConnectionManager::enumConnectionObjects(); - $useDbConfig = 'default'; - $configs = get_class_vars($this->databaseClassName); - if (!is_array($configs)) { + $useDbConfig = key($configs); + if (!is_array($configs) || empty($configs)) { return $this->execute(); } - $connections = array_keys($configs); + if (count($connections) > 1) { - $useDbConfig = $this->in(__d('cake_console', 'Use Database Config') .':', $connections, 'default'); + $useDbConfig = $this->in(__d('cake_console', 'Use Database Config') .':', $connections, $useDbConfig); } return $useDbConfig; } diff --git a/lib/Cake/Console/Command/Task/ModelTask.php b/lib/Cake/Console/Command/Task/ModelTask.php index 42325d03f..01f1d7c41 100644 --- a/lib/Cake/Console/Command/Task/ModelTask.php +++ b/lib/Cake/Console/Command/Task/ModelTask.php @@ -405,6 +405,8 @@ class ModelTask extends BakeTask { $guess = $methods['date']; } elseif ($metaData['type'] == 'time') { $guess = $methods['time']; + } elseif ($metaData['type'] == 'inet') { + $guess = $methods['ip']; } } diff --git a/lib/Cake/Console/Command/Task/PluginTask.php b/lib/Cake/Console/Command/Task/PluginTask.php index 7a1209a06..af231e234 100644 --- a/lib/Cake/Console/Command/Task/PluginTask.php +++ b/lib/Cake/Console/Command/Task/PluginTask.php @@ -134,7 +134,6 @@ class PluginTask extends Shell { $out = ""; $this->createFile($this->path . $plugin. DS . 'Controller' . DS . $controllerFileName, $out); $modelFileName = $plugin . 'AppModel.php'; @@ -142,7 +141,6 @@ class PluginTask extends Shell { $out = ""; $this->createFile($this->path . $plugin . DS . 'Model' . DS . $modelFileName, $out); $this->hr(); diff --git a/lib/Cake/Console/Command/Task/TestTask.php b/lib/Cake/Console/Command/Task/TestTask.php index a138fde45..e4d9de1de 100644 --- a/lib/Cake/Console/Command/Task/TestTask.php +++ b/lib/Cake/Console/Command/Task/TestTask.php @@ -116,18 +116,22 @@ class TestTask extends BakeTask { * @return string|boolean */ public function bake($type, $className) { - if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) { + $plugin = null; + if ($this->plugin) { + $plugin = $this->plugin . '.'; + } + + $realType = $this->mapType($type, $plugin); + $fullClassName = $this->getRealClassName($type, $className); + + if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($realType, $fullClassName)) { $this->out(__d('cake_console', 'Bake is detecting possible fixtures...')); $testSubject = $this->buildTestSubject($type, $className); $this->generateFixtureList($testSubject); } elseif ($this->interactive) { $this->getUserFixtures(); } - $fullClassName = $className; - - if (!$this->interactive) { - $fullClassName = $this->getRealClassName($type, $className); - } + App::uses($fullClassName, $realType); $methods = array(); if (class_exists($fullClassName)) { @@ -136,15 +140,14 @@ class TestTask extends BakeTask { $mock = $this->hasMockClass($type, $fullClassName); $construction = $this->generateConstructor($type, $fullClassName); - $plugin = null; - if ($this->plugin) { - $plugin = $this->plugin . '.'; - } $this->out("\n" . __d('cake_console', 'Baking test case for %s %s ...', $className, $type), 1, Shell::QUIET); $this->Template->set('fixtures', $this->_fixtures); $this->Template->set('plugin', $plugin); - $this->Template->set(compact('className', 'methods', 'type', 'fullClassName', 'mock', 'construction')); + $this->Template->set(compact( + 'className', 'methods', 'type', 'fullClassName', 'mock', + 'construction', 'realType' + )); $out = $this->Template->generate('classes', 'test'); $filename = $this->testCaseFileName($type, $className); @@ -187,15 +190,10 @@ class TestTask extends BakeTask { * @return string Class name the user chose. */ public function getClassName($objectType) { - $type = strtolower($objectType); + $type = ucfirst(strtolower($objectType)); + $typeLength = strlen($type); + $type = $this->classTypes[$type]; if ($this->plugin) { - if ($type === 'helper') { - $type = 'View/Helper'; - } elseif ($type === 'component') { - $type = 'Controller/Component'; - } elseif ($type === 'behavior') { - $type = 'Model/Behavior'; - } $plugin = $this->plugin . '.'; $options = App::objects($plugin . $type); } else { @@ -209,7 +207,10 @@ class TestTask extends BakeTask { } $selection = $this->in(__d('cake_console', 'Choose an existing class, or enter the name of a class that does not exist')); if (isset($options[$selection - 1])) { - return $options[$selection - 1]; + $selection = $options[$selection - 1]; + } + if ($type !== 'Model') { + $selection = substr($selection, 0, $typeLength * - 1); } return $selection; } @@ -223,18 +224,19 @@ class TestTask extends BakeTask { */ public function typeCanDetectFixtures($type) { $type = strtolower($type); - return ($type == 'controller' || $type == 'model'); + return in_array($type, array('controller', 'model')); } /** - * Check if a class with the given type is loaded or can be loaded. + * Check if a class with the given package is loaded or can be loaded. * - * @param string $type The Type of object you are generating tests for eg. controller + * @param string $package The package of object you are generating tests for eg. controller * @param string $class the Classname of the class the test is being generated for. * @return boolean */ - public function isLoadableClass($type, $class) { - return App::import($type, $class); + public function isLoadableClass($package, $class) { + App::uses($class, $package); + return class_exists($class); } /** @@ -258,7 +260,8 @@ class TestTask extends BakeTask { } /** - * Gets the real class name from the cake short form. + * Gets the real class name from the cake short form. If the class name is already + * suffixed with the type, the type will not be duplicated. * * @param string $type The Type of object you are generating tests for eg. controller * @param string $class the Classname of the class the test is being generated for. @@ -268,9 +271,31 @@ class TestTask extends BakeTask { if (strtolower($type) == 'model' || empty($this->classTypes[$type])) { return $class; } + if (strlen($class) - strpos($class, $type) == strlen($type)) { + return $class; + } return $class . $type; } +/** + * Map the types that TestTask uses to concrete types that App::uses can use. + * + * @param string $type The type of thing having a test generated. + * @param string $plugin The plugin name. + * @return string + */ + public function mapType($type, $plugin) { + $type = ucfirst($type); + if (empty($this->classTypes[$type])) { + throw new CakeException(__d('cake_dev', 'Invalid object type.')); + } + $real = $this->classTypes[$type]; + if ($plugin) { + $real = trim($plugin, '.') . '.' . $real; + } + return $real; + } + /** * Get methods declared in the class given. * No parent methods will be returned @@ -429,9 +454,7 @@ class TestTask extends BakeTask { if (isset($this->classTypes[$type])) { $path .= $this->classTypes[$type] . DS; } - if (!$this->interactive) { - $className = $this->getRealClassName($type, $className); - } + $className = $this->getRealClassName($type, $className); return str_replace('/', DS, $path) . Inflector::camelize($className) . 'Test.php'; } diff --git a/lib/Cake/Console/Command/Task/ViewTask.php b/lib/Cake/Console/Command/Task/ViewTask.php index 6494b90aa..efc574aa4 100644 --- a/lib/Cake/Console/Command/Task/ViewTask.php +++ b/lib/Cake/Console/Command/Task/ViewTask.php @@ -327,7 +327,7 @@ class ViewTask extends BakeTask { $this->hr(); $this->out(__d('cake_console', 'Controller Name: %s', $this->controllerName)); $this->out(__d('cake_console', 'Action Name: %s', $action)); - $this->out(__d('cake_console', 'Path: %s', $this->params['app'] . DS . $this->controllerName . DS . Inflector::underscore($action) . ".ctp")); + $this->out(__d('cake_console', 'Path: %s', $this->params['app'] . DS . 'View' . DS . $this->controllerName . DS . Inflector::underscore($action) . ".ctp")); $this->hr(); $looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y','n'), 'y'); if (strtolower($looksGood) == 'y') { @@ -449,10 +449,11 @@ class ViewTask extends BakeTask { foreach ($keys as $key => $type) { foreach ($model->{$type} as $assocKey => $assocData) { + list($plugin, $modelClass) = pluginSplit($assocData['className']); $associations[$type][$assocKey]['primaryKey'] = $model->{$assocKey}->primaryKey; $associations[$type][$assocKey]['displayField'] = $model->{$assocKey}->displayField; $associations[$type][$assocKey]['foreignKey'] = $assocData['foreignKey']; - $associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($assocData['className'])); + $associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($modelClass)); $associations[$type][$assocKey]['fields'] = array_keys($model->{$assocKey}->schema(true)); } } diff --git a/lib/Cake/Console/Command/UpgradeShell.php b/lib/Cake/Console/Command/UpgradeShell.php index 84888de57..0573b8448 100644 --- a/lib/Cake/Console/Command/UpgradeShell.php +++ b/lib/Cake/Console/Command/UpgradeShell.php @@ -92,6 +92,29 @@ class UpgradeShell extends Shell { } } +/** + * Update tests. + * + * - Update tests class names to FooTest rather than FooTestCase. + * + * @return void + */ + public function tests() { + $this->_paths = array(APP . 'tests' . DS); + if (!empty($this->params['plugin'])) { + $this->_paths = App::pluginPath($this->params['plugin']) . 'tests' . DS; + } + $patterns = array( + array( + '*TestCase extends CakeTestCase to *Test extends CakeTestCase', + '/([a-zA-Z]*Test)Case extends CakeTestCase/', + '\1 extends CakeTestCase' + ), + ); + + $this->_filesRegexpUpdate($patterns); + } + /** * Move files and folders to their new homes * @@ -109,7 +132,6 @@ class UpgradeShell extends Shell { } if (is_dir('plugins')) { - $Folder = new Folder('plugins'); list($plugins) = $Folder->read(); foreach($plugins as $plugin) { @@ -120,8 +142,13 @@ class UpgradeShell extends Shell { chdir($cwd); } + $this->_moveViewFiles(); + $moves = array( 'libs' => 'Lib', + 'tests' => 'Test', + 'Test' . DS . 'cases' => 'Test' . DS . 'Case', + 'Test' . DS . 'fixtures' => 'Test' . DS . 'Fixture', 'vendors' . DS . 'shells' . DS . 'templates' => 'Console' . DS . 'Templates', ); foreach($moves as $old => $new) { @@ -145,6 +172,7 @@ class UpgradeShell extends Shell { 'Lib' => array('checkFolder' => false), 'Model', 'models', + 'Test' => array('regex' => '@class (\S*Test) extends CakeTestCase@'), 'tests', 'View', 'views', @@ -154,6 +182,7 @@ class UpgradeShell extends Shell { $defaultOptions = array( 'recursive' => true, 'checkFolder' => true, + 'regex' => '@class (\S*) .*{@i' ); foreach($sourceDirs as $dir => $options) { if (is_numeric($dir)) { @@ -240,7 +269,7 @@ class UpgradeShell extends Shell { * * - a(*) -> array(*) * - e(*) -> echo * - * - ife(*, *, *) -> empty(*) ? * : * + * - ife(*, *, *) -> !empty(*) ? * : * * - a(*) -> array(*) * - r(*, *, *) -> str_replace(*, *, *) * - up(*) -> strtoupper(*) @@ -268,9 +297,9 @@ class UpgradeShell extends Shell { 'echo \1' ), array( - 'ife(*, *, *) -> empty(*) ? * : *', + 'ife(*, *, *) -> !empty(*) ? * : *', '/ife\((.*), (.*), (.*)\)/', - 'empty(\1) ? \2 : \3' + '!empty(\1) ? \2 : \3' ), array( 'r(*, *, *) -> str_replace(*, *, *)', @@ -478,6 +507,39 @@ class UpgradeShell extends Shell { $this->_filesRegexpUpdate($patterns); } +/** + * Move application views files to where they now should be + * + * Find all view files in the folder and determine where cake expects the file to be + * + * @return void + */ + protected function _moveViewFiles() { + if (!is_dir('views')) { + return; + } + + $dirs = scandir('views'); + foreach ($dirs as $old) { + if (!is_dir('views' . DS . $old) || $old === '.' || $old === '..') { + continue; + } + + $new = 'View' . DS . Inflector::camelize($old); + $old = 'views' . DS . $old; + + $this->out(__d('cake_console', 'Moving %s to %s', $old, $new)); + if (!$this->params['dry-run']) { + if ($this->params['git']) { + exec('git mv -f ' . escapeshellarg($old) . ' ' . escapeshellarg($new)); + } else { + $Folder = new Folder($old); + $Folder->move($new); + } + } + } + } + /** * Move application php files to where they now should be * @@ -513,7 +575,7 @@ class UpgradeShell extends Shell { $file = $cwd . DS . $file; $contents = file_get_contents($file); - preg_match('@class (\S*) .*{@', $contents, $match); + preg_match($options['regex'], $contents, $match); if (!$match) { continue; } @@ -665,6 +727,10 @@ class UpgradeShell extends Shell { 'help' => __d('cake_console', 'Run all upgrade commands.'), 'parser' => $subcommandParser )) + ->addSubcommand('tests', array( + 'help' => __d('cake_console', 'Update tests class names to FooTest rather than FooTestCase.'), + 'parser' => $subcommandParser + )) ->addSubcommand('locations', array( 'help' => __d('cake_console', 'Move files and folders to their new homes.'), 'parser' => $subcommandParser diff --git a/lib/Cake/Console/ConsoleErrorHandler.php b/lib/Cake/Console/ConsoleErrorHandler.php index 43f3ec1b4..8580d9250 100644 --- a/lib/Cake/Console/ConsoleErrorHandler.php +++ b/lib/Cake/Console/ConsoleErrorHandler.php @@ -25,7 +25,7 @@ App::uses('CakeLog', 'Log'); * * @package Cake.Console */ -class ConsoleErrorHandler extends ErrorHandler { +class ConsoleErrorHandler { /** * Standard error stream. @@ -52,12 +52,13 @@ class ConsoleErrorHandler extends ErrorHandler { * @param Exception $exception The exception to handle * @return void */ - public static function handleException(Exception $exception) { + public function handleException(Exception $exception) { $stderr = self::getStderr(); $stderr->write(__d('cake_console', "Error: %s\n%s", $exception->getMessage(), $exception->getTraceAsString() )); + $this->_stop($exception->getCode() ? $exception->getCode() : 1); } /** @@ -71,12 +72,12 @@ class ConsoleErrorHandler extends ErrorHandler { * @param array $context The backtrace of the error. * @return void */ - public static function handleError($code, $description, $file = null, $line = null, $context = null) { + public function handleError($code, $description, $file = null, $line = null, $context = null) { if (error_reporting() === 0) { return; } $stderr = self::getStderr(); - list($name, $log) = self::_mapErrorCode($code); + list($name, $log) = ErrorHandler::mapErrorCode($code); $message = __d('cake_console', '%s in [%s, line %s]', $description, $file, $line); $stderr->write(__d('cake_console', "%s Error: %s\n", $name, $message)); @@ -85,4 +86,13 @@ class ConsoleErrorHandler extends ErrorHandler { } } +/** + * Wrapper for exit(), used for testing. + * + * @param $code int The exit code. + */ + protected function _stop($code = 0) { + exit($code); + } + } diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php index 646c937a2..b26628951 100644 --- a/lib/Cake/Console/Shell.php +++ b/lib/Cake/Console/Shell.php @@ -351,7 +351,8 @@ class Shell extends Object { $this->OptionParser = $this->getOptionParser(); list($this->params, $this->args) = $this->OptionParser->parse($argv, $command); } catch (ConsoleException $e) { - return $this->out($this->OptionParser->help($command)); + $this->out($this->OptionParser->help($command)); + return false; } $this->command = $command; @@ -373,7 +374,8 @@ class Shell extends Object { if ($isMain) { return $this->main(); } - return $this->out($this->OptionParser->help($command)); + $this->out($this->OptionParser->help($command)); + return false; } /** @@ -446,13 +448,11 @@ class Shell extends Object { } } if (is_array($options)) { - while ($in == '' || ($in && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) { + while ($in === '' || ($in !== '' && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) { $in = $this->_getInput($prompt, $options, $default); } } - if ($in) { - return $in; - } + return $in; } /** @@ -482,7 +482,7 @@ class Shell extends Object { } $result = trim($result); - if ($default != null && empty($result)) { + if ($default !== null && ($result === '' || $result === null)) { return $default; } return $result; diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index 6d72e07db..9b32568a3 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -135,8 +135,9 @@ class ShellDispatcher { App::build(); } require_once CAKE . 'Console' . DS . 'ConsoleErrorHandler.php'; - set_exception_handler(array('ConsoleErrorHandler', 'handleException')); - set_error_handler(array('ConsoleErrorHandler', 'handleError'), Configure::read('Error.level')); + $ErrorHandler = new ConsoleErrorHandler(); + set_exception_handler(array($ErrorHandler, 'handleException')); + set_error_handler(array($ErrorHandler, 'handleError'), Configure::read('Error.level')); if (!defined('FULL_BASE_URL')) { define('FULL_BASE_URL', 'http://localhost'); @@ -200,12 +201,11 @@ class ShellDispatcher { * * @param string $shell Optionally the name of a plugin * @return mixed An object - * @throws MissingShellFileException when errors are encountered. + * @throws MissingShellException when errors are encountered. */ protected function _getShell($shell) { list($plugin, $shell) = pluginSplit($shell, true); - $class = Inflector::camelize($shell) . 'Shell'; App::uses('Shell', 'Console'); @@ -213,7 +213,9 @@ class ShellDispatcher { App::uses($class, $plugin . 'Console/Command'); if (!class_exists($class)) { - throw new MissingShellFileException(array('shell' => $shell)); + throw new MissingShellException(array( + 'class' => $class + )); } $Shell = new $class(); return $Shell; diff --git a/lib/Cake/Console/TaskCollection.php b/lib/Cake/Console/TaskCollection.php index 55e77327d..c82ddb560 100644 --- a/lib/Cake/Console/TaskCollection.php +++ b/lib/Cake/Console/TaskCollection.php @@ -54,7 +54,7 @@ class TaskCollection extends ObjectCollection { * @param string $task Task name to load * @param array $settings Settings for the task. * @return Task A task object, Either the existing loaded task or a new one. - * @throws MissingTaskFileException, MissingTaskClassException when the task could not be found + * @throws MissingTaskException when the task could not be found */ public function load($task, $settings = array()) { list($plugin, $name) = pluginSplit($task, true); @@ -66,7 +66,9 @@ class TaskCollection extends ObjectCollection { App::uses($taskClass, $plugin . 'Console/Command/Task'); if (!class_exists($taskClass)) { if (!class_exists($taskClass)) { - throw new MissingTaskClassException($taskClass); + throw new MissingTaskException(array( + 'class' => $taskClass + )); } } diff --git a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp index 7665047b3..e61424fdb 100644 --- a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp +++ b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp @@ -12,7 +12,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package cake.console.libs.template.objects + * @package Cake.Console.Templates.default.actions * @since CakePHP(tm) v 1.3 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/lib/Cake/Console/Templates/default/classes/controller.ctp b/lib/Cake/Console/Templates/default/classes/controller.ctp index ba3c343f7..eec49119c 100644 --- a/lib/Cake/Console/Templates/default/classes/controller.ctp +++ b/lib/Cake/Console/Templates/default/classes/controller.ctp @@ -14,7 +14,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package Cake.Console.Templates.default.actions + * @package Cake.Console.Templates.default.classes * @since CakePHP(tm) v 1.3 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/lib/Cake/Console/Templates/default/classes/fixture.ctp b/lib/Cake/Console/Templates/default/classes/fixture.ctp index d8049a5a9..64f1d1a36 100644 --- a/lib/Cake/Console/Templates/default/classes/fixture.ctp +++ b/lib/Cake/Console/Templates/default/classes/fixture.ctp @@ -14,7 +14,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package Cake.Console.Templates.default.actions + * @package Cake.Console.Templates.default.classes * @since CakePHP(tm) v 1.3 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/lib/Cake/Console/Templates/default/classes/model.ctp b/lib/Cake/Console/Templates/default/classes/model.ctp index 8b1c51996..6b6224881 100644 --- a/lib/Cake/Console/Templates/default/classes/model.ctp +++ b/lib/Cake/Console/Templates/default/classes/model.ctp @@ -14,7 +14,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package Cake.Console.Templates.default.actions + * @package Cake.Console.Templates.default.classes * @since CakePHP(tm) v 1.3 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/lib/Cake/Console/Templates/default/classes/test.ctp b/lib/Cake/Console/Templates/default/classes/test.ctp index 6eaf5d5bd..ca394cf20 100644 --- a/lib/Cake/Console/Templates/default/classes/test.ctp +++ b/lib/Cake/Console/Templates/default/classes/test.ctp @@ -13,14 +13,14 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package Cake.Console.Templates.default.actions + * @package Cake.Console.Templates.default.classes * @since CakePHP(tm) v 1.3 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ echo " -App::uses('', ''); +App::uses('', ''); /** @@ -81,7 +81,6 @@ class TestCase extends CakeTestCase { */ public function tearDown() { unset($this->); - ClassRegistry::flush(); parent::tearDown(); } diff --git a/lib/Cake/Console/Templates/default/views/form.ctp b/lib/Cake/Console/Templates/default/views/form.ctp index 1c24cfbd5..ccbed5454 100644 --- a/lib/Cake/Console/Templates/default/views/form.ctp +++ b/lib/Cake/Console/Templates/default/views/form.ctp @@ -11,7 +11,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package cake.console.libs.templates.views + * @package Cake.Console.Templates.default.views * @since CakePHP(tm) v 1.2.0.5234 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/lib/Cake/Console/Templates/default/views/home.ctp b/lib/Cake/Console/Templates/default/views/home.ctp index 490c2392c..917d84ad7 100644 --- a/lib/Cake/Console/Templates/default/views/home.ctp +++ b/lib/Cake/Console/Templates/default/views/home.ctp @@ -3,15 +3,28 @@ $output = " \n"; -$output = "

Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!

\n"; +$output .= "

Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!

\n"; $output .=" 0): +if (Configure::read('debug') > 0): Debugger::checkSecurityKeys(); endif; ?>

+=')): + echo ''; + echo __d('cake_dev', 'Your version of PHP is 5.2.6 or higher.'); + echo ''; + else: + echo ''; + echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.6 or higher to use CakePHP.'); + echo ''; + endif; +?> +

+

'; @@ -88,7 +101,7 @@ if (isset(\$filePresent)): echo '

'; } ?>\n"; -$output .= "

\n"; +$output .= "

\n"; $output .= "

\n"; $output .= " -; SVN FILE: $Id$ ;/** ; * ACL Configuration ; * ; * ; * PHP 5 ; * -; * CakePHP(tm) : Rapid Development Framework http://www.cakephp.org/ +; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) ; * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) ; * ; * Licensed under The MIT License @@ -14,7 +13,7 @@ ; * ; * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) ; * @link http://cakephp.org CakePHP(tm) Project -; * @package Cake.Console.Templates.skel.Config +; * @package app.Config ; * @since CakePHP(tm) v 0.10.0.1076 ; * @license MIT License (http://www.opensource.org/licenses/mit-license.php) ; */ diff --git a/lib/Cake/Console/Templates/skel/Config/bootstrap.php b/lib/Cake/Console/Templates/skel/Config/bootstrap.php index de45d4956..fce18ccba 100644 --- a/lib/Cake/Console/Templates/skel/Config/bootstrap.php +++ b/lib/Cake/Console/Templates/skel/Config/bootstrap.php @@ -30,16 +30,16 @@ Cache::config('default', array('engine' => 'File')); * The settings below can be used to set additional paths to models, views and controllers. * * App::build(array( - * 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), - * 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'), - * 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'), - * 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), - * 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), - * 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), - * 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'), - * 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), - * 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), - * 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), + * 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), + * 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'), + * 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'), + * 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), + * 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), + * 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), + * 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'), + * 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), + * 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), + * 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), * 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/') * )); * @@ -62,4 +62,4 @@ Cache::config('default', array('engine' => 'File')); * CakePlugin::loadAll(); // Loads all plugins at once * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit * - */ \ No newline at end of file + */ diff --git a/lib/Cake/Console/Templates/skel/Config/core.php b/lib/Cake/Console/Templates/skel/Config/core.php index a25329385..2b03097dc 100644 --- a/lib/Cake/Console/Templates/skel/Config/core.php +++ b/lib/Cake/Console/Templates/skel/Config/core.php @@ -196,8 +196,8 @@ * Will append a querystring parameter containing the time the file was modified. This is * useful for invalidating browser caches. * - * Set to `true` to apply timestamps, when debug = 0, or set to 'force' to always enable - * timestamping. + * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable + * timestamping regardless of debug value. */ //Configure::write('Asset.timestamp', true); /** diff --git a/lib/Cake/Console/Templates/skel/Config/database.php.default b/lib/Cake/Console/Templates/skel/Config/database.php.default index d478669bf..3ce441be3 100644 --- a/lib/Cake/Console/Templates/skel/Config/database.php.default +++ b/lib/Cake/Console/Templates/skel/Config/database.php.default @@ -54,6 +54,8 @@ * For MySQL, Postgres specifies the character encoding to use when connecting to the * database. Uses database default not specified. * + * unix_socket => + * For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port` */ class DATABASE_CONFIG { diff --git a/lib/Cake/Console/Templates/skel/Config/email.php.default b/lib/Cake/Console/Templates/skel/Config/email.php.default index 6152e9eb7..0d5d11a5b 100644 --- a/lib/Cake/Console/Templates/skel/Config/email.php.default +++ b/lib/Cake/Console/Templates/skel/Config/email.php.default @@ -30,6 +30,7 @@ * transport => The name of a supported transport; valid options are as follows: * Mail - Send using PHP mail function * Smtp - Send using SMTP + * Debug - Do not send the email, just return the result * * You can add custom transports (or override existing transports) by adding the * appropriate file to app/Network/Email. Transports should be named 'YourTransport.php', @@ -43,18 +44,23 @@ class EmailConfig { public $default = array( 'transport' => 'Mail', - 'from' => 'you@localhost' + 'from' => 'you@localhost', + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', ); public $smtp = array( 'transport' => 'Smtp', - 'from' => array('My Site', 'site@localhost'), + 'from' => array('site@localhost' => 'My Site'), 'host' => 'localhost', 'port' => 25, 'timeout' => 30, 'username' => 'user', 'password' => 'secret', - 'client' => null + 'client' => null, + 'log' => false + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', ); public $fast = array( @@ -82,7 +88,10 @@ class EmailConfig { 'timeout' => 30, 'username' => 'user', 'password' => 'secret', - 'client' => null + 'client' => null, + 'log' => true, + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', ); } diff --git a/lib/Cake/Console/Templates/skel/Console/cake b/lib/Cake/Console/Templates/skel/Console/cake index 61b8c171f..9c47fea00 100644 --- a/lib/Cake/Console/Templates/skel/Console/cake +++ b/lib/Cake/Console/Templates/skel/Console/cake @@ -11,15 +11,23 @@ # Redistributions of files must retain the above copyright notice. # # @copyright Copyright 2005-2011, Cake Software Foundation, Inc. -# @link http://cakephp.org CakePHP(tm) Project +# @link http://cakephp.org CakePHP(tm) Project # @package app.Console -# @since CakePHP(tm) v 2.0 -# @license MIT License (http://www.opensource.org/licenses/mit-license.php) +# @since CakePHP(tm) v 2.0 +# @license MIT License (http://www.opensource.org/licenses/mit-license.php) # ################################################################################ -LIB=${0/%cake/} +LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0") + +while [ -h "$LIB" ]; do + DIR=$(dirname -- "$LIB") + SYM=$(readlink "$LIB") + LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") +done + +LIB=$(dirname -- "$LIB")/ APP=`pwd` -exec php -q ${LIB}cake.php -working "${APP}" "$@" +exec php -q "$LIB"cake.php -working "$APP" "$@" exit; \ No newline at end of file diff --git a/lib/Cake/Console/Templates/skel/Console/cake.bat b/lib/Cake/Console/Templates/skel/Console/cake.bat index 43d2dd4b0..53e95a3c0 100644 --- a/lib/Cake/Console/Templates/skel/Console/cake.bat +++ b/lib/Cake/Console/Templates/skel/Console/cake.bat @@ -1,32 +1,32 @@ -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: -:: Bake is a shell script for running CakePHP bake script -:: PHP 5 -:: -:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org) -:: Copyright 2005-2011, Cake Software Foundation, Inc. -:: -:: Licensed under The MIT License -:: Redistributions of files must retain the above copyright notice. -:: -:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc. -:: @link http://cakephp.org CakePHP(tm) Project -:: @package app.Console -:: @since CakePHP(tm) v 2.0 -:: @license MIT License (http://www.opensource.org/licenses/mit-license.php) -:: -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:: In order for this script to work as intended, the cake\console\ folder must be in your PATH - -@echo. -@echo off - -SET app=%0 -SET lib=%~dp0 - -php -q "%lib%cake.php" -working "%CD% " %* - -echo. - -exit /B %ERRORLEVEL% \ No newline at end of file +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: +:: Bake is a shell script for running CakePHP bake script +:: PHP 5 +:: +:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org) +:: Copyright 2005-2011, Cake Software Foundation, Inc. +:: +:: Licensed under The MIT License +:: Redistributions of files must retain the above copyright notice. +:: +:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc. +:: @link http://cakephp.org CakePHP(tm) Project +:: @package app.Console +:: @since CakePHP(tm) v 2.0 +:: @license MIT License (http://www.opensource.org/licenses/mit-license.php) +:: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: In order for this script to work as intended, the cake\console\ folder must be in your PATH + +@echo. +@echo off + +SET app=%0 +SET lib=%~dp0 + +php -q "%lib%cake.php" -working "%CD% " %* + +echo. + +exit /B %ERRORLEVEL% diff --git a/lib/Cake/Console/Templates/skel/Controller/AppController.php b/lib/Cake/Console/Templates/skel/Controller/AppController.php index 15db7c208..a46563f02 100644 --- a/lib/Cake/Console/Templates/skel/Controller/AppController.php +++ b/lib/Cake/Console/Templates/skel/Controller/AppController.php @@ -28,7 +28,7 @@ App::uses('Controller', 'Controller'); * Add your application-wide methods in the class below, your controllers * will inherit them. * - * @package Cake.Console.Templates.skel.Controller + * @package app.Controller */ class AppController extends Controller { } diff --git a/lib/Cake/Console/Templates/skel/Controller/PagesController.php b/lib/Cake/Console/Templates/skel/Controller/PagesController.php index cf34b0a2a..0fd243970 100644 --- a/lib/Cake/Console/Templates/skel/Controller/PagesController.php +++ b/lib/Cake/Console/Templates/skel/Controller/PagesController.php @@ -14,7 +14,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package Cake.Console.Templates.skel.Controller + * @package app.Controller * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ @@ -24,7 +24,7 @@ * * Override this controller by placing a copy in controllers directory of an application * - * @package Cake.Console.Templates.skel.Controller + * @package app.Controller */ class PagesController extends AppController { diff --git a/lib/Cake/Console/Templates/skel/Model/AppModel.php b/lib/Cake/Console/Templates/skel/Model/AppModel.php index 141ec88e8..4c9b8bde7 100644 --- a/lib/Cake/Console/Templates/skel/Model/AppModel.php +++ b/lib/Cake/Console/Templates/skel/Model/AppModel.php @@ -28,7 +28,7 @@ App::uses('Model', 'Model'); * Add your application-wide methods in the class below, your models * will inherit them. * - * @package Cake.Console.Templates.skel.Model + * @package app.Model */ class AppModel extends Model { } diff --git a/lib/Cake/Console/Templates/skel/View/Emails/html/default.ctp b/lib/Cake/Console/Templates/skel/View/Emails/html/default.ctp index 0f59cc229..15f15ea39 100644 --- a/lib/Cake/Console/Templates/skel/View/Emails/html/default.ctp +++ b/lib/Cake/Console/Templates/skel/View/Emails/html/default.ctp @@ -11,7 +11,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package cake.libs.view.templates.elements.email.html + * @package app.View.Emails.html * @since CakePHP(tm) v 0.10.0.1076 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/lib/Cake/Console/Templates/skel/View/Emails/text/default.ctp b/lib/Cake/Console/Templates/skel/View/Emails/text/default.ctp index ac40c7d84..097ffd8c6 100644 --- a/lib/Cake/Console/Templates/skel/View/Emails/text/default.ctp +++ b/lib/Cake/Console/Templates/skel/View/Emails/text/default.ctp @@ -11,7 +11,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package cake.libs.view.templates.elements.email.text + * @package app.View.Emails.text * @since CakePHP(tm) v 0.10.0.1076 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/lib/Cake/Console/Templates/skel/View/Helper/AppHelper.php b/lib/Cake/Console/Templates/skel/View/Helper/AppHelper.php index 27baaff2c..c31df1ab6 100644 --- a/lib/Cake/Console/Templates/skel/View/Helper/AppHelper.php +++ b/lib/Cake/Console/Templates/skel/View/Helper/AppHelper.php @@ -15,6 +15,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project + * @package app.View.Helper * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ @@ -22,12 +23,12 @@ App::uses('Helper', 'View'); /** * This is a placeholder class. - * Create the same file in app/app_helper.php + * Create the same file in app/View/Helper/AppHelper.php * * Add your application-wide methods in the class below, your helpers * will inherit them. * - * @package Cake.Console.Templates.skel.View.Helper + * @package app.View.Helper */ class AppHelper extends Helper { } diff --git a/lib/Cake/Console/Templates/skel/View/Layouts/ajax.ctp b/lib/Cake/Console/Templates/skel/View/Layouts/ajax.ctp index 177bee8d3..a4aa997ff 100644 --- a/lib/Cake/Console/Templates/skel/View/Layouts/ajax.ctp +++ b/lib/Cake/Console/Templates/skel/View/Layouts/ajax.ctp @@ -11,7 +11,7 @@ * * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project - * @package cake.libs.view.templates.layouts + * @package app.View.Layouts * @since CakePHP(tm) v 0.10.0.1076 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ diff --git a/lib/Cake/Console/Templates/skel/View/Layouts/flash.ctp b/lib/Cake/Console/Templates/skel/View/Layouts/flash.ctp index 62ded3183..e1b4846d8 100644 --- a/lib/Cake/Console/Templates/skel/View/Layouts/flash.ctp +++ b/lib/Cake/Console/Templates/skel/View/Layouts/flash.ctp @@ -22,7 +22,7 @@ Html->charset(); ?> <?php echo $page_title; ?> - +