diff --git a/app/config/bootstrap.php b/app/config/bootstrap.php index ceeb85670..2e36a893e 100644 --- a/app/config/bootstrap.php +++ b/app/config/bootstrap.php @@ -1,9 +1,12 @@ 'File')); + /** * The settings below can be used to set additional paths to models, views and controllers. * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470) diff --git a/app/config/core.php b/app/config/core.php index 9744da06c..3a7613b85 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -283,4 +283,40 @@ * )); * */ - Cache::config('default', array('engine' => 'File')); + +// Pick the caching engine to use. If APC is enabled use it. +$engine = 'File'; +if (extension_loaded('apc')) { + $engine = 'Apc'; +} + +// In development mode, caches should expire quickly. +$duration = '+999 days'; +if (Configure::read('debug') >= 1) { + $duration = '+10 seconds'; +} + +/** + * Configure the cache used for general framework caching. Path information, + * object listings, and translation cache files are stored with this configuration. + */ +Cache::config('_cake_core_', array( + 'engine' => $engine, + 'prefix' => 'cake_core_', + 'path' => CACHE . 'persistent' . DS, + 'serialize' => ($engine === 'File'), + 'duration' => $duration +)); + +/** + * Configure the cache for model, and datasource caches. This cache configuration + * is used to store schema descriptions, and table listings in connections. + */ +Cache::config('_cake_model_', array( + 'engine' => $engine, + 'prefix' => 'cake_model_', + 'path' => CACHE . 'models' . DS, + 'serialize' => ($engine === 'File'), + 'duration' => $duration +)); + diff --git a/app/config/database.php.default b/app/config/database.php.default index 9fb8e9e98..b7eb4bba2 100644 --- a/app/config/database.php.default +++ b/app/config/database.php.default @@ -28,15 +28,15 @@ * You can specify multiple configurations for production, development and testing. * * driver => The name of a supported driver; valid options are as follows: - * mysql - MySQL 4 & 5, - * sqlite - SQLite (PHP5 only), - * postgres - PostgreSQL 7 and higher, - * mssql - Microsoft SQL Server 2000 and higher, - * oracle - Oracle 8 and higher + * Datasabe/Mysql - MySQL 4 & 5, + * Datasabe/Sqlite - SQLite (PHP5 only), + * Datasabe/Postgres - PostgreSQL 7 and higher, + * Datasabe/Mssql - Microsoft SQL Server 2000 and higher, + * Datasabe/Oracle - Oracle 8 and higher * * You can add custom database drivers (or override existing drivers) by adding the - * appropriate file to app/models/datasources/dbo. Drivers should be named 'dbo_x.php', - * where 'x' is the name of the database. + * appropriate file to app/models/datasources/database. Drivers should be named 'MyDriver.php', + * * * persistent => true / false * Determines whether or not the database should use a persistent connection @@ -59,7 +59,7 @@ class DATABASE_CONFIG { public $default = array( - 'driver' => 'mysql', + 'datasource' => 'Database/Mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'user', @@ -69,7 +69,7 @@ class DATABASE_CONFIG { ); public $test = array( - 'driver' => 'mysql', + 'datasource' => 'Database/Mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'user', diff --git a/app/webroot/index.php b/app/webroot/index.php index 77b9db786..3c5e71589 100644 --- a/app/webroot/index.php +++ b/app/webroot/index.php @@ -75,6 +75,6 @@ return; } - require LIBS . 'Routing' . DS .'Dispatcher.php'; + App::uses('Dispatcher', 'Routing'); $Dispatcher = new Dispatcher(); $Dispatcher->dispatch(new CakeRequest()); diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 00cd64c52..32e5e5cb3 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -73,14 +73,24 @@ class Cache { * both create new configurations, return the settings for already configured * configurations. * - * To create a new configuration: + * To create a new configuration, or to modify an existing configuration permanently: * * `Cache::config('my_config', array('engine' => 'File', 'path' => TMP));` * - * To get the settings for a configuration, and set it as the currently selected configuration + * If you need to modify a configuration temporarily, use Cache::set(). + * To get the settings for a configuration: * * `Cache::config('default');` * + * There are 4 built-in caching engines: + * + * - `FileEngine` - Uses simple files to store content. Poor performance, but good for + * storing large objects, or things that are not IO sensitive. + * - `ApcEngine` - Uses the APC object cache, one of the fastest caching engines. + * - `MemcacheEngine` - Uses the PECL::Memcache extension and Memcached for storage. + * Fast reads/writes, and benefits from memcache being distributed. + * - `XcacheEngine` - Uses the Xcache extension, an alternative to APC. + * * @see app/config/core.php for configuration settings * @param string $name Name of the configuration * @param array $settings Optional associative array of settings passed to the engine diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index f7c55e7e8..c1cf8da68 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -1,7 +1,10 @@ path . $controllerFile .'_controller.php')) { + if (file_exists($this->path . $controllerName .'Controller.php')) { $question[] = __d('cake', "Warning: Choosing no will overwrite the %sController.", $controllerName); } $doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y'); @@ -288,7 +287,7 @@ class ControllerTask extends BakeTask { $primaryKey = $modelObj->primaryKey; $this->Template->set(compact('plugin', 'admin', 'controllerPath', 'pluralName', 'singularName', - 'singularHumanName', 'pluralHumanName', 'modelObj', 'wannaUseSession', 'currentModelName', + 'singularHumanName', 'pluralHumanName', 'modelObj', 'wannaUseSession', 'currentModelName', 'displayField', 'primaryKey' )); $actions = $this->Template->generate('actions', 'controller_actions'); @@ -315,7 +314,7 @@ class ControllerTask extends BakeTask { $contents = $this->Template->generate('classes', 'controller'); $path = $this->getPath(); - $filename = $path . $this->_controllerPath($controllerName) . '_controller.php'; + $filename = $path . $this->_controllerNames($controllerName) . 'Controller.php'; if ($this->createFile($filename, $contents)) { return $contents; } @@ -500,4 +499,4 @@ class ControllerTask extends BakeTask { $this->out(); $this->_stop(); } -} +} \ No newline at end of file diff --git a/lib/Cake/Console/Command/Task/ModelTask.php b/lib/Cake/Console/Command/Task/ModelTask.php index 349997dda..7804e491c 100644 --- a/lib/Cake/Console/Command/Task/ModelTask.php +++ b/lib/Cake/Console/Command/Task/ModelTask.php @@ -741,7 +741,7 @@ class ModelTask extends BakeTask { $out = $this->Template->generate('classes', 'model'); $path = $this->getPath(); - $filename = $path . Inflector::underscore($name) . '.php'; + $filename = $path . $name . '.php'; $this->out("\nBaking model class for $name...", 1, Shell::QUIET); $this->createFile($filename, $out); ClassRegistry::flush(); diff --git a/lib/Cake/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php index 862b7f83a..3223cf54a 100644 --- a/lib/Cake/Console/Command/Task/ProjectTask.php +++ b/lib/Cake/Console/Command/Task/ProjectTask.php @@ -52,14 +52,6 @@ class ProjectTask extends Shell { $project = $_SERVER['PWD'] . DS . $project; } - if (empty($this->params['skel'])) { - $core = App::core('Console'); - $skelPath = dirname($core[0]) . DS . 'templates' . DS . 'skel'; - if (is_dir($skelPath) === true) { - $this->params['skel'] = $skelPath; - } - } - while (!$project) { $prompt = __d('cake', "What is the full path for this app including the app directory name?\n Example:"); $default = APP_PATH . 'myapp'; @@ -387,8 +379,9 @@ class ProjectTask extends Shell { ))->addOption('empty', array( 'help' => __d('cake', 'Create empty files in each of the directories. Good if you are using git') ))->addOption('skel', array( + 'default' => current(App::core('Console')) . DS . 'templates' . DS . 'skel', 'help' => __d('cake', 'The directory layout to use for the new application skeleton. Defaults to cake/console/templates/skel of CakePHP used to create the project.') )); } -} +} \ No newline at end of file diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php index 9660e0cc9..aa7739aea 100644 --- a/lib/Cake/Console/Shell.php +++ b/lib/Cake/Console/Shell.php @@ -663,7 +663,7 @@ class Shell extends Object { * @return string Path to controller */ protected function _controllerPath($name) { - return strtolower(Inflector::underscore($name)); + return Inflector::underscore($name); } /** diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index 6198bc338..2bc41e66c 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -105,7 +105,7 @@ class ShellDispatcher { if (!isset($this->args[0]) || !isset($this->params['working'])) { $message = "This file has been loaded incorrectly and cannot continue.\n" . - "Please make sure that " . DIRECTORY_SEPARATOR . "cake" . DIRECTORY_SEPARATOR . "console is in your system path,\n" . + "Please make sure that " . DIRECTORY_SEPARATOR . "cake" . DIRECTORY_SEPARATOR . "console is in your system path,\n" . "and check the cookbook for the correct usage of this command.\n" . "(http://book.cakephp.org/)"; throw new CakeException($message); @@ -127,14 +127,14 @@ class ShellDispatcher { define('APP_PATH', $this->params['working'] . DS); define('WWW_ROOT', APP_PATH . $this->params['webroot'] . DS); if (!is_dir(ROOT . DS . APP_DIR . DS . 'tmp')) { - define('TMP', CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel' . DS . 'tmp' . DS); + define('TMP', CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'templates' . DS . 'skel' . DS . 'tmp' . DS); } $boot = file_exists(ROOT . DS . APP_DIR . DS . 'config' . DS . 'bootstrap.php'); require CORE_PATH . 'Cake' . DS . 'bootstrap.php'; if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) { - include_once CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php'; + include_once CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php'; App::build(); } require_once CONSOLE_LIBS . 'ConsoleErrorHandler.php'; @@ -229,9 +229,9 @@ class ShellDispatcher { $this->_parsePaths($args); $defaults = array( - 'app' => 'app', + 'app' => 'app', 'root' => dirname(dirname(dirname(__FILE__))), - 'working' => null, + 'working' => null, 'webroot' => 'webroot' ); $params = array_merge($defaults, array_intersect_key($this->params, $defaults)); diff --git a/lib/Cake/Console/templates/default/classes/test.ctp b/lib/Cake/Console/templates/default/classes/test.ctp index 2bcce902b..331347099 100644 --- a/lib/Cake/Console/templates/default/classes/test.ctp +++ b/lib/Cake/Console/templates/default/classes/test.ctp @@ -20,7 +20,7 @@ echo " -App::import('', ''); +App::uses('', ''); /** diff --git a/lib/Cake/Console/templates/default/views/home.ctp b/lib/Cake/Console/templates/default/views/home.ctp index 22217b2fb..b707e5eb3 100644 --- a/lib/Cake/Console/templates/default/views/home.ctp +++ b/lib/Cake/Console/templates/default/views/home.ctp @@ -2,7 +2,7 @@ $output = "
+ isConnected()): + echo ''; + echo __('Cake is able to connect to the database.'); + echo ''; + else: + echo ''; + echo __('Cake is NOT able to connect to the database.'); + echo ''; + endif; + ?> +
+ isConnected()): - echo ''; - echo __('Cake is able to connect to the database.'); - echo ''; - else: - echo ''; - echo __('Cake is NOT able to connect to the database.'); - echo ''; - endif; -?> -\n"; -$output .= "\n"; + App::uses('Validation', 'Utility'); + if (!Validation::alphaNumeric('cakephp')) { + echo '';
+ __('PCRE has not been compiled with Unicode support.');
+ echo '
';
+ __('Recompile PCRE with Unicode support by adding --enable-unicode-properties
when configuring');
+ echo '
\n"; $output .= " 'File')); + /** * The settings below can be used to set additional paths to models, views and controllers. * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470) @@ -28,7 +34,7 @@ * '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/'), + * '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/'), diff --git a/lib/Cake/Console/templates/skel/config/core.php b/lib/Cake/Console/templates/skel/config/core.php index 9744da06c..3a7613b85 100644 --- a/lib/Cake/Console/templates/skel/config/core.php +++ b/lib/Cake/Console/templates/skel/config/core.php @@ -283,4 +283,40 @@ * )); * */ - Cache::config('default', array('engine' => 'File')); + +// Pick the caching engine to use. If APC is enabled use it. +$engine = 'File'; +if (extension_loaded('apc')) { + $engine = 'Apc'; +} + +// In development mode, caches should expire quickly. +$duration = '+999 days'; +if (Configure::read('debug') >= 1) { + $duration = '+10 seconds'; +} + +/** + * Configure the cache used for general framework caching. Path information, + * object listings, and translation cache files are stored with this configuration. + */ +Cache::config('_cake_core_', array( + 'engine' => $engine, + 'prefix' => 'cake_core_', + 'path' => CACHE . 'persistent' . DS, + 'serialize' => ($engine === 'File'), + 'duration' => $duration +)); + +/** + * Configure the cache for model, and datasource caches. This cache configuration + * is used to store schema descriptions, and table listings in connections. + */ +Cache::config('_cake_model_', array( + 'engine' => $engine, + 'prefix' => 'cake_model_', + 'path' => CACHE . 'models' . DS, + 'serialize' => ($engine === 'File'), + 'duration' => $duration +)); + diff --git a/lib/Cake/Console/templates/skel/config/database.php.default b/lib/Cake/Console/templates/skel/config/database.php.default index 0952dac47..b7eb4bba2 100644 --- a/lib/Cake/Console/templates/skel/config/database.php.default +++ b/lib/Cake/Console/templates/skel/config/database.php.default @@ -28,39 +28,38 @@ * You can specify multiple configurations for production, development and testing. * * driver => The name of a supported driver; valid options are as follows: - * mysql - MySQL 4 & 5, - * sqlite - SQLite (PHP5 only), - * postgres - PostgreSQL 7 and higher, - * mssql - Microsoft SQL Server 2000 and higher, - * oracle - Oracle 8 and higher + * Datasabe/Mysql - MySQL 4 & 5, + * Datasabe/Sqlite - SQLite (PHP5 only), + * Datasabe/Postgres - PostgreSQL 7 and higher, + * Datasabe/Mssql - Microsoft SQL Server 2000 and higher, + * Datasabe/Oracle - Oracle 8 and higher * * You can add custom database drivers (or override existing drivers) by adding the - * appropriate file to app/models/datasources/dbo. Drivers should be named 'dbo_x.php', - * where 'x' is the name of the database. + * appropriate file to app/models/datasources/database. Drivers should be named 'MyDriver.php', + * * * persistent => true / false * Determines whether or not the database should use a persistent connection * * host => - * the host you connect to the database. To add a socket or port number, use 'port' => # + * the host you connect to the database. To add a socket or port number, use 'port' => # * * prefix => * Uses the given prefix for all the tables in this database. This setting can be overridden * on a per-table basis with the Model::$tablePrefix property. * * schema => - * For Postgresspecifies which schema you would like to use the tables in. Postgres defaults to - * 'public', DB2 defaults to empty. + * For Postgres specifies which schema you would like to use the tables in. Postgres defaults to 'public'. * * encoding => - * For MySQL, Postgres and Sqlite, specifies the character encoding to use when connecting to the - * database. Uses database default. + * For MySQL, Postgres specifies the character encoding to use when connecting to the + * database. Uses database default not specified. * */ class DATABASE_CONFIG { public $default = array( - 'driver' => 'mysql', + 'datasource' => 'Database/Mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'user', @@ -70,7 +69,7 @@ class DATABASE_CONFIG { ); public $test = array( - 'driver' => 'mysql', + 'datasource' => 'Database/Mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'user', diff --git a/lib/Cake/Console/templates/skel/app_controller.php b/lib/Cake/Console/templates/skel/controllers/AppController.php similarity index 100% rename from lib/Cake/Console/templates/skel/app_controller.php rename to lib/Cake/Console/templates/skel/controllers/AppController.php diff --git a/lib/Cake/Console/templates/skel/controllers/pages_controller.php b/lib/Cake/Console/templates/skel/controllers/PagesController.php similarity index 100% rename from lib/Cake/Console/templates/skel/controllers/pages_controller.php rename to lib/Cake/Console/templates/skel/controllers/PagesController.php diff --git a/lib/Cake/Console/templates/skel/app_model.php b/lib/Cake/Console/templates/skel/models/AppModel.php similarity index 100% rename from lib/Cake/Console/templates/skel/app_model.php rename to lib/Cake/Console/templates/skel/models/AppModel.php diff --git a/lib/Cake/Console/templates/skel/app_helper.php b/lib/Cake/Console/templates/skel/views/helpers/AppHelper.php similarity index 96% rename from lib/Cake/Console/templates/skel/app_helper.php rename to lib/Cake/Console/templates/skel/views/helpers/AppHelper.php index 8bb93af44..6689abcba 100644 --- a/lib/Cake/Console/templates/skel/app_helper.php +++ b/lib/Cake/Console/templates/skel/views/helpers/AppHelper.php @@ -18,7 +18,7 @@ * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -App::uses('Helper', 'Helper'); +App::uses('Helper', 'View'); /** * This is a placeholder class. diff --git a/lib/Cake/Console/templates/skel/webroot/index.php b/lib/Cake/Console/templates/skel/webroot/index.php index f1ff8d197..77b9db786 100644 --- a/lib/Cake/Console/templates/skel/webroot/index.php +++ b/lib/Cake/Console/templates/skel/webroot/index.php @@ -49,7 +49,7 @@ * */ if (!defined('CAKE_CORE_INCLUDE_PATH')) { - define('CAKE_CORE_INCLUDE_PATH', ROOT); + define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib'); } /** @@ -67,7 +67,7 @@ define('APP_PATH', ROOT . DS . APP_DIR . DS); define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); } - if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) { + if (!include(CORE_PATH . 'Cake' . DS . 'bootstrap.php')) { trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR); } @@ -75,6 +75,6 @@ return; } - require LIBS . 'dispatcher.php'; + require LIBS . 'Routing' . DS .'Dispatcher.php'; $Dispatcher = new Dispatcher(); $Dispatcher->dispatch(new CakeRequest()); diff --git a/lib/Cake/Controller/Component/SecurityComponent.php b/lib/Cake/Controller/Component/SecurityComponent.php index 5f73edc78..16cdc6413 100644 --- a/lib/Cake/Controller/Component/SecurityComponent.php +++ b/lib/Cake/Controller/Component/SecurityComponent.php @@ -186,7 +186,7 @@ class SecurityComponent extends Component { */ public function startup($controller) { $this->request = $controller->request; - $this->_action = strtolower($this->request->params['action']); + $this->_action = $this->request->params['action']; $this->_methodsRequired($controller); $this->_secureRequired($controller); $this->_authRequired($controller); @@ -321,10 +321,10 @@ class SecurityComponent extends Component { foreach (array('Post', 'Get', 'Put', 'Delete') as $method) { $property = 'require' . $method; if (is_array($this->$property) && !empty($this->$property)) { - $require = array_map('strtolower', $this->$property); + $require = $this->$property; if (in_array($this->_action, $require) || $this->$property == array('*')) { - if (!$this->request->is(strtolower($method))) { - if (!$this->blackHole($controller, strtolower($method))) { + if (!$this->request->is($method)) { + if (!$this->blackHole($controller, $method)) { return null; } } @@ -342,7 +342,7 @@ class SecurityComponent extends Component { */ protected function _secureRequired($controller) { if (is_array($this->requireSecure) && !empty($this->requireSecure)) { - $requireSecure = array_map('strtolower', $this->requireSecure); + $requireSecure = $this->requireSecure; if (in_array($this->_action, $requireSecure) || $this->requireSecure == array('*')) { if (!$this->request->is('ssl')) { @@ -363,7 +363,7 @@ class SecurityComponent extends Component { */ protected function _authRequired($controller) { if (is_array($this->requireAuth) && !empty($this->requireAuth) && !empty($this->request->data)) { - $requireAuth = array_map('strtolower', $this->requireAuth); + $requireAuth = $this->requireAuth; if (in_array($this->request->params['action'], $requireAuth) || $this->requireAuth == array('*')) { if (!isset($controller->request->data['_Token'] )) { diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 07aea99ef..a257b051f 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -236,14 +236,14 @@ class App { 'Model' => array('%s' . 'models' . DS), 'Model/Behavior' => array('%s' . 'models' . DS . 'behaviors' . DS), 'Model/Datasource' => array('%s' . 'models' . DS . 'datasources' . DS), - 'Model/Datasource/Database' => array('%s' . 'models' . DS . 'datasources' . DS . 'Database' . DS), - 'Model/Datasource/Session' => array('%s' . 'models' . DS . 'datasources' . DS . 'Session' . DS), + 'Model/Datasource/Database' => array('%s' . 'models' . DS . 'datasources' . DS . 'database' . DS), + 'Model/Datasource/Session' => array('%s' . 'models' . DS . 'datasources' . DS . 'session' . DS), 'Controller' => array('%s' . 'controllers' . DS), 'Controller/Component' => array('%s' . 'controllers' . DS . 'components' . DS), 'View' => array('%s' . 'views' . DS), 'View/Helper' => array('%s' . 'views' . DS . 'helpers' . DS), 'Console' => array( - '%s' . 'console' . DS . 'shells' . DS, + '%s' . 'console' . DS, '%s' . 'vendors' . DS . 'shells' . DS, VENDORS . 'shells' . DS ), diff --git a/lib/Cake/Core/Configure.php b/lib/Cake/Core/Configure.php index 096de5da7..2ec08964c 100644 --- a/lib/Cake/Core/Configure.php +++ b/lib/Cake/Core/Configure.php @@ -21,7 +21,7 @@ * Configuration class. Used for managing runtime configuration information. * * Provides features for reading and writing to the runtime configuration, as well - * as methods for loading additional configuration files or storing runtime configuration + * as methods for loading additional configuration files or storing runtime configuration * for future use. * * @package cake.libs @@ -73,43 +73,6 @@ class Configure { trigger_error(__d('cake', "Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", CONFIGS), E_USER_ERROR); } - if (empty(self::$_values['Cache']['disable'])) { - $cache = Cache::config('default'); - - if (empty($cache['settings'])) { - trigger_error(__d('cake', 'Cache not configured properly. Please check Cache::config(); in APP/config/core.php'), E_USER_WARNING); - $cache = Cache::config('default', array('engine' => 'File')); - } - $path = $prefix = $duration = null; - - if (!empty($cache['settings']['path'])) { - $path = realpath($cache['settings']['path']); - } else { - $prefix = $cache['settings']['prefix']; - } - - if (self::$_values['debug'] >= 1) { - $duration = '+10 seconds'; - } else { - $duration = '+999 days'; - } - $cacheConfigs = Cache::configured(); - - if (!in_array('_cake_core_', $cacheConfigs)) { - Cache::config('_cake_core_', array_merge((array)$cache['settings'], array( - 'prefix' => $prefix . 'cake_core_', 'path' => $path . DS . 'persistent' . DS, - 'serialize' => true, 'duration' => $duration - ))); - } - - if (!in_array('_cake_model_', $cacheConfigs)) { - Cache::config('_cake_model_', array_merge((array)$cache['settings'], array( - 'prefix' => $prefix . 'cake_model_', 'path' => $path . DS . 'models' . DS, - 'serialize' => true, 'duration' => $duration - ))); - } - } - App::init(); App::build(); if (!include(CONFIGS . 'bootstrap.php')) { @@ -261,7 +224,7 @@ class Configure { } /** - * Add a new reader to Configure. Readers allow you to read configuration + * Add a new reader to Configure. Readers allow you to read configuration * files in various formats/storage locations. CakePHP comes with two built-in readers * PhpReader and IniReader. You can also implement your own reader classes in your application. * @@ -269,7 +232,7 @@ class Configure { * * `Configure::config('ini', new IniReader());` * - * @param string $name The name of the reader being configured. This alias is used later to + * @param string $name The name of the reader being configured. This alias is used later to * read values from a specific reader. * @param ConfigReaderInterface $reader The reader to append. * @return void @@ -291,7 +254,7 @@ class Configure { } /** - * Remove a configured reader. This will unset the reader + * Remove a configured reader. This will unset the reader * and make any future attempts to use it cause an Exception. * * @param string $name Name of the reader to drop. @@ -313,7 +276,7 @@ class Configure { * runtime configuration. You can load configuration files from plugins * by preceeding the filename with the plugin name. * - * `Configure::load('Users.user', 'default')` + * `Configure::load('Users.user', 'default')` * * Would load the 'user' config file using the default config reader. You can load * app config files by giving the name of the resource you want loaded. @@ -395,7 +358,7 @@ interface ConfigReaderInterface { * These sources can either be static resources like files, or dynamic ones like * a database, or other datasource. * - * @param string $key + * @param string $key * @return array An array of data to merge into the runtime configuration */ function read($key); diff --git a/lib/Cake/Error/exceptions.php b/lib/Cake/Error/exceptions.php index 8c5a80b86..31f01f361 100644 --- a/lib/Cake/Error/exceptions.php +++ b/lib/Cake/Error/exceptions.php @@ -20,12 +20,14 @@ /** * Parent class for all of the HTTP related exceptions in CakePHP. - * All HTTP status/error related exceptions should extend this class so + * All HTTP status/error related exceptions should extend this class so * catch blocks can be specifically typed. * * @package cake.libs */ -class HttpException extends RuntimeException { } +if (!class_exists('HttpException')) { + class HttpException extends RuntimeException { } +} /** * Represents an HTTP 400 error. @@ -198,12 +200,12 @@ class CakeException extends RuntimeException { } /** - * Missing Controller exception - used when a controller + * Missing Controller exception - used when a controller * cannot be found. * * @package cake.libs */ -class MissingControllerException extends CakeException { +class MissingControllerException extends CakeException { protected $_messageTemplate = 'Controller class %s could not be found.'; public function __construct($message, $code = 404) { @@ -212,12 +214,12 @@ class MissingControllerException extends CakeException { } /** - * Missing Action exception - used when a controller action + * Missing Action exception - used when a controller action * cannot be found. * * @package cake.libs */ -class MissingActionException extends CakeException { +class MissingActionException extends CakeException { protected $_messageTemplate = 'Action %s::%s() could not be found.'; public function __construct($message, $code = 404) { @@ -225,12 +227,12 @@ class MissingActionException extends CakeException { } } /** - * Private Action exception - used when a controller action + * Private Action exception - used when a controller action * is protected, or starts with a `_`. * * @package cake.libs */ -class PrivateActionException extends CakeException { +class PrivateActionException extends CakeException { protected $_messageTemplate = 'Private Action %s::%s() is not directly accessible.'; public function __construct($message, $code = 404, Exception $previous = null) { @@ -243,7 +245,7 @@ class PrivateActionException extends CakeException { * * @package cake.libs */ -class MissingComponentFileException extends CakeException { +class MissingComponentFileException extends CakeException { protected $_messageTemplate = 'Component File "%s" is missing.'; } @@ -252,7 +254,7 @@ class MissingComponentFileException extends CakeException { * * @package cake.libs */ -class MissingComponentClassException extends CakeException { +class MissingComponentClassException extends CakeException { protected $_messageTemplate = 'Component class "%s" is missing.'; } @@ -275,7 +277,7 @@ class MissingBehaviorClassException extends CakeException { } * * @package cake.libs */ -class MissingViewException extends CakeException { +class MissingViewException extends CakeException { protected $_messageTemplate = 'View file "%s" is missing.'; } @@ -284,7 +286,7 @@ class MissingViewException extends CakeException { * * @package cake.libs */ -class MissingLayoutException extends CakeException { +class MissingLayoutException extends CakeException { protected $_messageTemplate = 'Layout file "%s" is missing.'; } @@ -293,7 +295,7 @@ class MissingLayoutException extends CakeException { * * @package cake.libs */ -class MissingHelperFileException extends CakeException { +class MissingHelperFileException extends CakeException { protected $_messageTemplate = 'Helper File "%s" is missing.'; } @@ -302,7 +304,7 @@ class MissingHelperFileException extends CakeException { * * @package cake.libs */ -class MissingHelperClassException extends CakeException { +class MissingHelperClassException extends CakeException { protected $_messageTemplate = 'Helper class "%s" is missing.'; } @@ -330,7 +332,7 @@ class MissingConnectionException extends CakeException { * * @package cake.libs */ -class MissingTaskFileException extends CakeException { +class MissingTaskFileException extends CakeException { protected $_messageTemplate = 'Task file "%s" is missing.'; } @@ -339,7 +341,7 @@ class MissingTaskFileException extends CakeException { * * @package cake.libs */ -class MissingTaskClassException extends CakeException { +class MissingTaskClassException extends CakeException { protected $_messageTemplate = 'Task class "%s" is missing.'; } @@ -348,7 +350,7 @@ class MissingTaskClassException extends CakeException { * * @package cake.libs */ -class MissingShellMethodException extends CakeException { +class MissingShellMethodException extends CakeException { protected $_messageTemplate = "Unknown command %1\$s %2\$s.\nFor usage try `cake %1\$s --help`"; } @@ -357,7 +359,7 @@ class MissingShellMethodException extends CakeException { * * @package cake.libs */ -class MissingShellClassException extends CakeException { +class MissingShellClassException extends CakeException { protected $_messageTemplate = "Shell class %s could not be loaded."; } @@ -366,7 +368,7 @@ class MissingShellClassException extends CakeException { * * @package cake.libs */ -class MissingShellFileException extends CakeException { +class MissingShellFileException extends CakeException { protected $_messageTemplate = "Shell file %s could not be loaded."; } @@ -479,4 +481,3 @@ class XmlException extends CakeException { } * @package cake.libs */ class ConsoleException extends CakeException { } - diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 7a7ed9128..ff4d77e59 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -1041,6 +1041,7 @@ class FormHelper extends AppHelper { public function radio($fieldName, $options = array(), $attributes = array()) { $attributes = $this->_initInputField($fieldName, $attributes); $legend = false; + $disabled = array(); if (isset($attributes['legend'])) { $legend = $attributes['legend']; @@ -1066,6 +1067,11 @@ class FormHelper extends AppHelper { } else { $value = $this->value($fieldName); } + + if (isset($attributes['disabled'])) { + $disabled = $attributes['disabled']; + } + $out = array(); $hiddenField = isset($attributes['hiddenField']) ? $attributes['hiddenField'] : true; @@ -1077,6 +1083,9 @@ class FormHelper extends AppHelper { if (isset($value) && $optValue == $value) { $optionsHere['checked'] = 'checked'; } + if (!empty($disabled) && in_array($optValue, $disabled)) { + $optionsHere['disabled'] = true; + } $tagName = Inflector::camelize( $attributes['id'] . '_' . Inflector::slug($optValue) ); diff --git a/lib/Cake/View/pages/home.ctp b/lib/Cake/View/pages/home.ctp index 57a7e1cc1..61912ad75 100644 --- a/lib/Cake/View/pages/home.ctp +++ b/lib/Cake/View/pages/home.ctp @@ -18,7 +18,7 @@ if (Configure::read('debug') == 0): throw new NotFoundException(); endif; -App::import('Core', 'Debugger'); +App::uses('Debugger', 'Utility'); ?>
@@ -71,16 +71,6 @@ endif; endif; ?> -'; - __d('cake', 'PCRE has not been compiled with Unicode support.'); - echo '--enable-unicode-properties
when configuring');
- echo '';
- }
-?>
+';
+ __('PCRE has not been compiled with Unicode support.');
+ echo '--enable-unicode-properties
when configuring');
+ echo '';
+ }
+?>