From d0dfd7f18c80fd8d279cac424e048c304665b82f Mon Sep 17 00:00:00 2001
From: mark_story
Date: Sat, 12 Mar 2011 11:10:31 -0500
Subject: [PATCH 01/18] Removing more calls to strtolower(). Instead type the
method names with the correct casing.
---
cake/libs/controller/components/security.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php
index 79977b799..7b1f6cac8 100644
--- a/cake/libs/controller/components/security.php
+++ b/cake/libs/controller/components/security.php
@@ -184,7 +184,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);
@@ -319,10 +319,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;
}
}
@@ -340,7 +340,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')) {
@@ -361,7 +361,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'] )) {
From 70d334f7eb11fdd55494d4e454f34e21ca0f7ddf Mon Sep 17 00:00:00 2001
From: mark_story
Date: Wed, 23 Feb 2011 11:15:52 -0500
Subject: [PATCH 02/18] Moving core cache configuration out of Configure and
into core.php. This makes the cache configurations cake uses internally more
transparent, and easier for the end developer to configure. Fixes #1586
---
app/config/core.php | 41 ++++++++++++++++++++++++++++++++++++++++-
cake/libs/configure.php | 37 -------------------------------------
2 files changed, 40 insertions(+), 38 deletions(-)
diff --git a/app/config/core.php b/app/config/core.php
index 9744da06c..18c3e3926 100644
--- a/app/config/core.php
+++ b/app/config/core.php
@@ -283,4 +283,43 @@
* ));
*
*/
- 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';
+}
+
+// Setup a 'default' cache configuration for use in the application.
+Cache::config('default', array('engine' => $engine));
+
+// 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/cake/libs/configure.php b/cake/libs/configure.php
index 5c4cc74b8..29633732c 100644
--- a/cake/libs/configure.php
+++ b/cake/libs/configure.php
@@ -73,43 +73,6 @@ class Configure {
trigger_error(__("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(__('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')) {
From 20299c9138ea635f6fde5da79cab7e9fed0d8008 Mon Sep 17 00:00:00 2001
From: mark_story
Date: Sat, 12 Mar 2011 12:06:10 -0500
Subject: [PATCH 03/18] Removing duplicate package string. Updating FileEngine
tests to use file_test config instead of inheriting 'default' as default
could be an APC config now. Removing tests that were testing clearCache(), as
that is not part of FileEngine's features.
---
cake/libs/cache/file.php | 2 -
cake/tests/cases/libs/cache/file.test.php | 164 +++++++---------------
2 files changed, 54 insertions(+), 112 deletions(-)
diff --git a/cake/libs/cache/file.php b/cake/libs/cache/file.php
index 46ff892a3..11bcf523c 100644
--- a/cake/libs/cache/file.php
+++ b/cake/libs/cache/file.php
@@ -13,7 +13,6 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package cake.libs.cache
* @since CakePHP(tm) v 1.2.0.4933
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@@ -21,7 +20,6 @@
/**
* File Storage engine for cache
*
- * @todo use the File and Folder classes (if it's not a too big performance hit)
* @package cake.libs.cache
*/
class FileEngine extends CacheEngine {
diff --git a/cake/tests/cases/libs/cache/file.test.php b/cake/tests/cases/libs/cache/file.test.php
index fb6741a7a..e38a09872 100644
--- a/cake/tests/cases/libs/cache/file.test.php
+++ b/cake/tests/cases/libs/cache/file.test.php
@@ -42,10 +42,9 @@ class FileEngineTest extends CakeTestCase {
* @return void
*/
function setUp() {
- $this->_cacheDisable = Configure::read('Cache.disable');
- $this->_cacheConfig = Cache::config('default');
+ parent::setUp();
Configure::write('Cache.disable', false);
- Cache::config('default', array('engine' => 'File', 'path' => CACHE));
+ Cache::config('file_test', array('engine' => 'File', 'path' => CACHE));
}
/**
@@ -55,9 +54,9 @@ class FileEngineTest extends CakeTestCase {
* @return void
*/
function tearDown() {
- Cache::clear(false, 'default');
- Configure::write('Cache.disable', $this->_cacheDisable);
- Cache::config('default', $this->_cacheConfig['settings']);
+ parent::tearDown();
+ Cache::clear(false, 'file_test');
+ Cache::drop('file_test');
}
/**
@@ -84,24 +83,24 @@ class FileEngineTest extends CakeTestCase {
function testReadAndWriteCache() {
Cache::config('default');
- $result = Cache::write(null, 'here');
+ $result = Cache::write(null, 'here', 'file_test');
$this->assertFalse($result);
- Cache::set(array('duration' => 1));
+ Cache::set(array('duration' => 1), 'file_test');
- $result = Cache::read('test');
+ $result = Cache::read('test', 'file_test');
$expecting = '';
$this->assertEqual($result, $expecting);
$data = 'this is a test of the emergency broadcasting system';
- $result = Cache::write('test', $data);
+ $result = Cache::write('test', $data, 'file_test');
$this->assertTrue(file_exists(CACHE . 'cake_test'));
- $result = Cache::read('test');
+ $result = Cache::read('test', 'file_test');
$expecting = $data;
$this->assertEqual($result, $expecting);
- Cache::delete('test');
+ Cache::delete('test', 'file_test');
}
/**
@@ -111,27 +110,27 @@ class FileEngineTest extends CakeTestCase {
* @return void
*/
function testExpiry() {
- Cache::set(array('duration' => 1));
+ Cache::set(array('duration' => 1), 'file_test');
- $result = Cache::read('test');
+ $result = Cache::read('test', 'file_test');
$this->assertFalse($result);
$data = 'this is a test of the emergency broadcasting system';
- $result = Cache::write('other_test', $data);
+ $result = Cache::write('other_test', $data, 'file_test');
$this->assertTrue($result);
sleep(2);
- $result = Cache::read('other_test');
+ $result = Cache::read('other_test', 'file_test');
$this->assertFalse($result);
- Cache::set(array('duration' => "+1 second"));
+ Cache::set(array('duration' => "+1 second"), 'file_test');
$data = 'this is a test of the emergency broadcasting system';
- $result = Cache::write('other_test', $data);
+ $result = Cache::write('other_test', $data, 'file_test');
$this->assertTrue($result);
sleep(2);
- $result = Cache::read('other_test');
+ $result = Cache::read('other_test', 'file_test');
$this->assertFalse($result);
}
@@ -143,14 +142,14 @@ class FileEngineTest extends CakeTestCase {
*/
function testDeleteCache() {
$data = 'this is a test of the emergency broadcasting system';
- $result = Cache::write('delete_test', $data);
+ $result = Cache::write('delete_test', $data, 'file_test');
$this->assertTrue($result);
- $result = Cache::delete('delete_test');
+ $result = Cache::delete('delete_test', 'file_test');
$this->assertTrue($result);
$this->assertFalse(file_exists(TMP . 'tests' . DS . 'delete_test'));
- $result = Cache::delete('delete_test');
+ $result = Cache::delete('delete_test', 'file_test');
$this->assertFalse($result);
}
@@ -161,17 +160,17 @@ class FileEngineTest extends CakeTestCase {
* @return void
*/
function testSerialize() {
- Cache::config('default', array('engine' => 'File', 'serialize' => true));
+ Cache::config('file_test', array('engine' => 'File', 'serialize' => true));
$data = 'this is a test of the emergency broadcasting system';
- $write = Cache::write('serialize_test', $data);
+ $write = Cache::write('serialize_test', $data, 'file_test');
$this->assertTrue($write);
- Cache::config('default', array('serialize' => false));
- $read = Cache::read('serialize_test');
+ Cache::config('file_test', array('serialize' => false));
+ $read = Cache::read('serialize_test', 'file_test');
- $newread = Cache::read('serialize_test');
+ $newread = Cache::read('serialize_test', 'file_test');
- $delete = Cache::delete('serialize_test');
+ $delete = Cache::delete('serialize_test', 'file_test');
$this->assertIdentical($read, serialize($data));
@@ -185,91 +184,35 @@ class FileEngineTest extends CakeTestCase {
* @return void
*/
function testClear() {
- Cache::config('default', array('engine' => 'File', 'duration' => 1));
+ Cache::config('file_test', array('engine' => 'File', 'duration' => 1));
+
$data = 'this is a test of the emergency broadcasting system';
- $write = Cache::write('serialize_test1', $data);
- $write = Cache::write('serialize_test2', $data);
- $write = Cache::write('serialize_test3', $data);
+ $write = Cache::write('serialize_test1', $data, 'file_test');
+ $write = Cache::write('serialize_test2', $data, 'file_test');
+ $write = Cache::write('serialize_test3', $data, 'file_test');
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
sleep(2);
- $result = Cache::clear(true);
+ $result = Cache::clear(true, 'file_test');
$this->assertTrue($result);
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test1'));
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test2'));
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test3'));
$data = 'this is a test of the emergency broadcasting system';
- $write = Cache::write('serialize_test1', $data);
- $write = Cache::write('serialize_test2', $data);
- $write = Cache::write('serialize_test3', $data);
+ $write = Cache::write('serialize_test1', $data, 'file_test');
+ $write = Cache::write('serialize_test2', $data, 'file_test');
+ $write = Cache::write('serialize_test3', $data, 'file_test');
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
- $result = Cache::clear();
+ $result = Cache::clear(false, 'file_test');
$this->assertTrue($result);
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test1'));
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test2'));
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test3'));
-
- Cache::config('default', array('engine' => 'File', 'path' => CACHE . 'views' . DS));
-
- $data = 'this is a test of the emergency broadcasting system';
- $write = Cache::write('controller_view_1', $data);
- $write = Cache::write('controller_view_2', $data);
- $write = Cache::write('controller_view_3', $data);
- $write = Cache::write('controller_view_10', $data);
- $write = Cache::write('controller_view_11', $data);
- $write = Cache::write('controller_view_12', $data);
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
-
- clearCache('controller_view_1', 'views', '');
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
-
- clearCache('controller_view', 'views', '');
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
-
- $write = Cache::write('controller_view_1', $data);
- $write = Cache::write('controller_view_2', $data);
- $write = Cache::write('controller_view_3', $data);
- $write = Cache::write('controller_view_10', $data);
- $write = Cache::write('controller_view_11', $data);
- $write = Cache::write('controller_view_12', $data);
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
-
- clearCache(array('controller_view_2', 'controller_view_11', 'controller_view_12'), 'views', '');
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
- $this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
- $this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
-
- clearCache('controller_view');
-
- Cache::config('default', array('engine' => 'File', 'path' => CACHE));
}
/**
@@ -290,14 +233,15 @@ class FileEngineTest extends CakeTestCase {
));
$data1 = $data2 = $expected = 'content to cache';
- $FileOne->write('key_one', $data1, DAY);
- $FileTwo->write('key_two', $data2, DAY);
+ $FileOne->write('prefix_one_key_one', $data1, DAY);
+ $FileTwo->write('prefix_two_key_two', $data2, DAY);
- $this->assertEqual($FileOne->read('key_one'), $expected);
- $this->assertEqual($FileTwo->read('key_two'), $expected);
+ $this->assertEqual($FileOne->read('prefix_one_key_one'), $expected);
+ $this->assertEqual($FileTwo->read('prefix_two_key_two'), $expected);
$FileOne->clear(false);
- $this->assertEqual($FileTwo->read('key_two'), $expected, 'secondary config was cleared by accident.');
+ $this->assertEqual($FileTwo->read('prefix_two_key_two'), $expected, 'secondary config was cleared by accident.');
+ $FileTwo->clear(false);
}
/**
@@ -307,11 +251,11 @@ class FileEngineTest extends CakeTestCase {
* @return void
*/
function testKeyPath() {
- $result = Cache::write('views.countries.something', 'here');
+ $result = Cache::write('views.countries.something', 'here', 'file_test');
$this->assertTrue($result);
$this->assertTrue(file_exists(CACHE . 'cake_views_countries_something'));
- $result = Cache::read('views.countries.something');
+ $result = Cache::read('views.countries.something', 'file_test');
$this->assertEqual($result, 'here');
$result = Cache::clear();
@@ -371,16 +315,16 @@ class FileEngineTest extends CakeTestCase {
* @return void
*/
function testWriteQuotedString() {
- Cache::config('default', array('engine' => 'File', 'path' => TMP . 'tests'));
- Cache::write('App.doubleQuoteTest', '"this is a quoted string"');
- $this->assertIdentical(Cache::read('App.doubleQuoteTest'), '"this is a quoted string"');
- Cache::write('App.singleQuoteTest', "'this is a quoted string'");
- $this->assertIdentical(Cache::read('App.singleQuoteTest'), "'this is a quoted string'");
+ Cache::config('file_test', array('engine' => 'File', 'path' => TMP . 'tests'));
+ Cache::write('App.doubleQuoteTest', '"this is a quoted string"', 'file_test');
+ $this->assertIdentical(Cache::read('App.doubleQuoteTest', 'file_test'), '"this is a quoted string"');
+ Cache::write('App.singleQuoteTest', "'this is a quoted string'", 'file_test');
+ $this->assertIdentical(Cache::read('App.singleQuoteTest', 'file_test'), "'this is a quoted string'");
- Cache::config('default', array('isWindows' => true, 'path' => TMP . 'tests'));
- $this->assertIdentical(Cache::read('App.doubleQuoteTest'), '"this is a quoted string"');
- Cache::write('App.singleQuoteTest', "'this is a quoted string'");
- $this->assertIdentical(Cache::read('App.singleQuoteTest'), "'this is a quoted string'");
+ Cache::config('file_test', array('isWindows' => true, 'path' => TMP . 'tests'));
+ $this->assertIdentical(Cache::read('App.doubleQuoteTest', 'file_test'), '"this is a quoted string"');
+ Cache::write('App.singleQuoteTest', "'this is a quoted string'", 'file_test');
+ $this->assertIdentical(Cache::read('App.singleQuoteTest', 'file_test'), "'this is a quoted string'");
}
/**
From 31e82b08df86064e669c057a79debfa5a9642daa Mon Sep 17 00:00:00 2001
From: mark_story
Date: Sat, 12 Mar 2011 12:14:43 -0500
Subject: [PATCH 04/18] More documentation for Cache.
---
cake/libs/cache.php | 14 ++++++++++++--
cake/libs/cache/file.php | 5 ++++-
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/cake/libs/cache.php b/cake/libs/cache.php
index 66f255b34..e0b627b15 100644
--- a/cake/libs/cache.php
+++ b/cake/libs/cache.php
@@ -71,14 +71,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/cake/libs/cache/file.php b/cake/libs/cache/file.php
index 11bcf523c..f6db44d09 100644
--- a/cake/libs/cache/file.php
+++ b/cake/libs/cache/file.php
@@ -1,7 +1,10 @@
Date: Sat, 12 Mar 2011 12:18:21 -0500
Subject: [PATCH 05/18] Moving the default cache configuration to
app/config/bootstrap.php, as its not used by CakePHP anymore, and is an
application configuration value.
---
app/config/bootstrap.php | 12 +++++++++---
app/config/core.php | 3 ---
2 files changed, 9 insertions(+), 6 deletions(-)
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 18c3e3926..3a7613b85 100644
--- a/app/config/core.php
+++ b/app/config/core.php
@@ -290,9 +290,6 @@ if (extension_loaded('apc')) {
$engine = 'Apc';
}
-// Setup a 'default' cache configuration for use in the application.
-Cache::config('default', array('engine' => $engine));
-
// In development mode, caches should expire quickly.
$duration = '+999 days';
if (Configure::read('debug') >= 1) {
From 30a9543a65c95d9eb07feae0aebde97b9b1ca6eb Mon Sep 17 00:00:00 2001
From: mark_story
Date: Sat, 12 Mar 2011 12:19:06 -0500
Subject: [PATCH 06/18] Syncing skel folder with app folder.
---
.../templates/skel/config/bootstrap.php | 14 +++++--
cake/console/templates/skel/config/core.php | 38 ++++++++++++++++++-
2 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/cake/console/templates/skel/config/bootstrap.php b/cake/console/templates/skel/config/bootstrap.php
index 697274852..2e36a893e 100644
--- a/cake/console/templates/skel/config/bootstrap.php
+++ b/cake/console/templates/skel/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)
@@ -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/cake/console/templates/skel/config/core.php b/cake/console/templates/skel/config/core.php
index 9744da06c..3a7613b85 100644
--- a/cake/console/templates/skel/config/core.php
+++ b/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
+));
+
From b9ec7da21df75be54ce58c48145d329c0ea51495 Mon Sep 17 00:00:00 2001
From: mark_story
Date: Sun, 13 Mar 2011 19:35:37 -0400
Subject: [PATCH 07/18] Applying patch from 'NaMB' to add disabled support to
FormHelper::radio(). Test cases added as well. Fixes #1459
---
cake/libs/view/helpers/form.php | 9 ++++++
.../cases/libs/view/helpers/form.test.php | 29 +++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php
index 7b0b29b93..00ec12351 100644
--- a/cake/libs/view/helpers/form.php
+++ b/cake/libs/view/helpers/form.php
@@ -1039,6 +1039,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'];
@@ -1064,6 +1065,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;
@@ -1075,6 +1081,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/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php
index 532476960..d8ccbf617 100644
--- a/cake/tests/cases/libs/view/helpers/form.test.php
+++ b/cake/tests/cases/libs/view/helpers/form.test.php
@@ -3012,6 +3012,35 @@ class FormHelperTest extends CakeTestCase {
$this->assertTags($result, $expected);
}
+/**
+ * test disabled radio options
+ *
+ * @return void
+ */
+ function testRadioDisabled() {
+ $result = $this->Form->radio(
+ 'Model.field',
+ array('option A', 'option B'),
+ array('disabled' => array('option A'), 'value' => 'option A')
+ );
+ $expected = array(
+ 'fieldset' => array(),
+ 'legend' => array(),
+ 'Field',
+ '/legend',
+ array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'ModelField0', 'disabled' => 'disabled', 'checked' => 'checked')),
+ array('label' => array('for' => 'ModelField0')),
+ 'option A',
+ '/label',
+ array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'value' => '1', 'id' => 'ModelField1')),
+ array('label' => array('for' => 'ModelField1')),
+ 'option B',
+ '/label',
+ '/fieldset'
+ );
+ $this->assertTags($result, $expected);
+ }
+
/**
* test disabling the hidden input for radio buttons
*
From 6fd5ff34a0efc2862008ae3c3cb33b7e1ccbda96 Mon Sep 17 00:00:00 2001
From: mark_story
Date: Mon, 14 Mar 2011 21:13:24 -0400
Subject: [PATCH 08/18] Fixing incorrect test case. Thanks to hiromi2424 for
pointing out the mistake.
---
cake/tests/cases/libs/cache.test.php | 2 +-
cake/tests/test_app/libs/cache/test_app_cache.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cake/tests/cases/libs/cache.test.php b/cake/tests/cases/libs/cache.test.php
index 106fd3913..644672de3 100644
--- a/cake/tests/cases/libs/cache.test.php
+++ b/cake/tests/cases/libs/cache.test.php
@@ -315,7 +315,7 @@ class CacheTest extends CakeTestCase {
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
), true);
- Cache::config('test_trigger', array('engine' => 'TestAppCache'));
+ Cache::config('test_trigger', array('engine' => 'TestAppCache', 'prefix' => ''));
try {
Cache::write('fail', 'value', 'test_trigger');
$this->fail('No exception thrown');
diff --git a/cake/tests/test_app/libs/cache/test_app_cache.php b/cake/tests/test_app/libs/cache/test_app_cache.php
index 1a8a47ac0..86b7688fb 100644
--- a/cake/tests/test_app/libs/cache/test_app_cache.php
+++ b/cake/tests/test_app/libs/cache/test_app_cache.php
@@ -19,7 +19,7 @@
class TestAppCacheEngine extends CacheEngine {
public function write($key, $value, $duration) {
- if ($key = 'fail') {
+ if ($key == 'fail') {
return false;
}
}
From b6b03cb37971fa147010e172d854e2903aa18255 Mon Sep 17 00:00:00 2001
From: Jose Lorenzo Rodriguez
Date: Tue, 15 Mar 2011 21:13:33 -0400
Subject: [PATCH 09/18] Adding files missing from previous commit
---
.../libs/Utility/TestUtilityClass.php | 19 +++++++++++++++++++
.../libs/Custom/Package/CustomLibClass.php | 19 +++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 lib/Cake/tests/test_app/libs/Utility/TestUtilityClass.php
create mode 100644 lib/Cake/tests/test_app/plugins/test_plugin/libs/Custom/Package/CustomLibClass.php
diff --git a/lib/Cake/tests/test_app/libs/Utility/TestUtilityClass.php b/lib/Cake/tests/test_app/libs/Utility/TestUtilityClass.php
new file mode 100644
index 000000000..6d4e021f6
--- /dev/null
+++ b/lib/Cake/tests/test_app/libs/Utility/TestUtilityClass.php
@@ -0,0 +1,19 @@
+
+ * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @package cake.tests.cases.libs
+ * @since CakePHP(tm) v 1.3
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+class TestUtilityClass {}
diff --git a/lib/Cake/tests/test_app/plugins/test_plugin/libs/Custom/Package/CustomLibClass.php b/lib/Cake/tests/test_app/plugins/test_plugin/libs/Custom/Package/CustomLibClass.php
new file mode 100644
index 000000000..70c86ff40
--- /dev/null
+++ b/lib/Cake/tests/test_app/plugins/test_plugin/libs/Custom/Package/CustomLibClass.php
@@ -0,0 +1,19 @@
+
+ * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @package cake.tests.cases.libs
+ * @since CakePHP(tm) v 1.2.0.5432
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+class CustomLibClass {}
From bd2bd4ba2254dace9de1edee7ac8d1cb121eff6e Mon Sep 17 00:00:00 2001
From: Jose Lorenzo Rodriguez
Date: Tue, 15 Mar 2011 21:53:42 -0400
Subject: [PATCH 10/18] Udating skel directory, doc blocs and the location of
the Console package
---
lib/Cake/Console/AppShell.php | 2 +-
.../skel/{app_controller.php => controllers/AppController.php} | 0
.../controllers/{pages_controller.php => PagesController.php} | 0
.../templates/skel/{app_model.php => models/AppModel.php} | 0
.../skel/{app_helper.php => views/helpers/AppHelper.php} | 0
lib/Cake/Core/App.php | 2 +-
6 files changed, 2 insertions(+), 2 deletions(-)
rename lib/Cake/Console/templates/skel/{app_controller.php => controllers/AppController.php} (100%)
rename lib/Cake/Console/templates/skel/controllers/{pages_controller.php => PagesController.php} (100%)
rename lib/Cake/Console/templates/skel/{app_model.php => models/AppModel.php} (100%)
rename lib/Cake/Console/templates/skel/{app_helper.php => views/helpers/AppHelper.php} (100%)
diff --git a/lib/Cake/Console/AppShell.php b/lib/Cake/Console/AppShell.php
index a624a31ad..ca3abc8ed 100644
--- a/lib/Cake/Console/AppShell.php
+++ b/lib/Cake/Console/AppShell.php
@@ -19,7 +19,7 @@
/**
* This is a placeholder class.
- * Create the same file in app/console/shells/app_shell.php
+ * Create the same file in app/console/shells/AppShell.php
*
* Add your application-wide methods in the class below, your shells
* will inherit them.
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 100%
rename from lib/Cake/Console/templates/skel/app_helper.php
rename to lib/Cake/Console/templates/skel/views/helpers/AppHelper.php
diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php
index 07aea99ef..b8cd6b50c 100644
--- a/lib/Cake/Core/App.php
+++ b/lib/Cake/Core/App.php
@@ -243,7 +243,7 @@ class App {
'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
),
From b0a7a109e9197174aed01527e8482eafb134ac98 Mon Sep 17 00:00:00 2001
From: Jose Lorenzo Rodriguez
Date: Tue, 15 Mar 2011 22:14:10 -0400
Subject: [PATCH 11/18] Updating ModelTask to crete files following the new
namings
---
lib/Cake/Console/Command/Task/ModelTask.php | 2 +-
.../templates/default/classes/test.ctp | 2 +-
.../cases/console/shells/tasks/model.test.php | 32 +++++++++----------
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/lib/Cake/Console/Command/Task/ModelTask.php b/lib/Cake/Console/Command/Task/ModelTask.php
index 1cfd0eac4..7725519c7 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/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/tests/cases/console/shells/tasks/model.test.php b/lib/Cake/tests/cases/console/shells/tasks/model.test.php
index 470496e06..5ebf1367b 100644
--- a/lib/Cake/tests/cases/console/shells/tasks/model.test.php
+++ b/lib/Cake/tests/cases/console/shells/tasks/model.test.php
@@ -745,7 +745,7 @@ STRINGEND;
public function testBakeWithPlugin() {
$this->Task->plugin = 'controllerTest';
- $path = APP . 'plugins' . DS . 'controller_test' . DS . 'models' . DS . 'bake_article.php';
+ $path = APP . 'plugins' . DS . 'controller_test' . DS . 'models' . DS . 'BakeArticle.php';
$this->Task->expects($this->once())->method('createFile')
->with($path, new PHPUnit_Framework_Constraint_PCREMatch('/BakeArticle extends ControllerTestAppModel/'));
@@ -763,8 +763,8 @@ STRINGEND;
public function testExecuteWithNamedModel() {
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';
- $this->Task->args = array('bake_article');
- $filename = '/my/path/bake_article.php';
+ $this->Task->args = array('BakeArticle');
+ $filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1));
$this->Task->expects($this->once())->method('createFile')
@@ -799,7 +799,7 @@ STRINGEND;
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1));
$this->Task->args = array($name);
- $filename = '/my/path/bake_article.php';
+ $filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->at(0))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle extends AppModel/'));
@@ -814,8 +814,8 @@ STRINGEND;
public function testExecuteWithNamedModelHasManyCreated() {
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';
- $this->Task->args = array('bake_article');
- $filename = '/my/path/bake_article.php';
+ $this->Task->args = array('BakeArticle');
+ $filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1));
$this->Task->expects($this->at(0))->method('createFile')
@@ -843,23 +843,23 @@ STRINGEND;
$this->Task->Fixture->expects($this->exactly(5))->method('bake');
$this->Task->Test->expects($this->exactly(5))->method('bake');
- $filename = '/my/path/bake_article.php';
+ $filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->at(1))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle/'));
- $filename = '/my/path/bake_articles_bake_tag.php';
+ $filename = '/my/path/BakeArticlesBakeTag.php';
$this->Task->expects($this->at(2))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesBakeTag/'));
- $filename = '/my/path/bake_comment.php';
+ $filename = '/my/path/BakeComment.php';
$this->Task->expects($this->at(3))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeComment/'));
- $filename = '/my/path/bake_tag.php';
+ $filename = '/my/path/BakeTag.php';
$this->Task->expects($this->at(4))
->method('createFile')->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeTag/'));
- $filename = '/my/path/category_thread.php';
+ $filename = '/my/path/CategoryThread.php';
$this->Task->expects($this->at(5))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class CategoryThread/'));
@@ -889,19 +889,19 @@ STRINGEND;
$this->Task->Fixture->expects($this->exactly(4))->method('bake');
$this->Task->Test->expects($this->exactly(4))->method('bake');
- $filename = '/my/path/bake_article.php';
+ $filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->at(1))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle/'));
- $filename = '/my/path/bake_articles_bake_tag.php';
+ $filename = '/my/path/BakeArticlesBakeTag.php';
$this->Task->expects($this->at(2))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesBakeTag/'));
- $filename = '/my/path/bake_comment.php';
+ $filename = '/my/path/BakeComment.php';
$this->Task->expects($this->at(3))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeComment/'));
- $filename = '/my/path/category_thread.php';
+ $filename = '/my/path/CategoryThread.php';
$this->Task->expects($this->at(4))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class CategoryThread/'));
@@ -939,7 +939,7 @@ STRINGEND;
$this->Task->Test->expects($this->once())->method('bake');
$this->Task->Fixture->expects($this->once())->method('bake');
- $filename = '/my/path/bake_article.php';
+ $filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->once())->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle/'));
From 9293361562ccc69b83d24b08cfe6145ba6ebb6f6 Mon Sep 17 00:00:00 2001
From: Jose Lorenzo Rodriguez
Date: Tue, 15 Mar 2011 22:23:51 -0400
Subject: [PATCH 12/18] Updating ControllerTask to crete files with new naming
conventions
---
.../Console/Command/Task/ControllerTask.php | 5 ++---
lib/Cake/Console/Shell.php | 2 +-
.../console/shells/tasks/controller.test.php | 20 +++++++++----------
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/lib/Cake/Console/Command/Task/ControllerTask.php b/lib/Cake/Console/Command/Task/ControllerTask.php
index e7d7995b2..5e7d0a22d 100644
--- a/lib/Cake/Console/Command/Task/ControllerTask.php
+++ b/lib/Cake/Console/Command/Task/ControllerTask.php
@@ -143,10 +143,9 @@ class ControllerTask extends BakeTask {
$useDynamicScaffold = 'n';
$wannaBakeCrud = 'y';
- $controllerFile = strtolower(Inflector::underscore($controllerName));
$question[] = __("Would you like to build your controller interactively?");
- if (file_exists($this->path . $controllerFile .'_controller.php')) {
+ if (file_exists($this->path . $controllerName .'Controller.php')) {
$question[] = __("Warning: Choosing no will overwrite the %sController.", $controllerName);
}
$doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y');
@@ -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->_controllerPath($controllerName) . 'Controller.php';
if ($this->createFile($filename, $contents)) {
return $contents;
}
diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php
index 31b64433f..45600234e 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::camelize($name);
}
/**
diff --git a/lib/Cake/tests/cases/console/shells/tasks/controller.test.php b/lib/Cake/tests/cases/console/shells/tasks/controller.test.php
index 19b16df02..a03f82066 100644
--- a/lib/Cake/tests/cases/console/shells/tasks/controller.test.php
+++ b/lib/Cake/tests/cases/console/shells/tasks/controller.test.php
@@ -299,7 +299,7 @@ class ControllerTaskTest extends CakeTestCase {
$components = array('Acl', 'Auth');
$uses = array('Comment', 'User');
- $path = APP . 'plugins' . DS . 'controller_test' . DS . 'controllers' . DS . 'articles_controller.php';
+ $path = APP . 'plugins' . DS . 'controller_test' . DS . 'controllers' . DS . 'ArticlesController.php';
$this->Task->expects($this->at(1))->method('createFile')->with(
$path,
@@ -313,7 +313,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->bake('Articles', '--actions--', array(), array(), array());
$this->Task->plugin = 'controllerTest';
- $path = APP . 'plugins' . DS . 'controller_test' . DS . 'controllers' . DS . 'articles_controller.php';
+ $path = APP . 'plugins' . DS . 'controller_test' . DS . 'controllers' . DS . 'ArticlesController.php';
$this->Task->bake('Articles', '--actions--', array(), array(), array());
$this->assertEqual($this->Task->Template->templateVars['plugin'], 'ControllerTest');
@@ -442,7 +442,7 @@ class ControllerTaskTest extends CakeTestCase {
'y' // looks good?
));
- $filename = '/my/path/bake_articles_controller.php';
+ $filename = '/my/path/BakeArticlesController.php';
$this->Task->expects($this->once())->method('createFile')->with(
$filename,
new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesController/')
@@ -482,7 +482,7 @@ class ControllerTaskTest extends CakeTestCase {
->method('getPrefix')
->will($this->returnValue('admin_'));
- $filename = '/my/path/bake_articles_controller.php';
+ $filename = '/my/path/BakeArticlesController.php';
$this->Task->expects($this->once())->method('createFile')->with(
$filename,
new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesController/')
@@ -512,7 +512,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->expects($this->any())->method('_checkUnitTest')->will($this->returnValue(true));
$this->Task->Test->expects($this->once())->method('bake');
- $filename = '/my/path/bake_articles_controller.php';
+ $filename = '/my/path/BakeArticlesController.php';
$this->Task->expects($this->once())->method('createFile')->with(
$filename,
new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesController/')
@@ -534,7 +534,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->path = '/my/path/';
$this->Task->args = array('BakeArticles');
- $filename = '/my/path/bake_articles_controller.php';
+ $filename = '/my/path/BakeArticlesController.php';
$this->Task->expects($this->once())->method('createFile')->with(
$filename,
new PHPUnit_Framework_Constraint_PCREMatch('/\$scaffold/')
@@ -568,7 +568,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->path = '/my/path/';
$this->Task->args = array($name);
- $filename = '/my/path/bake_articles_controller.php';
+ $filename = '/my/path/BakeArticlesController.php';
$this->Task->expects($this->once())->method('createFile')->with(
$filename, new PHPUnit_Framework_Constraint_PCREMatch('/\$scaffold/')
);
@@ -589,7 +589,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->args = array('BakeArticles');
$this->Task->params = array('public' => true);
- $filename = '/my/path/bake_articles_controller.php';
+ $filename = '/my/path/BakeArticlesController.php';
$expected = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_PCREMatch('/\$scaffold/'));
$this->Task->expects($this->once())->method('createFile')->with(
$filename, $expected
@@ -612,7 +612,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->args = array('BakeArticles');
$this->Task->params = array('public' => true, 'admin' => true);
- $filename = '/my/path/bake_articles_controller.php';
+ $filename = '/my/path/BakeArticlesController.php';
$this->Task->expects($this->once())->method('createFile')->with(
$filename, new PHPUnit_Framework_Constraint_PCREMatch('/admin_index/')
);
@@ -634,7 +634,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->args = array('BakeArticles');
$this->Task->params = array('admin' => true);
- $filename = '/my/path/bake_articles_controller.php';
+ $filename = '/my/path/BakeArticlesController.php';
$this->Task->expects($this->once())->method('createFile')->with(
$filename, new PHPUnit_Framework_Constraint_PCREMatch('/admin_index/')
);
From a1f5fe706a8ad163dae093df7f79fcd3baa7b290 Mon Sep 17 00:00:00 2001
From: Jose Lorenzo Rodriguez
Date: Tue, 15 Mar 2011 22:59:18 -0400
Subject: [PATCH 13/18] Udatint TestTask test
---
lib/Cake/tests/cases/console/shells/tasks/test.test.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/Cake/tests/cases/console/shells/tasks/test.test.php b/lib/Cake/tests/cases/console/shells/tasks/test.test.php
index 3de416b8e..f6e8376e1 100644
--- a/lib/Cake/tests/cases/console/shells/tasks/test.test.php
+++ b/lib/Cake/tests/cases/console/shells/tasks/test.test.php
@@ -437,7 +437,7 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->bake('Model', 'TestTaskArticle');
- $this->assertContains("App::import('Model', 'TestTaskArticle')", $result);
+ $this->assertContains("App::uses('TestTaskArticle', 'Model')", $result);
$this->assertContains('class TestTaskArticleTestCase extends CakeTestCase', $result);
$this->assertContains('function setUp()', $result);
@@ -468,7 +468,7 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->bake('Controller', 'TestTaskComments');
- $this->assertContains("App::import('Controller', 'TestTaskComments')", $result);
+ $this->assertContains("App::uses('TestTaskCommentsController', 'Controller')", $result);
$this->assertContains('class TestTaskCommentsControllerTestCase extends CakeTestCase', $result);
$this->assertContains('class TestTestTaskCommentsController extends TestTaskCommentsController', $result);
From 8213160bb117ad4f5f4935f9898380801f04e1c9 Mon Sep 17 00:00:00 2001
From: Jose Lorenzo Rodriguez
Date: Tue, 15 Mar 2011 23:48:51 -0400
Subject: [PATCH 14/18] Udating template home.ctp and providing a default skel
dir in tamplate task
---
app/webroot/index.php | 2 +-
lib/Cake/Console/Command/Task/ProjectTask.php | 9 +---
.../Console/templates/default/views/home.ctp | 47 ++++++++++++-------
.../Console/templates/skel/webroot/index.php | 6 +--
lib/Cake/View/pages/home.ctp | 22 ++++-----
5 files changed, 45 insertions(+), 41 deletions(-)
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/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php
index addf35a00..19bd4ac01 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 = __("What is the full path for this app including the app directory name?\n Example:");
$default = APP_PATH . 'myapp';
@@ -387,6 +379,7 @@ class ProjectTask extends Shell {
))->addOption('empty', array(
'help' => __('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' => __('The directory layout to use for the new application skeleton. Defaults to cake/console/templates/skel of CakePHP used to create the project.')
));
}
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 = "Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!
\n";
$output .="
0):
Debugger::checkSecurityKeys();
endif;
@@ -52,27 +52,38 @@ endif;
?>
getDataSource('default');
?>
+ 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 .= "\n";
$output .= "\n";
$output .= "dispatch(new CakeRequest());
diff --git a/lib/Cake/View/pages/home.ctp b/lib/Cake/View/pages/home.ctp
index 4c51432de..96aa8dfad 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;
?>
-';
- __('PCRE has not been compiled with Unicode support.');
- echo '
';
- __('Recompile PCRE with Unicode support by adding --enable-unicode-properties
when configuring');
- echo '';
- }
-?>
+';
+ __('PCRE has not been compiled with Unicode support.');
+ echo '
';
+ __('Recompile PCRE with Unicode support by adding --enable-unicode-properties
when configuring');
+ echo '';
+ }
+?>
Date: Tue, 15 Mar 2011 23:54:38 -0400
Subject: [PATCH 15/18] Updating more skel files
---
lib/Cake/Console/templates/skel/views/helpers/AppHelper.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Cake/Console/templates/skel/views/helpers/AppHelper.php b/lib/Cake/Console/templates/skel/views/helpers/AppHelper.php
index 8bb93af44..6689abcba 100644
--- a/lib/Cake/Console/templates/skel/views/helpers/AppHelper.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.
From 3f7928fccc36561d5e64d3d6be2c54fc56b2d9b0 Mon Sep 17 00:00:00 2001
From: Jose Lorenzo Rodriguez
Date: Wed, 16 Mar 2011 00:14:37 -0400
Subject: [PATCH 16/18] Changing paths againg form datasources sub packages,
Updating database.php.default file Fixing view generation task
---
app/config/database.php.default | 18 ++++++-------
.../Console/Command/Task/ControllerTask.php | 2 +-
lib/Cake/Console/Shell.php | 2 +-
.../skel/config/database.php.default | 27 +++++++++----------
lib/Cake/Core/App.php | 4 +--
.../TestLocalDriver.php | 0
.../TestAppLibSession.php | 0
.../{Database => database}/DboDummy.php | 0
.../{Database => database}/TestDriver.php | 0
.../TestPluginSession.php | 0
10 files changed, 26 insertions(+), 27 deletions(-)
rename lib/Cake/tests/test_app/models/datasources/{Database => database}/TestLocalDriver.php (100%)
rename lib/Cake/tests/test_app/models/datasources/{Session => session}/TestAppLibSession.php (100%)
rename lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/{Database => database}/DboDummy.php (100%)
rename lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/{Database => database}/TestDriver.php (100%)
rename lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/{Session => session}/TestPluginSession.php (100%)
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/lib/Cake/Console/Command/Task/ControllerTask.php b/lib/Cake/Console/Command/Task/ControllerTask.php
index 5e7d0a22d..e621742f9 100644
--- a/lib/Cake/Console/Command/Task/ControllerTask.php
+++ b/lib/Cake/Console/Command/Task/ControllerTask.php
@@ -314,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->_controllerName($controllerName) . 'Controller.php';
if ($this->createFile($filename, $contents)) {
return $contents;
}
diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php
index 45600234e..892c065ca 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 Inflector::camelize($name);
+ return Inflector::underscore($name);
}
/**
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/Core/App.php b/lib/Cake/Core/App.php
index b8cd6b50c..a257b051f 100644
--- a/lib/Cake/Core/App.php
+++ b/lib/Cake/Core/App.php
@@ -236,8 +236,8 @@ 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),
diff --git a/lib/Cake/tests/test_app/models/datasources/Database/TestLocalDriver.php b/lib/Cake/tests/test_app/models/datasources/database/TestLocalDriver.php
similarity index 100%
rename from lib/Cake/tests/test_app/models/datasources/Database/TestLocalDriver.php
rename to lib/Cake/tests/test_app/models/datasources/database/TestLocalDriver.php
diff --git a/lib/Cake/tests/test_app/models/datasources/Session/TestAppLibSession.php b/lib/Cake/tests/test_app/models/datasources/session/TestAppLibSession.php
similarity index 100%
rename from lib/Cake/tests/test_app/models/datasources/Session/TestAppLibSession.php
rename to lib/Cake/tests/test_app/models/datasources/session/TestAppLibSession.php
diff --git a/lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/Database/DboDummy.php b/lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/database/DboDummy.php
similarity index 100%
rename from lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/Database/DboDummy.php
rename to lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/database/DboDummy.php
diff --git a/lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/Database/TestDriver.php b/lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/database/TestDriver.php
similarity index 100%
rename from lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/Database/TestDriver.php
rename to lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/database/TestDriver.php
diff --git a/lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/Session/TestPluginSession.php b/lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/session/TestPluginSession.php
similarity index 100%
rename from lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/Session/TestPluginSession.php
rename to lib/Cake/tests/test_app/plugins/test_plugin/models/datasources/session/TestPluginSession.php
From 8ce605ab888bf7e1aab7b7f5f54c31ae0e55bac9 Mon Sep 17 00:00:00 2001
From: Jose Lorenzo Rodriguez
Date: Wed, 16 Mar 2011 00:28:08 -0400
Subject: [PATCH 17/18] Fix for regression introduced in last commit
---
lib/Cake/Console/Command/Task/ControllerTask.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Cake/Console/Command/Task/ControllerTask.php b/lib/Cake/Console/Command/Task/ControllerTask.php
index e621742f9..cdea1e1d5 100644
--- a/lib/Cake/Console/Command/Task/ControllerTask.php
+++ b/lib/Cake/Console/Command/Task/ControllerTask.php
@@ -314,7 +314,7 @@ class ControllerTask extends BakeTask {
$contents = $this->Template->generate('classes', 'controller');
$path = $this->getPath();
- $filename = $path . $this->_controllerName($controllerName) . 'Controller.php';
+ $filename = $path . $this->_controllerNames($controllerName) . 'Controller.php';
if ($this->createFile($filename, $contents)) {
return $contents;
}
From 4f29f58a5e9689adda104d77edf2c0cfe5101cd1 Mon Sep 17 00:00:00 2001
From: AD7six
Date: Wed, 16 Mar 2011 12:13:47 +0100
Subject: [PATCH 18/18] correct path to tmp and core.php file when running
outside your app dir.
also wrapped HttpException class declaraion in an if !class_exists test
- the class exists in the pecl http extension.
---
lib/Cake/Console/ShellDispatcher.php | 10 +++----
lib/Cake/Error/exceptions.php | 41 ++++++++++++++--------------
2 files changed, 26 insertions(+), 25 deletions(-)
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/Error/exceptions.php b/lib/Cake/Error/exceptions.php
index d1a941594..232379d02 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 { }
-