Permalink
Browse files

Merge branch '2.3' into currency

  • Loading branch information...
2 parents fda331e + d051b69 commit 22311a1e62934da757d53d7aecfce884f5a1ca10 @ceeram ceeram committed Oct 26, 2012
Showing with 1,211 additions and 779 deletions.
  1. +18 −18 app/Config/acl.php
  2. +1 −1 app/Config/bootstrap.php
  3. +2 −2 app/Config/core.php
  4. +1 −1 app/Config/routes.php
  5. +13 −14 app/Console/cake
  6. +2 −3 lib/Cake/Cache/Engine/ApcEngine.php
  7. +6 −1 lib/Cake/Configure/IniReader.php
  8. +1 −1 lib/Cake/Console/Command/AclShell.php
  9. +5 −4 lib/Cake/Console/Command/ApiShell.php
  10. +7 −7 lib/Cake/Console/Command/ConsoleShell.php
  11. +3 −3 lib/Cake/Console/Command/Task/ControllerTask.php
  12. +13 −17 lib/Cake/Console/Command/Task/DbConfigTask.php
  13. +4 −4 lib/Cake/Console/Command/Task/ExtractTask.php
  14. +10 −13 lib/Cake/Console/Command/Task/ModelTask.php
  15. +4 −7 lib/Cake/Console/Command/Task/ProjectTask.php
  16. +2 −2 lib/Cake/Console/Command/Task/TemplateTask.php
  17. +4 −3 lib/Cake/Console/Command/Task/TestTask.php
  18. +2 −2 lib/Cake/Console/Command/Task/ViewTask.php
  19. +1 −1 lib/Cake/Console/ConsoleErrorHandler.php
  20. +5 −5 lib/Cake/Console/Shell.php
  21. +2 −2 lib/Cake/Console/Templates/skel/Config/bootstrap.php
  22. +18 −14 lib/Cake/Console/Templates/skel/Console/cake
  23. +12 −8 lib/Cake/Console/cake
  24. +1 −1 lib/Cake/Controller/Component/Acl/IniAcl.php
  25. +2 −2 lib/Cake/Controller/Component/Acl/PhpAcl.php
  26. +2 −2 lib/Cake/Controller/Component/CookieComponent.php
  27. +1 −1 lib/Cake/Controller/Component/EmailComponent.php
  28. +2 −2 lib/Cake/Controller/Component/SecurityComponent.php
  29. +12 −11 lib/Cake/Controller/Controller.php
  30. +1 −1 lib/Cake/Controller/Scaffold.php
  31. +1 −1 lib/Cake/Core/App.php
  32. +2 −2 lib/Cake/Core/Configure.php
  33. +0 −1 lib/Cake/Error/ErrorHandler.php
  34. +2 −2 lib/Cake/Error/ExceptionRenderer.php
  35. +1 −8 lib/Cake/I18n/I18n.php
  36. +0 −255 lib/Cake/I18n/Multibyte.php
  37. +24 −15 lib/Cake/Log/CakeLog.php
  38. +11 −7 lib/Cake/Model/Behavior/ContainableBehavior.php
  39. +1 −1 lib/Cake/Model/Behavior/TranslateBehavior.php
  40. +8 −10 lib/Cake/Model/Behavior/TreeBehavior.php
  41. +3 −3 lib/Cake/Model/Datasource/CakeSession.php
  42. +29 −11 lib/Cake/Model/Datasource/Database/Mysql.php
  43. +14 −11 lib/Cake/Model/Datasource/Database/Postgres.php
  44. +9 −9 lib/Cake/Model/Datasource/Database/Sqlite.php
  45. +3 −3 lib/Cake/Model/Datasource/Database/Sqlserver.php
  46. +14 −15 lib/Cake/Model/Datasource/DboSource.php
  47. +14 −15 lib/Cake/Model/Model.php
  48. +5 −5 lib/Cake/Model/Permission.php
  49. +1 −1 lib/Cake/Model/Validator/CakeValidationSet.php
  50. +7 −5 lib/Cake/Network/CakeRequest.php
  51. +1 −1 lib/Cake/Network/CakeResponse.php
  52. +2 −2 lib/Cake/Network/CakeSocket.php
  53. +2 −2 lib/Cake/Network/Http/HttpResponse.php
  54. +1 −1 lib/Cake/Network/Http/HttpSocket.php
  55. +1 −1 lib/Cake/Routing/Route/RedirectRoute.php
  56. +3 −3 lib/Cake/Routing/Router.php
  57. +12 −0 lib/Cake/Test/Case/BasicsTest.php
  58. +0 −1 lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
  59. +1 −0 lib/Cake/Test/Case/Configure/IniReaderTest.php
  60. +6 −6 lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php
  61. +4 −4 lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
  62. +9 −9 lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php
  63. +14 −4 lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
  64. +1 −1 lib/Cake/Test/Case/Core/AppTest.php
  65. +16 −6 lib/Cake/Test/Case/Event/CakeEventManagerTest.php
  66. +40 −17 lib/Cake/Test/Case/Log/CakeLogTest.php
  67. +13 −0 lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
  68. +30 −2 lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php
  69. +32 −0 lib/Cake/Test/Case/Model/Behavior/TreeBehaviorUuidTest.php
  70. +75 −1 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
  71. +18 −3 lib/Cake/Test/Case/Model/ModelReadTest.php
  72. +73 −2 lib/Cake/Test/Case/Model/ModelWriteTest.php
  73. +45 −3 lib/Cake/Test/Case/Network/CakeRequestTest.php
  74. +2 −2 lib/Cake/Test/Case/Network/CakeResponseTest.php
  75. +1 −1 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
  76. +6 −6 lib/Cake/Test/Case/Routing/DispatcherTest.php
  77. +11 −11 lib/Cake/Test/Case/Utility/CakeTimeTest.php
  78. +7 −0 lib/Cake/Test/Case/Utility/DebuggerTest.php
  79. +2 −0 lib/Cake/Test/Case/Utility/InflectorTest.php
  80. +16 −23 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
  81. +32 −0 lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
  82. +69 −43 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
  83. +2 −2 lib/Cake/Test/Case/View/MediaViewTest.php
  84. +1 −1 lib/Cake/Test/test_app/Vendor/css/test_asset.css
  85. +1 −1 lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/css/test_asset.css
  86. +1 −1 lib/Cake/Test/test_app/webroot/theme/test_theme/css/theme_webroot.css
  87. +1 −1 lib/Cake/Test/test_app/webroot/theme/test_theme/css/webroot_test.css
  88. +2 −0 lib/Cake/TestSuite/CakeTestRunner.php
  89. +1 −1 lib/Cake/TestSuite/CakeTestSuiteCommand.php
  90. +1 −1 lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
  91. +8 −2 lib/Cake/TestSuite/Fixture/CakeTestFixture.php
  92. +3 −3 lib/Cake/TestSuite/Reporter/CakeTextReporter.php
  93. +2 −2 lib/Cake/Utility/CakeNumber.php
  94. +4 −4 lib/Cake/Utility/CakeTime.php
  95. +1 −1 lib/Cake/Utility/Debugger.php
  96. +3 −3 lib/Cake/Utility/File.php
  97. +1 −1 lib/Cake/Utility/Folder.php
  98. +2 −1 lib/Cake/Utility/Inflector.php
  99. +1 −1 lib/Cake/Utility/Security.php
  100. +4 −4 lib/Cake/Utility/Set.php
  101. +1 −1 lib/Cake/Utility/String.php
  102. +2 −2 lib/Cake/Utility/Validation.php
  103. +4 −5 lib/Cake/View/Helper.php
  104. +3 −3 lib/Cake/View/Helper/CacheHelper.php
  105. +13 −10 lib/Cake/View/Helper/FormHelper.php
  106. +7 −8 lib/Cake/View/Helper/HtmlHelper.php
  107. +1 −1 lib/Cake/View/Helper/JsHelper.php
  108. +17 −12 lib/Cake/View/Helper/PaginatorHelper.php
  109. +1 −1 lib/Cake/View/Helper/RssHelper.php
  110. +1 −1 lib/Cake/View/Helper/SessionHelper.php
  111. +1 −1 lib/Cake/View/Helper/TextHelper.php
  112. +2 −2 lib/Cake/View/View.php
  113. +5 −10 lib/Cake/basics.php
  114. +263 −4 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,7 +32,7 @@
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();
View
@@ -17,22 +17,21 @@
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#
################################################################################
-if [[ `uname` =~ 'Darwin' ]]; then
- ME=$0
-else
- ME=$(readlink -f $0)
-fi
-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;
@@ -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);
@@ -173,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 = implode("\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:
@@ -395,7 +395,7 @@ public function listAll($useDbConfig = null) {
}
$this->__tables = $this->Model->getAllTables($useDbConfig);
- if ($this->interactive == true) {
+ if ($this->interactive) {
$this->out(__d('cake_console', 'Possible Controllers based on your current database:'));
$this->hr();
$this->_controllerNames = array();
@@ -419,14 +419,14 @@ public function getName($useDbConfig = null) {
$controllers = $this->listAll($useDbConfig);
$enteredController = '';
- while ($enteredController == '') {
+ while (!$enteredController) {
$enteredController = $this->in(__d('cake_console', "Enter a number from the list above,\ntype in the name of another controller, or 'q' to exit"), null, 'q');
if ($enteredController === 'q') {
$this->out(__d('cake_console', 'Exit'));
return $this->_stop();
}
- if ($enteredController == '' || intval($enteredController) > count($controllers)) {
+ if (!$enteredController || intval($enteredController) > count($controllers)) {
$this->err(__d('cake_console', "The Controller name you supplied was empty,\nor the number you selected was not an option. Please try again."));
$enteredController = '';
}
Oops, something went wrong.

0 comments on commit 22311a1

Please sign in to comment.