Permalink
Browse files

Merge remote-tracking branch 'origin/2.3' into 3.0

Conflicts:
	app/Config/core.php
	build.xml
	lib/Cake/Cache/Cache.php
	lib/Cake/Configure/IniReader.php
	lib/Cake/Configure/PhpReader.php
	lib/Cake/Console/ConsoleErrorHandler.php
	lib/Cake/Console/Templates/skel/Config/core.php
	lib/Cake/Controller/Component/Auth/FormAuthenticate.php
	lib/Cake/Controller/Scaffold.php
	lib/Cake/Error/ExceptionRenderer.php
	lib/Cake/Event/EventManager.php
	lib/Cake/I18n/I18n.php
	lib/Cake/Log/CakeLog.php
	lib/Cake/Model/Model.php
	lib/Cake/Model/Validator/ValidationRule.php
	lib/Cake/Model/Validator/ValidationSet.php
	lib/Cake/Network/Email/AbstractTransport.php
	lib/Cake/Network/Email/Email.php
	lib/Cake/Network/Email/MailTransport.php
	lib/Cake/Routing/Route/Route.php
	lib/Cake/Routing/Router.php
	lib/Cake/Test/TestCase/Controller/ControllerTest.php
	lib/Cake/Test/TestCase/Routing/Route/RouteTest.php
	lib/Cake/Test/TestCase/View/Helper/FormHelperTest.php
	lib/Cake/TestSuite/Reporter/BaseReporter.php
	lib/Cake/TestSuite/TestSuiteCommand.php
	lib/Cake/TestSuite/templates/xdebug.php
	lib/Cake/Utility/Hash.php
	lib/Cake/Utility/Time.php
	lib/Cake/VERSION.txt
	lib/Cake/View/Helper/NumberHelper.php
	lib/Cake/View/Helper/TimeHelper.php
	lib/Cake/View/MediaView.php
	lib/Cake/View/View.php
	lib/Cake/bootstrap.php
  • Loading branch information...
2 parents 8ef7fff + 77244be commit 098c9218d93dd6383376c15e862a5c7fdb1a9985 @markstory markstory committed Dec 18, 2012
Showing with 1,668 additions and 719 deletions.
  1. +1 −1 .travis.yml
  2. +36 −0 build.xml
  3. +5 −27 lib/Cake/Cache/Cache.php
  4. +1 −1 lib/Cake/Cache/Engine/RedisEngine.php
  5. +9 −0 lib/Cake/Configure/ConfigReaderInterface.php
  6. +41 −29 lib/Cake/Configure/IniReader.php
  7. +29 −17 lib/Cake/Configure/PhpReader.php
  8. +1 −1 lib/Cake/Console/Command/CommandListShell.php
  9. +2 −2 lib/Cake/Console/Command/Task/FixtureTask.php
  10. +2 −1 lib/Cake/Console/Command/Task/PluginTask.php
  11. +1 −1 lib/Cake/Console/Command/TestShell.php
  12. +2 −1 lib/Cake/Console/ConsoleOptionParser.php
  13. +2 −1 lib/Cake/Console/ConsoleOutput.php
  14. +1 −1 lib/Cake/Console/HelpFormatter.php
  15. +12 −2 lib/Cake/Console/Shell.php
  16. +1 −1 lib/Cake/Controller/Component.php
  17. +2 −2 lib/Cake/Controller/Component/Acl/AclInterface.php
  18. +2 −2 lib/Cake/Controller/Component/Acl/DbAcl.php
  19. +2 −2 lib/Cake/Controller/Component/Acl/IniAcl.php
  20. +24 −2 lib/Cake/Controller/Component/Acl/PhpAcl.php
  21. +1 −1 lib/Cake/Controller/Component/Auth/FormAuthenticate.php
  22. +3 −0 lib/Cake/Controller/Component/AuthComponent.php
  23. +0 −2 lib/Cake/Controller/Component/CookieComponent.php
  24. +5 −0 lib/Cake/Controller/Component/PaginatorComponent.php
  25. +1 −1 lib/Cake/Controller/Component/RequestHandlerComponent.php
  26. +1 −1 lib/Cake/Controller/ComponentCollection.php
  27. +4 −5 lib/Cake/Controller/Controller.php
  28. +9 −3 lib/Cake/Controller/Scaffold.php
  29. +1 −1 lib/Cake/Core/Configure.php
  30. +1 −0 lib/Cake/Error/ExceptionRenderer.php
  31. +1 −0 lib/Cake/Event/EventManager.php
  32. +10 −3 lib/Cake/I18n/I18n.php
  33. +1 −0 lib/Cake/Log/Engine/BaseLog.php
  34. +1 −1 lib/Cake/Model/Aco.php
  35. +1 −1 lib/Cake/Model/AcoAction.php
  36. +1 −3 lib/Cake/Model/Behavior/ContainableBehavior.php
  37. +2 −1 lib/Cake/Model/Behavior/TranslateBehavior.php
  38. +72 −0 lib/Cake/Model/Datasource/Database/Mysql.php
  39. +7 −3 lib/Cake/Model/Datasource/DboSource.php
  40. +218 −223 lib/Cake/Model/Model.php
  41. +0 −1 lib/Cake/Model/ModelBehavior.php
  42. +15 −27 lib/Cake/Model/ModelValidator.php
  43. +7 −3 lib/Cake/Model/Schema.php
  44. +7 −0 lib/Cake/Model/Validator/ValidationRule.php
  45. +3 −2 lib/Cake/Model/Validator/ValidationSet.php
  46. +2 −1 lib/Cake/Network/Email/Email.php
  47. +1 −6 lib/Cake/Network/Email/MailTransport.php
  48. +0 −10 lib/Cake/Network/Http/HttpSocketResponse.php
  49. +1 −0 lib/Cake/Network/Request.php
  50. +10 −3 lib/Cake/Network/Response.php
  51. +5 −1 lib/Cake/Routing/Filter/CacheDispatcher.php
  52. +1 −1 lib/Cake/Routing/Route/Route.php
  53. +17 −4 lib/Cake/Routing/Router.php
  54. +1 −1 lib/Cake/Test/TestApp/View/Themed/TestTheme/webroot/js/one/theme_one.js
  55. +1 −1 lib/Cake/Test/TestApp/View/Themed/TestTheme/webroot/js/theme.js
  56. +1 −1 lib/Cake/Test/TestCase/AllConsoleTest.php
  57. +0 −1 lib/Cake/Test/TestCase/AllCoreTest.php
  58. +0 −1 lib/Cake/Test/TestCase/AllEventTest.php
  59. +0 −1 lib/Cake/Test/TestCase/AllLogTest.php
  60. +1 −1 lib/Cake/Test/TestCase/AllTestSuiteTest.php
  61. +1 −1 lib/Cake/Test/TestCase/Console/AllConsoleLibsTest.php
  62. +1 −1 lib/Cake/Test/TestCase/Console/AllShellsTest.php
  63. +0 −1 lib/Cake/Test/TestCase/Console/AllTasksTest.php
  64. +12 −0 lib/Cake/Test/TestCase/Console/ConsoleOptionParserTest.php
  65. +0 −1 lib/Cake/Test/TestCase/Controller/Component/Acl/IniAclTest.php
  66. +34 −0 lib/Cake/Test/TestCase/Controller/Component/PaginatorComponentTest.php
  67. +7 −8 lib/Cake/Test/TestCase/Controller/ControllerTest.php
  68. +1 −0 lib/Cake/Test/TestCase/Controller/ScaffoldTest.php
  69. +1 −1 lib/Cake/Test/TestCase/Event/EventTest.php
  70. +0 −2 lib/Cake/Test/TestCase/Model/Behavior/TreeBehaviorAfterTest.php
  71. +39 −0 lib/Cake/Test/TestCase/Model/Datasource/Database/MysqlTest.php
  72. +147 −0 lib/Cake/Test/TestCase/Model/ModelValidationTest.php
  73. +18 −0 lib/Cake/Test/TestCase/Model/ModelWriteTest.php
  74. +1 −1 lib/Cake/Test/TestCase/Network/Email/DebugTransportTest.php
  75. +1 −1 lib/Cake/Test/TestCase/Network/Email/EmailTest.php
  76. +0 −1 lib/Cake/Test/TestCase/Network/Email/MailTransportTest.php
  77. +24 −0 lib/Cake/Test/TestCase/Routing/Route/RouteTest.php
  78. +7 −1 lib/Cake/Test/TestCase/Utility/DebuggerTest.php
  79. +18 −0 lib/Cake/Test/TestCase/Utility/HashTest.php
  80. +3 −0 lib/Cake/Test/TestCase/Utility/SetTest.php
  81. +6 −2 lib/Cake/Test/TestCase/Utility/ValidationTest.php
  82. +65 −10 lib/Cake/Test/TestCase/View/Helper/FormHelperTest.php
  83. +0 −1 lib/Cake/Test/TestCase/View/Helper/TextHelperTest.php
  84. +29 −1 lib/Cake/Test/TestCase/View/HelperTest.php
  85. +85 −8 lib/Cake/Test/TestCase/View/ViewTest.php
  86. +1 −0 lib/Cake/TestSuite/ControllerTestCase.php
  87. +1 −1 lib/Cake/TestSuite/Coverage/BaseCoverageReport.php
  88. +6 −0 lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
  89. +10 −3 lib/Cake/TestSuite/Reporter/BaseReporter.php
  90. +3 −0 lib/Cake/TestSuite/Reporter/HtmlReporter.php
  91. +2 −3 lib/Cake/TestSuite/Reporter/TextReporter.php
  92. +5 −2 lib/Cake/TestSuite/TestCase.php
  93. +5 −2 lib/Cake/TestSuite/TestLoader.php
  94. +4 −1 lib/Cake/TestSuite/TestRunner.php
  95. +3 −1 lib/Cake/TestSuite/TestSuiteCommand.php
  96. +5 −5 lib/Cake/TestSuite/templates/footer.php
  97. +0 −1 lib/Cake/TestSuite/templates/xdebug.php
  98. +21 −9 lib/Cake/Utility/Debugger.php
  99. +8 −3 lib/Cake/Utility/Hash.php
  100. +3 −0 lib/Cake/Utility/Set.php
  101. +9 −1 lib/Cake/Utility/Time.php
  102. +2 −2 lib/Cake/Utility/Validation.php
  103. +1 −1 lib/Cake/Utility/Xml.php
  104. +10 −0 lib/Cake/View/Helper.php
  105. +5 −1 lib/Cake/View/Helper/CacheHelper.php
  106. +289 −193 lib/Cake/View/Helper/FormHelper.php
  107. +3 −3 lib/Cake/View/Helper/HtmlHelper.php
  108. +1 −2 lib/Cake/View/Helper/JsBaseEngineHelper.php
  109. +2 −2 lib/Cake/View/Helper/JsHelper.php
  110. +1 −1 lib/Cake/View/Helper/NumberHelper.php
  111. +2 −0 lib/Cake/View/Helper/TextHelper.php
  112. +3 −1 lib/Cake/View/Helper/TimeHelper.php
  113. +1 −1 lib/Cake/View/MediaView.php
  114. +9 −3 lib/Cake/View/Scaffolds/form.ctp
  115. +18 −8 lib/Cake/View/Scaffolds/index.ctp
  116. +64 −12 lib/Cake/View/Scaffolds/view.ctp
  117. +47 −7 lib/Cake/View/View.php
  118. +35 −0 lib/Cake/View/ViewBlock.php
View
@@ -98,7 +98,7 @@ before_script:
Configure::write('Datasource', \$datasources);" > App/Config/datasources.php
script:
- - sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else phpcs --extensions=php --standard=CakePHP ./lib/Cake; fi"
+ - sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi"
notifications:
email: false
View
@@ -40,6 +40,9 @@
<include name="cake" />
</fileset>
+ <fileset id="non-tests" dir="./lib/Cake">
+ <exclude name=".lib/Cake/Test" />
+ </fileset>
<!-- start fresh each time. Remove the dist and build dirs -->
<target name="clean">
@@ -205,6 +208,37 @@
<exec command="ssh cakephp@cakephp.org pirum add ${pirum.dir} ${pirum.dir}/${pear.package}.tgz" checkreturn="true" />
</target>
+ <target name="codestyle" description="Check codestyle (human readable format)">
+ <phpcodesniffer
+ standard="CakePHP"
+ allowedFileExtensions="php">
+ <fileset refid="libs" />
+ </phpcodesniffer>
+ </target>
+
+ <target name="reports-ci">
+ <phpcodesniffer
+ standard="CakePHP"
+ allowedFileExtensions="php">
+ <fileset refid="libs" />
+ <formatter type="checkstyle" outfile="checkstyle.xml" />
+ </phpcodesniffer>
+ <phpcpd
+ minLines="4"
+ minTokens="50">
+ <fileset refid="libs" />
+ <formatter type="pmd" outfile="pmd-cpd.xml"/>
+ </phpcpd>
+ <phpdepend>
+ <fileset refid="non-tests" />
+ <logger type="jdepend-xml" outfile="jdepend.xml"/>
+ </phpdepend>
+ <phpmd rulesets="codesize,unusedcode,design">
+ <fileset refid="non-tests" />
+ <formatter type="xml" outfile="reports/pmd.html"/>
+ </phpmd>
+ </target>
+
<target name="subtree-split" description="Split the main repo into subtrees for the -app and -framework repos">
<echo msg="Generating app-split subtree branch" />
<exec command="git subtree split --prefix App/ --branch app-split" />
@@ -222,5 +256,7 @@
-->
<target name="build" depends="generate-package" description="Generate a pear package" />
<target name="release" depends="release-commit,build,distribute" description="Release a new version of CakePHP" />
+ <target name="code-reports" depends="reports-ci"
+ description="Run the code reports, generating XML output for CI server use." />
</project>
View
@@ -73,33 +73,11 @@
* - `user` Used by Xcache. Username for XCache
* - `password` Used by Xcache/Redis. Password for XCache/Redis
*
- * ### Removing existing engines
- *
- * To remove an existing cache engine you can use:
- *
- * {{{
- * Cache::drop($configName);
- * }}}
- *
- * When an engine is dropped the connected engine will be deleted.
- *
- * ### Reconfiguring an engine
- *
- * If you need to change a connected engine at runtime, you can do one of two things.
- * Cache::set() will allow you to temporarily reconfigure an engine for one write operation.
- * If you need to permanetly alter a cache engine's configuration at runtime, you should drop it first
- * and then update the configuration in Configure:
- *
- * {{{
- * Cache::drop('fast_cache');
- * Configure::write('Cache.fast_cache', [...]);
- * }}}
- *
- * Reconnecting an engine will reset any data stored in the engine instance as it
- * will be recreated.
- *
- * @package Cake.Cache
- * @see app/Config/cache.php for configuration settings
+ * @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
+ * @return array array(engine, settings) on success, false on failure
+ * @throws CacheException
*/
class Cache {
@@ -211,7 +211,7 @@ public function clearGroup($group) {
/**
* Disconnects from the redis server
*
- * @return voind
+ * @return void
**/
public function __destruct() {
if (!$this->settings['persistent']) {
@@ -31,4 +31,13 @@
*/
public function read($key);
+/**
+ * Dumps the configure data into source.
+ *
+ * @param string $key The identifier to write to.
+ * @param array $data The data to dump.
+ * @return boolean True on success or false on failure.
+ */
+ public function dump($key, $data);
+
}
@@ -103,23 +103,8 @@ public function read($key) {
if (strpos($key, '..') !== false) {
throw new Error\ConfigureException(__d('cake_dev', 'Cannot load configuration files with ../ in them.'));
}
- if (substr($key, -8) === '.ini.php') {
- $key = substr($key, 0, -8);
- list($plugin, $key) = pluginSplit($key);
- $key .= '.ini.php';
- } else {
- if (substr($key, -4) === '.ini') {
- $key = substr($key, 0, -4);
- }
- list($plugin, $key) = pluginSplit($key);
- $key .= '.ini';
- }
- if ($plugin) {
- $file = App::pluginPath($plugin) . 'Config/' . $key;
- } else {
- $file = $this->_path . $key;
- }
+ $file = $this->_getFilePath($key);
if (!is_file($file)) {
throw new Error\ConfigureException(__d('cake_dev', 'Could not load configuration file: %s', $file));
}
@@ -168,23 +153,23 @@ protected function _parseNestedValues($values) {
/**
* Dumps the state of Configure data into an ini formatted string.
*
- * @param string $filename The filename on $this->_path to save into.
- * Extension ".ini" will be automatically appended if not included in filename.
+ * @param string $key The identifier to write to. If the key has a . it will be treated
+ * as a plugin prefix.
* @param array $data The data to convert to ini file.
* @return int Bytes saved.
*/
- public function dump($filename, $data) {
+ public function dump($key, $data) {
$result = array();
- foreach ($data as $key => $value) {
+ foreach ($data as $k => $value) {
$isSection = false;
- if ($key[0] != '[') {
- $result[] = "[$key]";
+ if ($k[0] != '[') {
+ $result[] = "[$k]";
$isSection = true;
}
if (is_array($value)) {
- $keyValues = Hash::flatten($value, '.');
- foreach ($keyValues as $k => $v) {
- $result[] = "$k = " . $this->_value($v);
+ $kValues = Hash::flatten($value, '.');
+ foreach ($kValues as $k2 => $v) {
+ $result[] = "$k2 = " . $this->_value($v);
}
}
if ($isSection) {
@@ -193,10 +178,8 @@ public function dump($filename, $data) {
}
$contents = trim(implode("\n", $result));
- if (substr($filename, -4) !== '.ini') {
- $filename .= '.ini';
- }
- return file_put_contents($this->_path . $filename, $contents);
+ $filename = $this->_getFilePath($key);
+ return file_put_contents($filename, $contents);
}
/**
@@ -218,4 +201,33 @@ protected function _value($val) {
return (string)$val;
}
+/**
+ * Get file path
+ *
+ * @param string $key The identifier to write to. If the key has a . it will be treated
+ * as a plugin prefix.
+ * @return string Full file path
+ */
+ protected function _getFilePath($key) {
+ if (substr($key, -8) === '.ini.php') {
+ $key = substr($key, 0, -8);
+ list($plugin, $key) = pluginSplit($key);
+ $key .= '.ini.php';
+ } else {
+ if (substr($key, -4) === '.ini') {
+ $key = substr($key, 0, -4);
+ }
+ list($plugin, $key) = pluginSplit($key);
+ $key .= '.ini';
+ }
+
+ if ($plugin) {
+ $file = App::pluginPath($plugin) . 'Config' . DS . $key;
+ } else {
+ $file = $this->_path . $key;
+ }
+
+ return $file;
+ }
+
}
@@ -56,7 +56,7 @@ public function __construct($path = null) {
* Files with `.` in the name will be treated as values in plugins. Instead of reading from
* the initialized path, plugin keys will be located using App::pluginPath().
*
- * @param string $key The identifier to read from. If the key has a . it will be treated
+ * @param string $key The identifier to read from. If the key has a . it will be treated
* as a plugin prefix.
* @return array Parsed configuration values.
* @throws Cake\Error\ConfigureException when files don't exist or they don't contain `$config`.
@@ -66,17 +66,8 @@ public function read($key) {
if (strpos($key, '..') !== false) {
throw new Error\ConfigureException(__d('cake_dev', 'Cannot load configuration files with ../ in them.'));
}
- if (substr($key, -4) === '.php') {
- $key = substr($key, 0, -4);
- }
- list($plugin, $key) = pluginSplit($key);
- $key .= '.php';
- if ($plugin) {
- $file = App::pluginPath($plugin) . 'Config/' . $key;
- } else {
- $file = $this->_path . $key;
- }
+ $file = $this->_getFilePath($key);
if (!is_file($file)) {
throw new Error\ConfigureException(__d('cake_dev', 'Could not load configuration file: %s', $file));
}
@@ -94,18 +85,39 @@ public function read($key) {
* Converts the provided $data into a string of PHP code that can
* be used saved into a file and loaded later.
*
- * @param string $filename The filename to create on $this->_path.
- * Extension ".php" will be automatically appended if not included in filename.
+ * @param string $key The identifier to write to. If the key has a . it will be treated
+ * as a plugin prefix.
* @param array $data Data to dump.
* @return int Bytes saved.
*/
- public function dump($filename, $data) {
+ public function dump($key, $data) {
$contents = '<?php' . "\n" . '$config = ' . var_export($data, true) . ';';
- if (substr($filename, -4) !== '.php') {
- $filename .= '.php';
+ $filename = $this->_getFilePath($key);
+ return file_put_contents($filename, $contents);
+ }
+
+/**
+ * Get file path
+ *
+ * @param string $key The identifier to write to. If the key has a . it will be treated
+ * as a plugin prefix.
+ * @return string Full file path
+ */
+ protected function _getFilePath($key) {
+ if (substr($key, -4) === '.php') {
+ $key = substr($key, 0, -4);
+ }
+ list($plugin, $key) = pluginSplit($key);
+ $key .= '.php';
+
+ if ($plugin) {
+ $file = App::pluginPath($plugin) . 'Config' . DS . $key;
+ } else {
+ $file = $this->_path . $key;
}
- return file_put_contents($this->_path . $filename, $contents);
+
+ return $file;
}
}
@@ -104,7 +104,7 @@ protected function _getShellList() {
* @param string $type
* @param array $shells
* @param array $shellList
- * @return array
+ * @return void
*/
protected function _appendShells($type, $shells, &$shellList) {
foreach ($shells as $shell) {
@@ -287,8 +287,8 @@ public function getPath() {
* @return string fields definitions
*/
protected function _generateSchema($tableInfo) {
- $schema = $this->_Schema->generateTable('f', $tableInfo);
- return substr($schema, 13, -2);
+ $schema = trim($this->_Schema->generateTable('f', $tableInfo), "\n");
+ return substr($schema, 13, -1);
}
/**
@@ -171,6 +171,7 @@ public function bake($plugin) {
/**
* Update the app's bootstrap.php file.
*
+ * @param string $plugin Name of plugin
* @return void
*/
protected function _modifyBootstrap($plugin) {
@@ -187,7 +188,7 @@ protected function _modifyBootstrap($plugin) {
* find and change $this->path to the user selection
*
* @param array $pathOptions
- * @return string plugin path
+ * @return void
*/
public function findPath($pathOptions) {
$valid = false;
@@ -341,7 +341,7 @@ public function available() {
* @param string $category
* @param boolean $throwOnMissingFile
* @access protected
- * @return array(type, case)
+ * @return array array(type, case)
* @throws Exception
*/
protected function _mapFileToCase($file, $category, $throwOnMissingFile = true) {
@@ -580,7 +580,8 @@ protected function _parseOption($name, $params) {
$option = $this->_options[$name];
$isBoolean = $option->isBoolean();
$nextValue = $this->_nextToken();
- if (!$isBoolean && !empty($nextValue) && !$this->_optionExists($nextValue)) {
+ $emptyNextValue = (empty($nextValue) && $nextValue !== '0');
+ if (!$isBoolean && !$emptyNextValue && !$this->_optionExists($nextValue)) {
array_shift($this->_tokens);
$value = $nextValue;
} elseif ($isBoolean) {
@@ -45,6 +45,7 @@
* @package Cake.Console
*/
class ConsoleOutput {
+
/**
* Raw output constant - no modification of output text.
*/
@@ -75,7 +76,7 @@ class ConsoleOutput {
/**
* The current output type. Manipulated with ConsoleOutput::outputAs();
*
- * @var integer.
+ * @var integer
*/
protected $_outputAs = self::COLOR;
@@ -176,7 +176,7 @@ protected function _getMaxLength($collection) {
* Get the help as an xml string.
*
* @param boolean $string Return the SimpleXml object or a string. Defaults to true.
- * @return mixed. See $string
+ * @return string|SimpleXmlElement See $string
*/
public function xml($string = true) {
$parser = $this->_parser;
Oops, something went wrong.

0 comments on commit 098c921

Please sign in to comment.