Permalink
Browse files

Merge branch '2.3' into calinseciu-2.3

  • Loading branch information...
2 parents 3ca4d23 + 7d84486 commit 7007dba0eb836f852aaca95fada103bc4ba993a9 @ceeram ceeram committed Nov 2, 2012
Showing with 3,964 additions and 2,117 deletions.
  1. +18 −18 app/Config/acl.php
  2. +1 −1 app/Config/bootstrap.php
  3. +2 −2 app/Config/core.php
  4. +2 −2 app/Config/routes.php
  5. +13 −10 app/Console/cake
  6. +1 −1 app/webroot/index.php
  7. +3 −3 lib/Cake/Cache/Cache.php
  8. +2 −3 lib/Cake/Cache/Engine/ApcEngine.php
  9. +4 −0 lib/Cake/Cache/Engine/RedisEngine.php
  10. +1 −0 lib/Cake/Cache/Engine/WincacheEngine.php
  11. +11 −3 lib/Cake/Configure/IniReader.php
  12. +1 −1 lib/Cake/Console/Command/AclShell.php
  13. +5 −4 lib/Cake/Console/Command/ApiShell.php
  14. +7 −7 lib/Cake/Console/Command/ConsoleShell.php
  15. +2 −0 lib/Cake/Console/Command/ServerShell.php
  16. +5 −5 lib/Cake/Console/Command/Task/ControllerTask.php
  17. +17 −18 lib/Cake/Console/Command/Task/DbConfigTask.php
  18. +5 −5 lib/Cake/Console/Command/Task/ExtractTask.php
  19. +15 −18 lib/Cake/Console/Command/Task/ModelTask.php
  20. +4 −7 lib/Cake/Console/Command/Task/ProjectTask.php
  21. +2 −2 lib/Cake/Console/Command/Task/TemplateTask.php
  22. +4 −3 lib/Cake/Console/Command/Task/TestTask.php
  23. +2 −2 lib/Cake/Console/Command/Task/ViewTask.php
  24. +5 −1 lib/Cake/Console/ConsoleErrorHandler.php
  25. +5 −5 lib/Cake/Console/Shell.php
  26. +9 −4 lib/Cake/Console/ShellDispatcher.php
  27. +6 −6 lib/Cake/Console/Templates/default/actions/controller_actions.ctp
  28. +4 −6 lib/Cake/Console/Templates/default/views/index.ctp
  29. +2 −2 lib/Cake/Console/Templates/skel/Config/bootstrap.php
  30. +1 −1 lib/Cake/Console/Templates/skel/Config/core.php
  31. +1 −1 lib/Cake/Console/Templates/skel/Config/routes.php
  32. +18 −14 lib/Cake/Console/Templates/skel/Console/cake
  33. +1 −1 lib/Cake/Console/Templates/skel/View/Errors/error400.ctp
  34. +1 −1 lib/Cake/Console/Templates/skel/View/Errors/error500.ctp
  35. +1 −1 lib/Cake/Console/Templates/skel/View/Pages/home.ctp
  36. +1 −1 lib/Cake/Console/Templates/skel/webroot/index.php
  37. +1 −1 lib/Cake/Console/Templates/skel/webroot/test.php
  38. +12 −8 lib/Cake/Console/cake
  39. +5 −1 lib/Cake/Controller/CakeErrorController.php
  40. +1 −1 lib/Cake/Controller/Component/Acl/IniAcl.php
  41. +2 −4 lib/Cake/Controller/Component/Acl/PhpAcl.php
  42. +58 −32 lib/Cake/Controller/Component/AuthComponent.php
  43. +17 −7 lib/Cake/Controller/Component/CookieComponent.php
  44. +1 −1 lib/Cake/Controller/Component/EmailComponent.php
  45. +28 −31 lib/Cake/Controller/Component/PaginatorComponent.php
  46. +55 −59 lib/Cake/Controller/Component/RequestHandlerComponent.php
  47. +6 −8 lib/Cake/Controller/Component/SecurityComponent.php
  48. +12 −12 lib/Cake/Controller/Controller.php
  49. +1 −1 lib/Cake/Controller/Scaffold.php
  50. +1 −1 lib/Cake/Core/App.php
  51. +15 −3 lib/Cake/Core/Configure.php
  52. +0 −1 lib/Cake/Error/ErrorHandler.php
  53. +12 −16 lib/Cake/Error/ExceptionRenderer.php
  54. +5 −12 lib/Cake/I18n/I18n.php
  55. +46 −40 lib/Cake/I18n/L10n.php
  56. +4 −257 lib/Cake/I18n/Multibyte.php
  57. +24 −15 lib/Cake/Log/CakeLog.php
  58. +1 −0 lib/Cake/Log/Engine/FileLog.php
  59. +11 −7 lib/Cake/Model/Behavior/ContainableBehavior.php
  60. +21 −8 lib/Cake/Model/Behavior/TranslateBehavior.php
  61. +8 −10 lib/Cake/Model/Behavior/TreeBehavior.php
  62. +7 −7 lib/Cake/Model/CakeSchema.php
  63. +5 −8 lib/Cake/Model/Datasource/CakeSession.php
  64. +46 −34 lib/Cake/Model/Datasource/Database/Mysql.php
  65. +37 −13 lib/Cake/Model/Datasource/Database/Postgres.php
  66. +17 −14 lib/Cake/Model/Datasource/Database/Sqlite.php
  67. +7 −4 lib/Cake/Model/Datasource/Database/Sqlserver.php
  68. +39 −24 lib/Cake/Model/Datasource/DboSource.php
  69. +41 −28 lib/Cake/Model/Model.php
  70. +5 −6 lib/Cake/Model/Permission.php
  71. +1 −2 lib/Cake/Model/Validator/CakeValidationRule.php
  72. +2 −2 lib/Cake/Model/Validator/CakeValidationSet.php
  73. +20 −9 lib/Cake/Network/CakeRequest.php
  74. +7 −6 lib/Cake/Network/CakeResponse.php
  75. +2 −2 lib/Cake/Network/CakeSocket.php
  76. +1 −1 lib/Cake/Network/Email/CakeEmail.php
  77. +23 −6 lib/Cake/Network/Email/MailTransport.php
  78. +2 −2 lib/Cake/Network/Http/HttpResponse.php
  79. +1 −1 lib/Cake/Network/Http/HttpSocket.php
  80. +0 −15 lib/Cake/Routing/Dispatcher.php
  81. +45 −34 lib/Cake/Routing/Filter/AssetDispatcher.php
  82. +4 −3 lib/Cake/Routing/Route/CakeRoute.php
  83. +1 −1 lib/Cake/Routing/Route/RedirectRoute.php
  84. +43 −7 lib/Cake/Routing/Router.php
  85. +13 −1 lib/Cake/Test/Case/BasicsTest.php
  86. +1 −3 lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
  87. +2 −1 lib/Cake/Test/Case/Cache/Engine/RedisEngineTest.php
  88. +1 −0 lib/Cake/Test/Case/Configure/IniReaderTest.php
  89. +1 −1 lib/Cake/Test/Case/Console/Command/AclShellTest.php
  90. +13 −12 lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php
  91. +6 −6 lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php
  92. +2 −2 lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
  93. +1 −1 lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
  94. +17 −0 lib/Cake/Test/Case/Console/ConsoleErrorHandlerTest.php
  95. +4 −4 lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
  96. +1 −1 lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php
  97. +3 −0 lib/Cake/Test/Case/Controller/Component/Auth/BlowfishAuthenticateTest.php
  98. +24 −0 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
  99. +66 −10 lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php
  100. +14 −4 lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
  101. +5 −5 lib/Cake/Test/Case/Core/AppTest.php
  102. +54 −0 lib/Cake/Test/Case/Core/ConfigureTest.php
  103. +43 −20 lib/Cake/Test/Case/Error/ExceptionRendererTest.php
  104. +16 −6 lib/Cake/Test/Case/Event/CakeEventManagerTest.php
  105. +2 −2 lib/Cake/Test/Case/I18n/I18nTest.php
  106. +62 −58 lib/Cake/Test/Case/I18n/L10nTest.php
  107. +41 −18 lib/Cake/Test/Case/Log/CakeLogTest.php
  108. +13 −0 lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
  109. +3 −3 lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
  110. +88 −60 lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php
  111. +32 −0 lib/Cake/Test/Case/Model/Behavior/TreeBehaviorUuidTest.php
  112. +0 −20 lib/Cake/Test/Case/Model/BehaviorCollectionTest.php
  113. +17 −0 lib/Cake/Test/Case/Model/CakeSchemaTest.php
  114. +1 −1 lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
  115. +107 −16 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
  116. +22 −0 lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
  117. +1 −1 lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php
  118. +8 −8 lib/Cake/Test/Case/Model/ModelDeleteTest.php
  119. +8 −0 lib/Cake/Test/Case/Model/ModelIntegrationTest.php
  120. +23 −5 lib/Cake/Test/Case/Model/ModelReadTest.php
  121. +75 −4 lib/Cake/Test/Case/Model/ModelWriteTest.php
  122. +84 −3 lib/Cake/Test/Case/Network/CakeRequestTest.php
  123. +2 −2 lib/Cake/Test/Case/Network/CakeResponseTest.php
  124. +7 −5 lib/Cake/Test/Case/Network/CakeSocketTest.php
  125. +9 −5 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
  126. +84 −0 lib/Cake/Test/Case/Network/Email/MailTransportTest.php
  127. +6 −6 lib/Cake/Test/Case/Routing/DispatcherTest.php
  128. +56 −8 lib/Cake/Test/Case/Routing/RouterTest.php
  129. +2 −2 lib/Cake/Test/Case/TestSuite/CakeTestSuiteTest.php
  130. +124 −0 lib/Cake/Test/Case/Utility/CakeNumberTest.php
  131. +41 −25 lib/Cake/Test/Case/Utility/CakeTimeTest.php
  132. +8 −2 lib/Cake/Test/Case/Utility/DebuggerTest.php
  133. +5 −5 lib/Cake/Test/Case/Utility/FileTest.php
  134. +296 −58 lib/Cake/Test/Case/Utility/FolderTest.php
  135. +2 −0 lib/Cake/Test/Case/Utility/InflectorTest.php
  136. +30 −2 lib/Cake/Test/Case/Utility/SecurityTest.php
  137. +1 −1 lib/Cake/Test/Case/Utility/SetTest.php
  138. +31 −12 lib/Cake/Test/Case/Utility/ValidationTest.php
  139. +185 −102 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
  140. +1 −1 lib/Cake/Test/Case/View/Helper/JsHelperTest.php
  141. +32 −0 lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
  142. +69 −43 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
  143. +2 −2 lib/Cake/Test/Case/View/MediaViewTest.php
  144. +57 −0 lib/Cake/Test/Case/View/ViewTest.php
  145. +1 −1 lib/Cake/Test/test_app/Error/TestAppsExceptionRenderer.php
  146. +7 −0 lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Routing/Route/TestRoute.php
  147. +1 −1 lib/Cake/Test/test_app/Vendor/css/test_asset.css
  148. +1 −1 lib/Cake/Test/test_app/View/Errors/error400.ctp
  149. +1 −1 lib/Cake/Test/test_app/View/Errors/error500.ctp
  150. +1 −1 lib/Cake/Test/test_app/View/Layouts/flash.ctp
  151. +3 −0 lib/Cake/Test/test_app/View/Posts/extend_with_element.ctp
  152. +1 −1 lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/css/test_asset.css
  153. +1 −1 lib/Cake/Test/test_app/webroot/theme/test_theme/css/theme_webroot.css
  154. +1 −1 lib/Cake/Test/test_app/webroot/theme/test_theme/css/webroot_test.css
  155. +2 −0 lib/Cake/TestSuite/CakeTestRunner.php
  156. +1 −1 lib/Cake/TestSuite/CakeTestSuiteCommand.php
  157. +1 −1 lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
  158. +40 −7 lib/Cake/TestSuite/Fixture/CakeTestFixture.php
  159. +3 −3 lib/Cake/TestSuite/Reporter/CakeTextReporter.php
  160. +105 −27 lib/Cake/Utility/CakeNumber.php
  161. +133 −139 lib/Cake/Utility/CakeTime.php
  162. +22 −24 lib/Cake/Utility/ClassRegistry.php
  163. +8 −9 lib/Cake/Utility/Debugger.php
  164. +3 −3 lib/Cake/Utility/File.php
  165. +54 −11 lib/Cake/Utility/Folder.php
  166. +0 −1 lib/Cake/Utility/Hash.php
  167. +4 −3 lib/Cake/Utility/Inflector.php
  168. +16 −13 lib/Cake/Utility/ObjectCollection.php
  169. +57 −52 lib/Cake/Utility/Sanitize.php
  170. +25 −54 lib/Cake/Utility/Security.php
  171. +4 −4 lib/Cake/Utility/Set.php
  172. +33 −39 lib/Cake/Utility/String.php
  173. +41 −19 lib/Cake/Utility/Validation.php
  174. +2 −2 lib/Cake/Utility/Xml.php
  175. +1 −1 lib/Cake/VERSION.txt
  176. +7 −1 lib/Cake/View/Errors/missing_connection.ctp
  177. +19 −19 lib/Cake/View/Helper.php
  178. +4 −4 lib/Cake/View/Helper/CacheHelper.php
  179. +154 −115 lib/Cake/View/Helper/FormHelper.php
  180. +12 −13 lib/Cake/View/Helper/HtmlHelper.php
  181. +1 −1 lib/Cake/View/Helper/JsBaseEngineHelper.php
  182. +1 −1 lib/Cake/View/Helper/JsHelper.php
  183. +0 −1 lib/Cake/View/Helper/MootoolsEngineHelper.php
  184. +14 −1 lib/Cake/View/Helper/NumberHelper.php
  185. +18 −13 lib/Cake/View/Helper/PaginatorHelper.php
  186. +0 −1 lib/Cake/View/Helper/PrototypeEngineHelper.php
  187. +2 −2 lib/Cake/View/Helper/RssHelper.php
  188. +1 −1 lib/Cake/View/Helper/SessionHelper.php
  189. +2 −1 lib/Cake/View/Helper/TextHelper.php
  190. +0 −1 lib/Cake/View/Helper/TimeHelper.php
  191. +31 −16 lib/Cake/View/View.php
  192. +47 −9 lib/Cake/View/ViewBlock.php
  193. +5 −10 lib/Cake/basics.php
  194. +264 −5 lib/Cake/bootstrap.php
View
@@ -22,18 +22,18 @@
/**
* Example
* -------
- *
+ *
* Assumptions:
*
- * 1. In your application you created a User model with the following properties:
+ * 1. In your application you created a User model with the following properties:
* username, group_id, password, email, firstname, lastname and so on.
- * 2. You configured AuthComponent to authorize actions via
- * $this->Auth->authorize = array('Actions' => array('actionPath' => 'controllers/'),...)
- *
+ * 2. You configured AuthComponent to authorize actions via
+ * $this->Auth->authorize = array('Actions' => array('actionPath' => 'controllers/'),...)
+ *
* Now, when a user (i.e. jeff) authenticates successfully and requests a controller action (i.e. /invoices/delete)
- * that is not allowed by default (e.g. via $this->Auth->allow('edit') in the Invoices controller) then AuthComponent
- * will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be
- * done via a call to Acl->check() with
+ * that is not allowed by default (e.g. via $this->Auth->allow('edit') in the Invoices controller) then AuthComponent
+ * will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be
+ * done via a call to Acl->check() with
*
* array('User' => array('username' => 'jeff', 'group_id' => 4, ...))
*
@@ -42,33 +42,33 @@
* '/controllers/invoices/delete'
*
* as ACO.
- *
+ *
* If the configured map looks like
*
* $config['map'] = array(
* 'User' => 'User/username',
* 'Role' => 'User/group_id',
* );
*
- * then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to
- * find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to
+ * then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to
+ * find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to
* check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration.
* E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like
*
* $config['alias'] = array(
* 'Role/4' => 'Role/editor',
* );
- *
+ *
* In the roles configuration you can define roles on the lhs and inherited roles on the rhs:
- *
+ *
* $config['roles'] = array(
* 'Role/admin' => null,
* 'Role/accountant' => null,
* 'Role/editor' => null,
* 'Role/manager' => 'Role/editor, Role/accountant',
* 'User/jeff' => 'Role/manager',
* );
- *
+ *
* In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role.
* Lets define some rules:
*
@@ -87,10 +87,10 @@
* ),
* );
*
- * Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager,
- * Role/editor, Role/accountant and Role/default. However, for jeff, rules for User/jeff are more specific than
+ * Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager,
+ * Role/editor, Role/accountant and Role/default. However, for jeff, rules for User/jeff are more specific than
* rules for Role/manager, rules for Role/manager are more specific than rules for Role/editor and so on.
- * This is important when allow and deny rules match for a role. E.g. Role/accountant is allowed
+ * This is important when allow and deny rules match for a role. E.g. Role/accountant is allowed
* controllers/invoices/* but at the same time controllers/invoices/delete is denied. But there is a more
* specific rule defined for Role/manager which is allowed controllers/invoices/delete. However, the most specific
* rule denies access to the delete action explicitly for User/jeff, so he'll be denied access to the resource.
@@ -101,7 +101,7 @@
/**
* The role map defines how to resolve the user record from your application
- * to the roles you defined in the roles configuration.
+ * to the roles you defined in the roles configuration.
*/
$config['map'] = array(
'User' => 'User/username',
View
@@ -2,7 +2,7 @@
/**
* This file is loaded automatically by the app/webroot/index.php file after core.php
*
- * This file should load/create any application wide configuration settings, such as
+ * This file should load/create any application wide configuration settings, such as
* Caching, Logging, loading additional configuration files.
*
* You should also use this file to include any files that provide global functions/constants
View
@@ -226,7 +226,7 @@
Configure::write('Acl.database', 'default');
/**
- * Uncomment this line and correct your server timezone to fix
+ * Uncomment this line and correct your server timezone to fix
* any date & time related errors.
*/
//date_default_timezone_set('UTC');
@@ -238,7 +238,7 @@
* By default File is used, but for improved performance you should use APC.
*
* Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
- * Please check the comments in boostrap.php for more info on the cache engines available
+ * Please check the comments in boostrap.php for more info on the cache engines available
* and their setttings.
*/
$engine = 'File';
View
@@ -32,13 +32,13 @@
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
- * Load all plugin routes. See the CakePlugin documentation on
+ * Load all plugin routes. See the CakePlugin documentation on
* how to customize the loading of plugin routes.
*/
CakePlugin::routes();
/**
- * Load the CakePHP default routes. Remove this if you do not want to use
+ * Load the CakePHP default routes. Only remove this if you do not want to use
* the built-in default routes.
*/
require CAKE . 'Config' . DS . 'routes.php';
View
@@ -17,18 +17,21 @@
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#
################################################################################
-ME=$(readlink -f $0)
-LIB=$(cd -P -- "$(dirname -- "$ME")" && pwd -P) && LIB=$LIB/$(basename -- "$ME")
-while [ -h "$LIB" ]; do
- DIR=$(dirname -- "$LIB")
- SYM=$(readlink "$LIB")
- LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
-done
+# Canonicalize by following every symlink of the given name recursively
+canonicalize() {
+ NAME=$1
+ while [ -h "$NAME" ]; do
+ DIR=$(dirname -- "$NAME")
+ SYM=$(readlink "$NAME")
+ NAME=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
+ done
+ echo "$NAME"
+}
-LIB=$(dirname -- "$LIB")/
-APP=$(dirname $(cd $(dirname $ME) && pwd))
+CONSOLE=$(dirname $(canonicalize "$0"))
+APP=$(dirname "$CONSOLE")
-exec php -q "$LIB"cake.php -working "$APP" "$@"
+exec php -q $CONSOLE/cake.php -working "$APP" "$@"
exit;
View
@@ -94,4 +94,4 @@
App::uses('Dispatcher', 'Routing');
$Dispatcher = new Dispatcher();
-$Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding'))));
+$Dispatcher->dispatch(new CakeRequest(), new CakeResponse());
View
@@ -103,7 +103,7 @@ class Cache {
* - `path` Used by FileCache. Path to where cachefiles should be saved.
* - `lock` Used by FileCache. Should files be locked before writing to them?
* - `user` Used by Xcache. Username for XCache
- * - `password` Used by Xcache. Password for XCache
+ * - `password` Used by Xcache/Redis. Password for XCache/Redis
*
* @see app/Config/core.php for configuration settings
* @param string $name Name of the configuration
@@ -366,7 +366,7 @@ public static function increment($key, $offset = 1, $config = 'default') {
}
$key = self::$_engines[$config]->key($key);
- if (!$key || !is_integer($offset) || $offset < 0) {
+ if (!$key || !is_int($offset) || $offset < 0) {
return false;
}
$success = self::$_engines[$config]->increment($settings['prefix'] . $key, $offset);
@@ -394,7 +394,7 @@ public static function decrement($key, $offset = 1, $config = 'default') {
}
$key = self::$_engines[$config]->key($key);
- if (!$key || !is_integer($offset) || $offset < 0) {
+ if (!$key || !is_int($offset) || $offset < 0) {
return false;
}
$success = self::$_engines[$config]->decrement($settings['prefix'] . $key, $offset);
@@ -61,9 +61,8 @@ public function init($settings = array()) {
* @return boolean True if the data was successfully cached, false on failure
*/
public function write($key, $value, $duration) {
- if ($duration == 0) {
- $expires = 0;
- } else {
+ $expires = 0;
+ if ($duration) {
$expires = time() + $duration;
}
apc_store($key . '_expires', $expires, $duration);
@@ -62,6 +62,7 @@ public function init($settings = array()) {
'prefix' => null,
'server' => '127.0.0.1',
'port' => 6379,
+ 'password' => false,
'timeout' => 0,
'persistent' => true
), $settings)
@@ -87,6 +88,9 @@ protected function _connect() {
} catch (RedisException $e) {
return false;
}
+ if ($return && $this->settings['password']) {
+ $return = $this->_Redis->auth($this->settings['password']);
+ }
return $return;
}
@@ -183,6 +183,7 @@ public function groups() {
* @return boolean success
**/
public function clearGroup($group) {
+ $success = null;
wincache_ucache_inc($this->settings['prefix'] . $group, 1, $success);
return $success;
}
@@ -72,11 +72,14 @@ class IniReader implements ConfigReaderInterface {
* Build and construct a new ini file parser. The parser can be used to read
* ini files that are on the filesystem.
*
- * @param string $path Path to load ini config files from.
+ * @param string $path Path to load ini config files from. Defaults to APP . 'Config' . DS
* @param string $section Only get one section, leave null to parse and fetch
* all sections in the ini file.
*/
- public function __construct($path, $section = null) {
+ public function __construct($path = null, $section = null) {
+ if (!$path) {
+ $path = APP . 'Config' . DS;
+ }
$this->_path = $path;
$this->_section = $section;
}
@@ -170,17 +173,22 @@ protected function _parseNestedValues($values) {
public function dump($filename, $data) {
$result = array();
foreach ($data as $key => $value) {
+ $isSection = false;
if ($key[0] != '[') {
$result[] = "[$key]";
+ $isSection = true;
}
if (is_array($value)) {
$keyValues = Hash::flatten($value, '.');
foreach ($keyValues as $k => $v) {
$result[] = "$k = " . $this->_value($v);
}
}
+ if ($isSection) {
+ $result[] = '';
+ }
}
- $contents = join("\n", $result);
+ $contents = trim(implode("\n", $result));
if (substr($filename, -4) !== '.ini') {
$filename .= '.ini';
@@ -598,7 +598,7 @@ protected function _getParams() {
* @return array Variables
*/
protected function _dataVars($type = null) {
- if ($type == null) {
+ if (!$type) {
$type = $this->args[0];
}
$vars = array();
@@ -73,12 +73,13 @@ public function main() {
$path = $this->paths['core'];
}
- if (count($this->args) == 1) {
- $file = $type;
- $class = Inflector::camelize($type);
- } elseif (count($this->args) > 1) {
+ $count = count($this->args);
+ if ($count > 1) {
$file = Inflector::underscore($this->args[1]);
$class = Inflector::camelize($this->args[1]);
+ } elseif ($count) {
+ $file = $type;
+ $class = Inflector::camelize($type);
}
$objects = App::objects('class', $path);
if (in_array($class, $objects)) {
@@ -182,7 +182,7 @@ public function main($command = null) {
$this->out(" - {$model}");
}
break;
- case (preg_match("/^(\w+) bind (\w+) (\w+)/", $command, $tmp) == true):
+ case preg_match("/^(\w+) bind (\w+) (\w+)/", $command, $tmp):
foreach ($tmp as $data) {
$data = strip_tags($data);
$data = str_replace($this->badCommandChars, "", $data);
@@ -200,7 +200,7 @@ public function main($command = null) {
$this->out(__d('cake_console', "Please verify you are using valid models and association types"));
}
break;
- case (preg_match("/^(\w+) unbind (\w+) (\w+)/", $command, $tmp) == true):
+ case preg_match("/^(\w+) unbind (\w+) (\w+)/", $command, $tmp):
foreach ($tmp as $data) {
$data = strip_tags($data);
$data = str_replace($this->badCommandChars, "", $data);
@@ -298,7 +298,7 @@ public function main($command = null) {
$this->out(__d('cake_console', 'Saved record for %s', $modelToSave));
}
break;
- case (preg_match("/^(\w+) columns/", $command, $tmp) == true):
+ case preg_match("/^(\w+) columns/", $command, $tmp):
$modelToCheck = strip_tags(str_replace($this->badCommandChars, "", $tmp[1]));
if ($this->_isValidModel($modelToCheck)) {
@@ -315,22 +315,22 @@ public function main($command = null) {
$this->out(__d('cake_console', "Please verify that you selected a valid model"));
}
break;
- case (preg_match("/^routes\s+reload/i", $command, $tmp) == true):
+ case preg_match("/^routes\s+reload/i", $command, $tmp):
if (!$this->_loadRoutes()) {
$this->err(__d('cake_console', "There was an error loading the routes config. Please check that the file exists and is free of parse errors."));
break;
}
$this->out(__d('cake_console', "Routes configuration reloaded, %d routes connected", count(Router::$routes)));
break;
- case (preg_match("/^routes\s+show/i", $command, $tmp) == true):
+ case preg_match("/^routes\s+show/i", $command, $tmp):
$this->out(print_r(Hash::combine(Router::$routes, '{n}.template', '{n}.defaults'), true));
break;
- case (preg_match("/^route\s+(\(.*\))$/i", $command, $tmp) == true):
+ case preg_match("/^route\s+(\(.*\))$/i", $command, $tmp):
if ($url = eval('return array' . $tmp[1] . ';')) {
$this->out(Router::url($url));
}
break;
- case (preg_match("/^route\s+(.*)/i", $command, $tmp) == true):
+ case preg_match("/^route\s+(.*)/i", $command, $tmp):
$this->out(var_export(Router::parse($tmp[1]), true));
break;
default:
@@ -24,10 +24,12 @@
* @package Cake.Console.Command
*/
class ServerShell extends AppShell {
+
/**
* Default ServerHost
*/
const DEFAULT_HOST = 'localhost';
+
/**
* Default ListenPort
*/
Oops, something went wrong.

0 comments on commit 7007dba

Please sign in to comment.