Browse files

Merge branch '2.1' of github.com:cakephp/cakephp into 2.1

Conflicts:
	lib/Cake/Test/Case/Console/Command/TestsuiteShellTest.php
  • Loading branch information...
2 parents 13f5ec1 + 92d0286 commit a538c5d22006c5b73e14b63af94653db074b51d5 @AD7six AD7six committed Oct 18, 2011
Showing with 3,927 additions and 2,431 deletions.
  1. +1 −0 .gitignore
  2. +12 −1 app/Config/Schema/db_acl.php
  3. +12 −1 app/Config/Schema/i18n.php
  4. +12 −1 app/Config/Schema/sessions.php
  5. +2 −3 app/Config/acl.ini.php
  6. +12 −12 app/Config/bootstrap.php
  7. +1 −1 app/Config/core.php
  8. +3 −1 app/Config/database.php.default
  9. +14 −5 app/Config/email.php.default
  10. +1 −1 app/Config/routes.php
  11. +15 −7 app/Console/cake
  12. +32 −32 app/Console/cake.bat
  13. +2 −2 app/webroot/.htaccess
  14. +6 −0 app/webroot/css/cake.generic.css
  15. +1 −1 app/webroot/test.php
  16. +24 −15 lib/Cake/Cache/Engine/FileEngine.php
  17. +4 −1 lib/Cake/Cache/Engine/MemcacheEngine.php
  18. +1 −1 lib/Cake/Config/config.php
  19. +5 −5 lib/Cake/Configure/PhpReader.php
  20. +1 −1 lib/Cake/Console/Command/AclShell.php
  21. +4 −3 lib/Cake/Console/Command/BakeShell.php
  22. +1 −1 lib/Cake/Console/Command/CommandListShell.php
  23. +2 −2 lib/Cake/Console/Command/SchemaShell.php
  24. +4 −1 lib/Cake/Console/Command/Task/BakeTask.php
  25. +2 −2 lib/Cake/Console/Command/Task/ControllerTask.php
  26. +5 −5 lib/Cake/Console/Command/Task/DbConfigTask.php
  27. +2 −0 lib/Cake/Console/Command/Task/ModelTask.php
  28. +0 −2 lib/Cake/Console/Command/Task/PluginTask.php
  29. +52 −29 lib/Cake/Console/Command/Task/TestTask.php
  30. +3 −2 lib/Cake/Console/Command/Task/ViewTask.php
  31. +71 −5 lib/Cake/Console/Command/UpgradeShell.php
  32. +14 −4 lib/Cake/Console/ConsoleErrorHandler.php
  33. +7 −7 lib/Cake/Console/Shell.php
  34. +7 −5 lib/Cake/Console/ShellDispatcher.php
  35. +4 −2 lib/Cake/Console/TaskCollection.php
  36. +1 −1 lib/Cake/Console/Templates/default/actions/controller_actions.ctp
  37. +1 −1 lib/Cake/Console/Templates/default/classes/controller.ctp
  38. +1 −1 lib/Cake/Console/Templates/default/classes/fixture.ctp
  39. +1 −1 lib/Cake/Console/Templates/default/classes/model.ctp
  40. +2 −3 lib/Cake/Console/Templates/default/classes/test.ctp
  41. +1 −1 lib/Cake/Console/Templates/default/views/form.ctp
  42. +16 −3 lib/Cake/Console/Templates/default/views/home.ctp
  43. +1 −1 lib/Cake/Console/Templates/default/views/index.ctp
  44. +1 −1 lib/Cake/Console/Templates/default/views/view.ctp
  45. +1 −1 lib/Cake/Console/Templates/skel/Config/Schema/db_acl.php
  46. +1 −1 lib/Cake/Console/Templates/skel/Config/Schema/i18n.php
  47. +1 −1 lib/Cake/Console/Templates/skel/Config/Schema/sessions.php
  48. +2 −3 lib/Cake/Console/Templates/skel/Config/acl.ini.php
  49. +11 −11 lib/Cake/Console/Templates/skel/Config/bootstrap.php
  50. +2 −2 lib/Cake/Console/Templates/skel/Config/core.php
  51. +2 −0 lib/Cake/Console/Templates/skel/Config/database.php.default
  52. +13 −4 lib/Cake/Console/Templates/skel/Config/email.php.default
  53. +13 −5 lib/Cake/Console/Templates/skel/Console/cake
  54. +32 −32 lib/Cake/Console/Templates/skel/Console/cake.bat
  55. +1 −1 lib/Cake/Console/Templates/skel/Controller/AppController.php
  56. +2 −2 lib/Cake/Console/Templates/skel/Controller/PagesController.php
  57. +1 −1 lib/Cake/Console/Templates/skel/Model/AppModel.php
  58. +1 −1 lib/Cake/Console/Templates/skel/View/Emails/html/default.ctp
  59. +1 −1 lib/Cake/Console/Templates/skel/View/Emails/text/default.ctp
  60. +3 −2 lib/Cake/Console/Templates/skel/View/Helper/AppHelper.php
  61. +1 −1 lib/Cake/Console/Templates/skel/View/Layouts/ajax.ctp
  62. +1 −1 lib/Cake/Console/Templates/skel/View/Layouts/flash.ctp
  63. +2 −2 lib/Cake/Console/Templates/skel/webroot/.htaccess
  64. +276 −91 lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css
  65. +4 −1 lib/Cake/Console/Templates/skel/webroot/index.php
  66. +1 −1 lib/Cake/Console/Templates/skel/webroot/test.php
  67. +11 −3 lib/Cake/Console/cake
  68. +1 −1 lib/Cake/Controller/AppController.php
  69. +5 −2 lib/Cake/Controller/Component.php
  70. +4 −4 lib/Cake/Controller/Component/AclComponent.php
  71. +12 −1 lib/Cake/Controller/Component/Auth/BaseAuthenticate.php
  72. +19 −1 lib/Cake/Controller/Component/Auth/BaseAuthorize.php
  73. +2 −1 lib/Cake/Controller/Component/Auth/CrudAuthorize.php
  74. +1 −1 lib/Cake/Controller/Component/Auth/FormAuthenticate.php
  75. +22 −19 lib/Cake/Controller/Component/AuthComponent.php
  76. +1 −1 lib/Cake/Controller/Component/CookieComponent.php
  77. +2 −3 lib/Cake/Controller/Component/EmailComponent.php
  78. +17 −15 lib/Cake/Controller/Component/PaginatorComponent.php
  79. +37 −15 lib/Cake/Controller/Component/RequestHandlerComponent.php
  80. +5 −5 lib/Cake/Controller/Component/SecurityComponent.php
  81. +8 −9 lib/Cake/Controller/Component/SessionComponent.php
  82. +2 −3 lib/Cake/Controller/ComponentCollection.php
  83. +22 −24 lib/Cake/Controller/Controller.php
  84. +1 −1 lib/Cake/Controller/PagesController.php
  85. +11 −11 lib/Cake/Controller/Scaffold.php
  86. +109 −96 lib/Cake/Core/App.php
  87. +2 −1 lib/Cake/Core/CakePlugin.php
  88. +14 −7 lib/Cake/Core/Configure.php
  89. +4 −2 lib/Cake/Core/Object.php
  90. +2 −2 lib/Cake/Error/ErrorHandler.php
  91. +5 −5 lib/Cake/Error/ExceptionRenderer.php
  92. +18 −60 lib/Cake/Error/exceptions.php
  93. +1 −1 lib/Cake/I18n/I18n.php
  94. +4 −4 lib/Cake/Model/AclNode.php
  95. +0 −2 lib/Cake/Model/Aco.php
  96. +0 −2 lib/Cake/Model/AcoAction.php
  97. +1 −3 lib/Cake/Model/AppModel.php
  98. +7 −6 lib/Cake/Model/Behavior/AclBehavior.php
  99. +2 −25 lib/Cake/Model/Behavior/ContainableBehavior.php
  100. +10 −16 lib/Cake/Model/Behavior/TranslateBehavior.php
  101. +15 −15 lib/Cake/Model/Behavior/TreeBehavior.php
  102. +4 −4 lib/Cake/Model/BehaviorCollection.php
  103. +1 −2 lib/Cake/Model/CakeSchema.php
  104. +6 −15 lib/Cake/Model/ConnectionManager.php
  105. +2 −4 lib/Cake/Model/Datasource/DataSource.php
  106. +33 −25 lib/Cake/Model/Datasource/Database/Mysql.php
  107. +9 −13 lib/Cake/Model/Datasource/Database/Postgres.php
  108. +5 −4 lib/Cake/Model/Datasource/Database/Sqlite.php
  109. +9 −6 lib/Cake/Model/Datasource/Database/Sqlserver.php
  110. +18 −11 lib/Cake/Model/Datasource/DboSource.php
  111. +9 −0 lib/Cake/Model/Datasource/Session/CacheSession.php
  112. +34 −14 lib/Cake/Model/Datasource/Session/DatabaseSession.php
  113. +52 −45 lib/Cake/Model/Model.php
  114. +0 −2 lib/Cake/Model/Permission.php
  115. +7 −7 lib/Cake/Network/CakeRequest.php
  116. +73 −34 lib/Cake/Network/Email/CakeEmail.php
  117. +3 −4 lib/Cake/Network/Email/MailTransport.php
  118. +7 −7 lib/Cake/Network/Email/SmtpTransport.php
  119. +5 −0 lib/Cake/Network/Http/HttpResponse.php
  120. +10 −3 lib/Cake/Routing/Dispatcher.php
  121. +1 −1 lib/Cake/Routing/Router.php
  122. +1 −1 lib/Cake/Test/Case/AllBehaviorsTest.php
  123. +1 −1 lib/Cake/Test/Case/AllControllerTest.php
  124. +1 −1 lib/Cake/Test/Case/AllHelpersTest.php
  125. +1 −1 lib/Cake/Test/Case/AllRoutingTest.php
  126. +1 −1 lib/Cake/Test/Case/AllTestSuiteTest.php
  127. +1 −1 lib/Cake/Test/Case/AllTestsTest.php
  128. +3 −2 lib/Cake/Test/Case/Cache/CacheTest.php
  129. +42 −0 lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
  130. +11 −0 lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
  131. +1 −1 lib/Cake/Test/Case/Configure/IniReaderTest.php
  132. +4 −4 lib/Cake/Test/Case/Console/Command/AclShellTest.php
  133. +1 −1 lib/Cake/Test/Case/Console/Command/CommandListShellTest.php
  134. +30 −11 lib/Cake/Test/Case/Console/Command/ShellTest.php
  135. +9 −9 lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php
  136. +5 −25 lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php
  137. +44 −65 lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php
  138. +15 −15 lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
  139. +49 −9 lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
  140. +32 −27 lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php
  141. +24 −6 lib/Cake/Test/Case/Console/ConsoleErrorHandlerTest.php
  142. +17 −0 lib/Cake/Test/Case/Console/HelpFormatterTest.php
  143. +3 −3 lib/Cake/Test/Case/Console/TaskCollectionTest.php
  144. +3 −0 lib/Cake/Test/Case/Controller/Component/Auth/ActionsAuthorizeTest.php
  145. +3 −0 lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php
  146. +3 −0 lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php
  147. +5 −2 lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php
  148. +3 −0 lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php
  149. +6 −2 lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php
  150. +5 −0 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
  151. +18 −0 lib/Cake/Test/Case/Controller/Component/DbAclTest.php
  152. +1 −1 lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
  153. +18 −0 lib/Cake/Test/Case/Controller/Component/IniAclTest.php
  154. +53 −1 lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
  155. +55 −13 lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php
  156. +2 −2 lib/Cake/Test/Case/Controller/ComponentCollectionTest.php
  157. +4 −534 lib/Cake/Test/Case/Controller/ScaffoldTest.php
  158. +19 −2 lib/Cake/Test/Case/Core/AppTest.php
  159. +17 −1 lib/Cake/Test/Case/Core/CakePluginTest.php
  160. +14 −0 lib/Cake/Test/Case/Core/ConfigureTest.php
  161. +22 −10 lib/Cake/Test/Case/Core/ObjectTest.php
  162. +1 −1 lib/Cake/Test/Case/Error/ErrorHandlerTest.php
  163. +17 −42 lib/Cake/Test/Case/Error/ExceptionRendererTest.php
  164. +2 −2 lib/Cake/Test/Case/Model/Behavior/AclBehaviorTest.php
  165. +75 −1 lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
  166. +1 −1 lib/Cake/Test/Case/Model/BehaviorCollectionTest.php
  167. +11 −21 lib/Cake/Test/Case/Model/CakeSchemaTest.php
  168. +1 −2 lib/Cake/Test/Case/Model/ConnectionManagerTest.php
  169. +74 −14 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
  170. +37 −21 lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
  171. +4 −1 lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php
  172. +17 −0 lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
  173. +98 −42 lib/Cake/Test/Case/Model/ModelIntegrationTest.php
  174. +10 −4 lib/Cake/Test/Case/Model/ModelReadTest.php
  175. +42 −2 lib/Cake/Test/Case/Model/ModelValidationTest.php
  176. +122 −95 lib/Cake/Test/Case/Model/ModelWriteTest.php
  177. +142 −9 lib/Cake/Test/Case/Model/models.php
  178. +6 −6 lib/Cake/Test/Case/Network/CakeRequestTest.php
  179. +63 −0 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
  180. +1 −1 lib/Cake/Test/Case/Network/Http/BasicAuthenticationTest.php
  181. +1 −1 lib/Cake/Test/Case/Network/Http/HttpResponseTest.php
  182. +91 −0 lib/Cake/Test/Case/Routing/DispatcherTest.php
  183. +17 −0 lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php
  184. +18 −0 lib/Cake/Test/Case/Routing/Route/PluginShortRouteTest.php
  185. +17 −0 lib/Cake/Test/Case/Routing/Route/RedirectRouteTest.php
  186. +4 −0 lib/Cake/Test/Case/Routing/RouterTest.php
  187. +11 −11 lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
  188. +2 −1 lib/Cake/Test/Case/Utility/DebuggerTest.php
  189. +17 −17 lib/Cake/Test/Case/Utility/FileTest.php
  190. +40 −1 lib/Cake/Test/Case/Utility/FolderTest.php
  191. +4 −3 lib/Cake/Test/Case/Utility/InflectorTest.php
  192. +11 −1 lib/Cake/Test/Case/Utility/ObjectCollectionTest.php
  193. +20 −0 lib/Cake/Test/Case/Utility/SetTest.php
  194. +2 −0 lib/Cake/Test/Case/Utility/ValidationTest.php
  195. +110 −1 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
  196. +3 −6 lib/Cake/Test/Case/View/Helper/JqueryEngineHelperTest.php
  197. +2 −7 lib/Cake/Test/Case/View/Helper/MootoolsEngineHelperTest.php
  198. +2 −5 lib/Cake/Test/Case/View/Helper/PrototypeEngineHelperTest.php
  199. +10 −0 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
  200. +10 −2 lib/Cake/Test/Case/View/Helper/TimeHelperTest.php
  201. +2 −2 lib/Cake/Test/Case/View/HelperCollectionTest.php
  202. +6 −2 lib/Cake/Test/Case/View/HelperTest.php
  203. +1 −1 lib/Cake/Test/Case/View/MediaViewTest.php
  204. +462 −0 lib/Cake/Test/Case/View/ScaffoldViewTest.php
  205. +3 −3 lib/Cake/Test/Case/View/ThemeViewTest.php
  206. +2 −2 lib/Cake/Test/Case/View/ViewTest.php
  207. +10 −10 lib/Cake/Test/Fixture/AroTwoFixture.php
  208. +20 −20 lib/Cake/Test/Fixture/ArosAcoTwoFixture.php
  209. +5 −5 lib/Cake/Test/Fixture/DataTestFixture.php
  210. +4 −4 lib/Cake/Test/Fixture/DatatypeFixture.php
  211. +3 −3 lib/Cake/Test/Fixture/PrefixTestFixture.php
  212. +1 −1 lib/Cake/Test/test_app/Console/Command/SampleShell.php
  213. +1 −1 lib/Cake/Test/test_app/Controller/TestsAppsController.php
  214. +1 −1 lib/Cake/Test/test_app/Controller/TestsAppsPostsController.php
  215. +1 −0 lib/Cake/Test/test_app/View/Elements/test_element.xml
  216. +2 −1 lib/Cake/Test/test_app/View/Themed/TestTheme/Layouts/default.ctp
  217. 0 ...Cake/Test/test_app/View/Themed/TestTheme/{Plugins → Plugin}/TestPlugin/Layouts/plugin_default.ctp
  218. 0 lib/Cake/Test/test_app/View/Themed/TestTheme/{Plugins → Plugin}/TestPlugin/Tests/index.ctp
  219. +4 −0 lib/Cake/Test/test_app/View/Themed/TestTheme/Posts/themed.ctp
  220. BIN lib/Cake/Test/test_app/webroot/img/cake.power.gif
  221. +1 −0 lib/Cake/TestSuite/CakeTestLoader.php
  222. +1 −1 lib/Cake/TestSuite/CakeTestRunner.php
  223. +1 −1 lib/Cake/TestSuite/CakeTestSuite.php
  224. +1 −1 lib/Cake/TestSuite/CakeTestSuiteCommand.php
  225. +10 −7 lib/Cake/TestSuite/ControllerTestCase.php
  226. +2 −4 lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
  227. +0 −2 lib/Cake/TestSuite/Reporter/CakeBaseReporter.php
  228. +0 −2 lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
  229. +0 −2 lib/Cake/TestSuite/Reporter/CakeTextReporter.php
  230. +6 −10 lib/Cake/TestSuite/templates/phpunit.php
  231. +11 −10 lib/Cake/Utility/Debugger.php
  232. +3 −3 lib/Cake/Utility/File.php
  233. +1 −1 lib/Cake/Utility/Folder.php
  234. +16 −12 lib/Cake/Utility/Inflector.php
  235. +2 −1 lib/Cake/Utility/ObjectCollection.php
  236. +1 −1 lib/Cake/Utility/Set.php
  237. +1 −1 lib/Cake/Utility/Validation.php
  238. +1 −1 lib/Cake/View/Elements/exception_stack_trace.ctp
  239. +1 −1 lib/Cake/View/Elements/sql_dump.ctp
  240. +1 −1 lib/Cake/View/Emails/html/default.ctp
  241. +1 −1 lib/Cake/View/Emails/text/default.ctp
  242. +1 −1 lib/Cake/View/Errors/error400.ctp
  243. +1 −1 lib/Cake/View/Errors/error500.ctp
  244. +2 −2 lib/Cake/View/Errors/missing_action.ctp
  245. +8 −7 lib/Cake/View/Errors/{missing_behavior_class.ctp → missing_behavior.ctp}
  246. +0 −39 lib/Cake/View/Errors/missing_behavior_file.ctp
  247. +7 −6 lib/Cake/View/Errors/{missing_component_file.ctp → missing_component.ctp}
  248. +1 −1 lib/Cake/View/Errors/missing_connection.ctp
  249. +5 −4 lib/Cake/View/Errors/missing_controller.ctp
  250. +2 −2 lib/Cake/View/Errors/missing_database.ctp
  251. +5 −4 lib/Cake/View/Errors/{missing_datasource_file.ctp → missing_datasource.ctp}
  252. +1 −1 lib/Cake/View/Errors/missing_datasource_config.ctp
  253. +7 −6 lib/Cake/View/Errors/{missing_component_class.ctp → missing_helper.ctp}
  254. +0 −39 lib/Cake/View/Errors/missing_helper_class.ctp
  255. +0 −39 lib/Cake/View/Errors/missing_helper_file.ctp
  256. +1 −1 lib/Cake/View/Errors/missing_layout.ctp
  257. +1 −1 lib/Cake/View/Errors/missing_plugin.ctp
  258. +1 −1 lib/Cake/View/Errors/missing_table.ctp
  259. +1 −1 lib/Cake/View/Errors/missing_view.ctp
  260. +1 −1 lib/Cake/View/Errors/pdo_error.ctp
  261. +1 −1 lib/Cake/View/Errors/private_action.ctp
  262. +1 −1 lib/Cake/View/Errors/scaffold_error.ctp
  263. +12 −13 lib/Cake/View/Helper.php
  264. +1 −1 lib/Cake/View/Helper/AppHelper.php
  265. +1 −1 lib/Cake/View/Helper/CacheHelper.php
  266. +80 −52 lib/Cake/View/Helper/FormHelper.php
  267. +18 −17 lib/Cake/View/Helper/HtmlHelper.php
  268. +3 −3 lib/Cake/View/Helper/JsHelper.php
  269. +10 −10 lib/Cake/View/Helper/NumberHelper.php
  270. +3 −3 lib/Cake/View/Helper/PaginatorHelper.php
  271. +1 −1 lib/Cake/View/Helper/RssHelper.php
  272. +6 −6 lib/Cake/View/Helper/SessionHelper.php
  273. +10 −10 lib/Cake/View/Helper/TextHelper.php
  274. +34 −23 lib/Cake/View/Helper/TimeHelper.php
  275. +3 −3 lib/Cake/View/HelperCollection.php
  276. +1 −1 lib/Cake/View/Layouts/Emails/html/default.ctp
  277. +1 −1 lib/Cake/View/Layouts/Emails/text/default.ctp
  278. +1 −1 lib/Cake/View/Layouts/ajax.ctp
  279. +1 −1 lib/Cake/View/Layouts/default.ctp
  280. +2 −2 lib/Cake/View/Layouts/flash.ctp
  281. +19 −6 lib/Cake/View/Pages/home.ctp
  282. +1 −1 lib/Cake/View/Scaffolds/form.ctp
  283. +1 −1 lib/Cake/View/Scaffolds/index.ctp
  284. +1 −1 lib/Cake/View/Scaffolds/view.ctp
  285. +5 −3 lib/Cake/View/ThemeView.php
  286. +1 −1 lib/Cake/View/View.php
  287. +11 −11 lib/Cake/basics.php
View
1 .gitignore
@@ -1,5 +1,6 @@
/app/Config
/app/tmp
+/lib/Cake/Console/Templates/skel/tmp/
/plugins
/vendors
.DS_Store
View
13 app/Config/Schema/db_acl.php
@@ -1,5 +1,6 @@
<?php
/*DbAcl schema generated on: 2007-11-24 15:11:13 : 1195945453*/
+
/**
* This is Acl Schema file
*
@@ -15,10 +16,11 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package app.config.sql
+ * @package app.Config.Schema
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
/*
*
* Using the Schema command line utility
@@ -27,6 +29,15 @@
*/
class DbAclSchema extends CakeSchema {
+ public $name = 'DbAcl';
+
+ public function before($event = array()) {
+ return true;
+ }
+
+ public function after($event = array()) {
+ }
+
public $acos = array(
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
View
13 app/Config/Schema/i18n.php
@@ -1,5 +1,6 @@
<?php
/*i18n schema generated on: 2007-11-25 07:11:25 : 1196004805*/
+
/**
* This is i18n Schema file
*
@@ -15,10 +16,11 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package app.config.sql
+ * @package app.Config.Schema
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
/*
*
* Using the Schema command line utility
@@ -27,6 +29,15 @@
*/
class i18nSchema extends CakeSchema {
+ public $name = 'i18n';
+
+ public function before($event = array()) {
+ return true;
+ }
+
+ public function after($event = array()) {
+ }
+
public $i18n = array(
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'locale' => array('type'=>'string', 'null' => false, 'length' => 6, 'key' => 'index'),
View
13 app/Config/Schema/sessions.php
@@ -1,5 +1,6 @@
<?php
/*Sessions schema generated on: 2007-11-25 07:11:54 : 1196004714*/
+
/**
* This is Sessions Schema file
*
@@ -15,10 +16,11 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package app.config.sql
+ * @package app.Config.Schema
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
/*
*
* Using the Schema command line utility
@@ -27,6 +29,15 @@
*/
class SessionsSchema extends CakeSchema {
+ public $name = 'Sessions';
+
+ public function before($event = array()) {
+ return true;
+ }
+
+ public function after($event = array()) {
+ }
+
public $cake_sessions = array(
'id' => array('type'=>'string', 'null' => false, 'key' => 'primary'),
'data' => array('type'=>'text', 'null' => true, 'default' => NULL),
View
5 app/Config/acl.ini.php
@@ -1,20 +1,19 @@
;<?php exit() ?>
-; SVN FILE: $Id$
;/**
; * ACL Configuration
; *
; *
; * PHP 5
; *
-; * CakePHP(tm) : Rapid Development Framework http://cakephp.org
+; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
; * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
; *
; * Licensed under The MIT License
; * Redistributions of files must retain the above copyright notice.
; *
; * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
; * @link http://cakephp.org CakePHP(tm) Project
-; * @package app.config
+; * @package app.Config
; * @since CakePHP(tm) v 0.10.0.1076
; * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
; */
View
24 app/Config/bootstrap.php
@@ -18,7 +18,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package app.config
+ * @package app.Config
* @since CakePHP(tm) v 0.10.8.2117
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@@ -30,16 +30,16 @@
* The settings below can be used to set additional paths to models, views and controllers.
*
* App::build(array(
- * '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/'),
- * '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/'),
- * 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
- * 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
- * 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
+ * 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
+ * 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'),
+ * 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'),
+ * 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
+ * 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
+ * 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
+ * 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'),
+ * 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
+ * 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
+ * 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
* 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/')
* ));
*
@@ -62,4 +62,4 @@
* CakePlugin::loadAll(); // Loads all plugins at once
* CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
*
- */
+ */
View
2 app/Config/core.php
@@ -14,7 +14,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package app.config
+ * @package app.Config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
View
4 app/Config/database.php.default
@@ -14,7 +14,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package app.config
+ * @package app.Config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@@ -54,6 +54,8 @@
* For MySQL, Postgres specifies the character encoding to use when connecting to the
* database. Uses database default not specified.
*
+ * unix_socket =>
+ * For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port`
*/
class DATABASE_CONFIG {
View
19 app/Config/email.php.default
@@ -14,7 +14,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package app.config
+ * @package app.Config
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@@ -30,6 +30,7 @@
* transport => The name of a supported transport; valid options are as follows:
* Mail - Send using PHP mail function
* Smtp - Send using SMTP
+ * Debug - Do not send the email, just return the result
*
* You can add custom transports (or override existing transports) by adding the
* appropriate file to app/Network/Email. Transports should be named 'YourTransport.php',
@@ -43,18 +44,23 @@ class EmailConfig {
public $default = array(
'transport' => 'Mail',
- 'from' => 'you@localhost'
+ 'from' => 'you@localhost',
+ //'charset' => 'utf-8',
+ //'headerCharset' => 'utf-8',
);
public $smtp = array(
'transport' => 'Smtp',
- 'from' => array('My Site', 'site@localhost'),
+ 'from' => array('site@localhost' => 'My Site'),
'host' => 'localhost',
'port' => 25,
'timeout' => 30,
'username' => 'user',
'password' => 'secret',
- 'client' => null
+ 'client' => null,
+ 'log' => false
+ //'charset' => 'utf-8',
+ //'headerCharset' => 'utf-8',
);
public $fast = array(
@@ -82,7 +88,10 @@ class EmailConfig {
'timeout' => 30,
'username' => 'user',
'password' => 'secret',
- 'client' => null
+ 'client' => null,
+ 'log' => true,
+ //'charset' => 'utf-8',
+ //'headerCharset' => 'utf-8',
);
}
View
2 app/Config/routes.php
@@ -16,7 +16,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package app.config
+ * @package app.Config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
View
22 app/Console/cake
@@ -11,15 +11,23 @@
# Redistributions of files must retain the above copyright notice.
#
# @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
-# @link http://cakephp.org CakePHP(tm) Project
-# @package app.console
-# @since CakePHP(tm) v 2.0
-# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+# @link http://cakephp.org CakePHP(tm) Project
+# @package app.Console
+# @since CakePHP(tm) v 2.0
+# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#
################################################################################
-LIB=${0/%cake/}
+LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")
+
+while [ -h "$LIB" ]; do
+ DIR=$(dirname -- "$LIB")
+ SYM=$(readlink "$LIB")
+ LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
+done
+
+LIB=$(dirname -- "$LIB")/
APP=`pwd`
-exec php -q ${LIB}cake.php -working "${APP}" "$@"
+exec php -q "$LIB"cake.php -working "$APP" "$@"
-exit;
+exit;
View
64 app/Console/cake.bat
@@ -1,32 +1,32 @@
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-::
-:: Bake is a shell script for running CakePHP bake script
-:: PHP 5
-::
-:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
-:: Copyright 2005-2011, Cake Software Foundation, Inc.
-::
-:: Licensed under The MIT License
-:: Redistributions of files must retain the above copyright notice.
-::
-:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
-:: @link http://cakephp.org CakePHP(tm) Project
-:: @package app.console
-:: @since CakePHP(tm) v 2.0
-:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
-::
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
-
-@echo.
-@echo off
-
-SET app=%0
-SET lib=%~dp0
-
-php -q "%lib%cake.php" -working "%CD% " %*
-
-echo.
-
-exit /B %ERRORLEVEL%
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Bake is a shell script for running CakePHP bake script
+:: PHP 5
+::
+:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+:: Copyright 2005-2011, Cake Software Foundation, Inc.
+::
+:: Licensed under The MIT License
+:: Redistributions of files must retain the above copyright notice.
+::
+:: @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
+:: @link http://cakephp.org CakePHP(tm) Project
+:: @package app.Console
+:: @since CakePHP(tm) v 2.0
+:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
+
+@echo.
+@echo off
+
+SET app=%0
+SET lib=%~dp0
+
+php -q "%lib%cake.php" -working "%CD% " %*
+
+echo.
+
+exit /B %ERRORLEVEL%
View
4 app/webroot/.htaccess
@@ -2,5 +2,5 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
- RewriteRule ^(.*)$ index.php/$1 [QSA,L]
-</IfModule>
+ RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
+</IfModule>
View
6 app/webroot/css/cake.generic.css
@@ -354,6 +354,7 @@ input[type=submit] {
}
form .submit input[type=submit] {
background:#62af56;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
border-color: #2d6324;
@@ -414,6 +415,7 @@ p.error,
background-repeat: repeat-x;
background-image: -moz-linear-gradient(top, #ffcc00, #E6B800);
background-image: -ms-linear-gradient(top, #ffcc00, #E6B800);
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#ffcc00), to(#E6B800));
background-image: -webkit-linear-gradient(top, #ffcc00, #E6B800);
background-image: -o-linear-gradient(top, #ffcc00, #E6B800);
background-image: linear-gradient(top, #ffcc00, #E6B800);
@@ -442,6 +444,7 @@ p.error,
background-repeat: repeat-x;
background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35);
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));
background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
background-image: linear-gradient(top, #ee5f5b, #c43c35);
@@ -453,6 +456,7 @@ p.error,
border: 1px solid rgba(0, 0, 0, 0.5);
background: #3B8230;
background-repeat: repeat-x;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
background-image: -ms-linear-gradient(top, #76BF6B, #3B8230);
@@ -505,6 +509,7 @@ input[type=submit],
font-weight:normal;
padding: 4px 8px;
background: #dcdcdc;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#dcdcdc));
background-image: -webkit-linear-gradient(top, #fefefe, #dcdcdc);
background-image: -moz-linear-gradient(top, #fefefe, #dcdcdc);
background-image: -ms-linear-gradient(top, #fefefe, #dcdcdc);
@@ -534,6 +539,7 @@ input[type=submit]:active,
.actions ul li a:active,
.actions a:active {
background: #eee;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#dfdfdf), to(#eee));
background-image: -webkit-linear-gradient(top, #dfdfdf, #eee);
background-image: -moz-linear-gradient(top, #dfdfdf, #eee);
background-image: -ms-linear-gradient(top, #dfdfdf, #eee);
View
2 app/webroot/test.php
@@ -84,7 +84,7 @@
}
if (Configure::read('debug') < 1) {
- die(__d('cake', 'Debug setting does not allow access to this url.'));
+ die(__d('cake_dev', 'Debug setting does not allow access to this url.'));
}
require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';
View
39 lib/Cake/Cache/Engine/FileEngine.php
@@ -66,8 +66,8 @@ class FileEngine extends CacheEngine {
public function init($settings = array()) {
parent::init(array_merge(
array(
- 'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> false,
- 'serialize'=> true, 'isWindows' => false
+ 'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> true,
+ 'serialize'=> true, 'isWindows' => false, 'mask' => 0664
),
$settings
));
@@ -124,21 +124,16 @@ public function write($key, $data, $duration) {
$expires = time() + $duration;
$contents = $expires . $lineBreak . $data . $lineBreak;
- if (!$handle = fopen($this->_File->getPathName(), 'c')) {
- return false;
- }
-
if ($this->settings['lock']) {
- flock($handle, LOCK_EX);
+ $this->_File->flock(LOCK_EX);
}
- $success = ftruncate($handle, 0) && fwrite($handle, $contents) && fflush($handle);
+ $success = $this->_File->ftruncate(0) && $this->_File->fwrite($contents) && $this->_File->fflush();
if ($this->settings['lock']) {
- flock($handle, LOCK_UN);
+ $this->_File->flock(LOCK_UN);
}
- fclose($handle);
return $success;
}
@@ -162,6 +157,9 @@ public function read($key) {
$cachetime = intval($this->_File->current());
if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
+ if ($this->settings['lock']) {
+ $this->_File->flock(LOCK_UN);
+ }
return false;
}
@@ -273,7 +271,8 @@ public function increment($key, $offset = 1) {
}
/**
- * Sets the current cache key this class is managing
+ * Sets the current cache key this class is managing, and creates a writable SplFileObject
+ * for the cache file the key is refering to.
*
* @param string $key The key
* @param boolean $createKey Whether the key should be created if it doesn't exists, or not
@@ -285,12 +284,22 @@ protected function _setKey($key, $createKey = false) {
if (!$createKey && !$path->isFile()) {
return false;
}
- $old = umask(0);
if (empty($this->_File) || $this->_File->getBaseName() !== $key) {
- $this->_File = $path->openFile('a+');
- }
- umask($old);
+ $exists = file_exists($path->getPathname());
+ try {
+ $this->_File = $path->openFile('c+');
+ } catch (Exception $e) {
+ trigger_error($e->getMessage(), E_USER_WARNING);
+ return false;
+ }
+ unset($path);
+ if (!$exists && !chmod($this->_File->getPathname(), (int) $this->settings['mask'])) {
+ trigger_error(__d(
+ 'cake_dev', 'Could not apply permission mask "%s" on cache file "%s"',
+ array($this->_File->getPathname(), $this->settings['mask'])), E_USER_WARNING);
+ }
+ }
return true;
}
View
5 lib/Cake/Cache/Engine/MemcacheEngine.php
@@ -89,12 +89,15 @@ public function init($settings = array()) {
/**
* Parses the server address into the host/port. Handles both IPv6 and IPv4
- * addresses
+ * addresses and Unix sockets
*
* @param string $server The server address string.
* @return array Array containing host, port
*/
protected function _parseServerString($server) {
+ if ($server[0] == 'u') {
+ return array($server, 0);
+ }
if (substr($server, 0, 1) == '[') {
$position = strpos($server, ']:');
if ($position !== false) {
View
2 lib/Cake/Config/config.php
@@ -16,4 +16,4 @@
* @since CakePHP(tm) v 1.1.11.4062
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-return $config['Cake.version'] = '2.0.0-RC1';
+return $config['Cake.version'] = '2.0.0';
View
10 lib/Cake/Configure/PhpReader.php
@@ -11,7 +11,7 @@
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/configuration.html#loading-configuration-files CakePHP(tm) Configuration
* @package Cake.Configure
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -72,10 +72,10 @@ public function read($key) {
} else {
$file = $this->_path . $key;
}
- if (!file_exists($file)) {
- $file .= '.php';
- if (!file_exists($file)) {
- throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', substr($file, 0, -4), $file));
+ $file .= '.php';
+ if (!is_file($file)) {
+ if (!is_file(substr($file, 0, -4))) {
+ throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', $file, substr($file, 0, -4)));
}
}
include $file;
View
2 lib/Cake/Console/Command/AclShell.php
@@ -427,7 +427,7 @@ public function getOptionParser() {
'help' => __d('cake_console', 'Check the permissions between an ACO and ARO.'),
'parser' => array(
'description' => array(
- __d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).')
+ __d('cake_console', 'Use this command to check ACL permissions.')
),
'arguments' => array(
'aro' => array('help' => __d('cake_console', 'ARO to check.'), 'required' => true),
View
7 lib/Cake/Console/Command/BakeShell.php
@@ -26,7 +26,7 @@
* Bake is a command-line code generation utility for automating programmer chores.
*
* @package Cake.Console.Command
- * @link http://book.cakephp.org/view/1522/Code-Generation-with-Bake
+ * @link http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html
*/
class BakeShell extends Shell {
@@ -51,6 +51,9 @@ class BakeShell extends Shell {
*/
public function startup() {
parent::startup();
+ Configure::write('debug', 2);
+ Configure::write('Cache.disable', 1);
+
$task = Inflector::classify($this->command);
if (isset($this->{$task}) && !in_array($task, array('Project', 'DbConfig'))) {
if (isset($this->params['connection'])) {
@@ -65,8 +68,6 @@ public function startup() {
* @return mixed
*/
public function main() {
- Configure::write('Cache.disable', 1);
-
if (!is_dir($this->DbConfig->path)) {
$path = $this->Project->execute();
if (!empty($path)) {
View
2 lib/Cake/Console/Command/CommandListShell.php
@@ -1,6 +1,6 @@
<?php
/**
- * CommandListTest file
+ * Command list Shell
*
* PHP 5
*
View
4 lib/Cake/Console/Command/SchemaShell.php
@@ -26,7 +26,7 @@
* Schema is a command-line database management utility for automating programmer chores.
*
* @package Cake.Console.Command
- * @link http://book.cakephp.org/view/1523/Schema-management-and-migrations
+ * @link http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
*/
class SchemaShell extends Shell {
@@ -428,7 +428,7 @@ protected function _run($contents, $event, &$Schema) {
$Schema->after(array($event => $table, 'errors' => $error));
if (!empty($error)) {
- $this->out($error);
+ $this->err($error);
} else {
$this->out(__d('cake_console', '%s updated.', $table));
}
View
5 lib/Cake/Console/Command/Task/BakeTask.php
@@ -15,6 +15,8 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
+App::uses('Shell', 'Console');
/**
* Base class for Bake Tasks.
*
@@ -44,12 +46,13 @@ class BakeTask extends Shell {
public $interactive = false;
/**
- * Disable caching for baking.
+ * Disable caching and enable debug for baking.
* This forces the most current database schema to be used.
*
* @return void
*/
function startup() {
+ Configure::write('debug', 2);
Configure::write('Cache.disable', 1);
parent::startup();
}
View
4 lib/Cake/Console/Command/Task/ControllerTask.php
@@ -302,7 +302,7 @@ public function bakeActions($controllerName, $admin = null, $wannaUseSession = t
/**
* Assembles and writes a Controller file
*
- * @param string $controllerName Controller name
+ * @param string $controllerName Controller name already pluralized and correctly cased.
* @param string $actions Actions to add, or set the whole controller to use $scaffold (set $actions to 'scaffold')
* @param array $helpers Helpers to use in controller
* @param array $components Components to use in controller
@@ -321,7 +321,7 @@ public function bake($controllerName, $actions = '', $helpers = null, $component
$contents = $this->Template->generate('classes', 'controller');
$path = $this->getPath();
- $filename = $path . $this->_controllerName($controllerName) . 'Controller.php';
+ $filename = $path . $controllerName . 'Controller.php';
if ($this->createFile($filename, $contents)) {
return $contents;
}
View
10 lib/Cake/Console/Command/Task/DbConfigTask.php
@@ -353,16 +353,16 @@ public function bake($configs) {
*/
public function getConfig() {
App::uses('ConnectionManager', 'Model');
+ $configs = ConnectionManager::enumConnectionObjects();
- $useDbConfig = 'default';
- $configs = get_class_vars($this->databaseClassName);
- if (!is_array($configs)) {
+ $useDbConfig = key($configs);
+ if (!is_array($configs) || empty($configs)) {
return $this->execute();
}
-
$connections = array_keys($configs);
+
if (count($connections) > 1) {
- $useDbConfig = $this->in(__d('cake_console', 'Use Database Config') .':', $connections, 'default');
+ $useDbConfig = $this->in(__d('cake_console', 'Use Database Config') .':', $connections, $useDbConfig);
}
return $useDbConfig;
}
View
2 lib/Cake/Console/Command/Task/ModelTask.php
@@ -405,6 +405,8 @@ public function fieldValidation($fieldName, $metaData, $primaryKey = 'id') {
$guess = $methods['date'];
} elseif ($metaData['type'] == 'time') {
$guess = $methods['time'];
+ } elseif ($metaData['type'] == 'inet') {
+ $guess = $methods['ip'];
}
}
View
2 lib/Cake/Console/Command/Task/PluginTask.php
@@ -134,15 +134,13 @@ public function bake($plugin) {
$out = "<?php\n\n";
$out .= "class {$plugin}AppController extends AppController {\n\n";
$out .= "}\n\n";
- $out .= "?>";
$this->createFile($this->path . $plugin. DS . 'Controller' . DS . $controllerFileName, $out);
$modelFileName = $plugin . 'AppModel.php';
$out = "<?php\n\n";
$out .= "class {$plugin}AppModel extends AppModel {\n\n";
$out .= "}\n\n";
- $out .= "?>";
$this->createFile($this->path . $plugin . DS . 'Model' . DS . $modelFileName, $out);
$this->hr();
View
81 lib/Cake/Console/Command/Task/TestTask.php
@@ -116,18 +116,22 @@ protected function _interactive($type = null) {
* @return string|boolean
*/
public function bake($type, $className) {
- if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
+ $plugin = null;
+ if ($this->plugin) {
+ $plugin = $this->plugin . '.';
+ }
+
+ $realType = $this->mapType($type, $plugin);
+ $fullClassName = $this->getRealClassName($type, $className);
+
+ if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($realType, $fullClassName)) {
$this->out(__d('cake_console', 'Bake is detecting possible fixtures...'));
$testSubject = $this->buildTestSubject($type, $className);
$this->generateFixtureList($testSubject);
} elseif ($this->interactive) {
$this->getUserFixtures();
}
- $fullClassName = $className;
-
- if (!$this->interactive) {
- $fullClassName = $this->getRealClassName($type, $className);
- }
+ App::uses($fullClassName, $realType);
$methods = array();
if (class_exists($fullClassName)) {
@@ -136,15 +140,14 @@ public function bake($type, $className) {
$mock = $this->hasMockClass($type, $fullClassName);
$construction = $this->generateConstructor($type, $fullClassName);
- $plugin = null;
- if ($this->plugin) {
- $plugin = $this->plugin . '.';
- }
$this->out("\n" . __d('cake_console', 'Baking test case for %s %s ...', $className, $type), 1, Shell::QUIET);
$this->Template->set('fixtures', $this->_fixtures);
$this->Template->set('plugin', $plugin);
- $this->Template->set(compact('className', 'methods', 'type', 'fullClassName', 'mock', 'construction'));
+ $this->Template->set(compact(
+ 'className', 'methods', 'type', 'fullClassName', 'mock',
+ 'construction', 'realType'
+ ));
$out = $this->Template->generate('classes', 'test');
$filename = $this->testCaseFileName($type, $className);
@@ -187,15 +190,10 @@ public function getObjectType() {
* @return string Class name the user chose.
*/
public function getClassName($objectType) {
- $type = strtolower($objectType);
+ $type = ucfirst(strtolower($objectType));
+ $typeLength = strlen($type);
+ $type = $this->classTypes[$type];
if ($this->plugin) {
- if ($type === 'helper') {
- $type = 'View/Helper';
- } elseif ($type === 'component') {
- $type = 'Controller/Component';
- } elseif ($type === 'behavior') {
- $type = 'Model/Behavior';
- }
$plugin = $this->plugin . '.';
$options = App::objects($plugin . $type);
} else {
@@ -209,7 +207,10 @@ public function getClassName($objectType) {
}
$selection = $this->in(__d('cake_console', 'Choose an existing class, or enter the name of a class that does not exist'));
if (isset($options[$selection - 1])) {
- return $options[$selection - 1];
+ $selection = $options[$selection - 1];
+ }
+ if ($type !== 'Model') {
+ $selection = substr($selection, 0, $typeLength * - 1);
}
return $selection;
}
@@ -223,18 +224,19 @@ public function getClassName($objectType) {
*/
public function typeCanDetectFixtures($type) {
$type = strtolower($type);
- return ($type == 'controller' || $type == 'model');
+ return in_array($type, array('controller', 'model'));
}
/**
- * Check if a class with the given type is loaded or can be loaded.
+ * Check if a class with the given package is loaded or can be loaded.
*
- * @param string $type The Type of object you are generating tests for eg. controller
+ * @param string $package The package of object you are generating tests for eg. controller
* @param string $class the Classname of the class the test is being generated for.
* @return boolean
*/
- public function isLoadableClass($type, $class) {
- return App::import($type, $class);
+ public function isLoadableClass($package, $class) {
+ App::uses($class, $package);
+ return class_exists($class);
}
/**
@@ -258,7 +260,8 @@ public function &buildTestSubject($type, $class) {
}
/**
- * Gets the real class name from the cake short form.
+ * Gets the real class name from the cake short form. If the class name is already
+ * suffixed with the type, the type will not be duplicated.
*
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $class the Classname of the class the test is being generated for.
@@ -268,10 +271,32 @@ public function getRealClassName($type, $class) {
if (strtolower($type) == 'model' || empty($this->classTypes[$type])) {
return $class;
}
+ if (strlen($class) - strpos($class, $type) == strlen($type)) {
+ return $class;
+ }
return $class . $type;
}
/**
+ * Map the types that TestTask uses to concrete types that App::uses can use.
+ *
+ * @param string $type The type of thing having a test generated.
+ * @param string $plugin The plugin name.
+ * @return string
+ */
+ public function mapType($type, $plugin) {
+ $type = ucfirst($type);
+ if (empty($this->classTypes[$type])) {
+ throw new CakeException(__d('cake_dev', 'Invalid object type.'));
+ }
+ $real = $this->classTypes[$type];
+ if ($plugin) {
+ $real = trim($plugin, '.') . '.' . $real;
+ }
+ return $real;
+ }
+
+/**
* Get methods declared in the class given.
* No parent methods will be returned
*
@@ -429,9 +454,7 @@ public function testCaseFileName($type, $className) {
if (isset($this->classTypes[$type])) {
$path .= $this->classTypes[$type] . DS;
}
- if (!$this->interactive) {
- $className = $this->getRealClassName($type, $className);
- }
+ $className = $this->getRealClassName($type, $className);
return str_replace('/', DS, $path) . Inflector::camelize($className) . 'Test.php';
}
View
5 lib/Cake/Console/Command/Task/ViewTask.php
@@ -327,7 +327,7 @@ public function customAction() {
$this->hr();
$this->out(__d('cake_console', 'Controller Name: %s', $this->controllerName));
$this->out(__d('cake_console', 'Action Name: %s', $action));
- $this->out(__d('cake_console', 'Path: %s', $this->params['app'] . DS . $this->controllerName . DS . Inflector::underscore($action) . ".ctp"));
+ $this->out(__d('cake_console', 'Path: %s', $this->params['app'] . DS . 'View' . DS . $this->controllerName . DS . Inflector::underscore($action) . ".ctp"));
$this->hr();
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y','n'), 'y');
if (strtolower($looksGood) == 'y') {
@@ -449,10 +449,11 @@ protected function _associations($model) {
foreach ($keys as $key => $type) {
foreach ($model->{$type} as $assocKey => $assocData) {
+ list($plugin, $modelClass) = pluginSplit($assocData['className']);
$associations[$type][$assocKey]['primaryKey'] = $model->{$assocKey}->primaryKey;
$associations[$type][$assocKey]['displayField'] = $model->{$assocKey}->displayField;
$associations[$type][$assocKey]['foreignKey'] = $assocData['foreignKey'];
- $associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($assocData['className']));
+ $associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($modelClass));
$associations[$type][$assocKey]['fields'] = array_keys($model->{$assocKey}->schema(true));
}
}
View
76 lib/Cake/Console/Command/UpgradeShell.php
@@ -93,6 +93,29 @@ public function all() {
}
/**
+ * Update tests.
+ *
+ * - Update tests class names to FooTest rather than FooTestCase.
+ *
+ * @return void
+ */
+ public function tests() {
+ $this->_paths = array(APP . 'tests' . DS);
+ if (!empty($this->params['plugin'])) {
+ $this->_paths = App::pluginPath($this->params['plugin']) . 'tests' . DS;
+ }
+ $patterns = array(
+ array(
+ '*TestCase extends CakeTestCase to *Test extends CakeTestCase',
+ '/([a-zA-Z]*Test)Case extends CakeTestCase/',
+ '\1 extends CakeTestCase'
+ ),
+ );
+
+ $this->_filesRegexpUpdate($patterns);
+ }
+
+/**
* Move files and folders to their new homes
*
* Moves folders containing files which cannot necessarily be auto-detected (libs and templates)
@@ -109,7 +132,6 @@ public function locations() {
}
if (is_dir('plugins')) {
-
$Folder = new Folder('plugins');
list($plugins) = $Folder->read();
foreach($plugins as $plugin) {
@@ -120,8 +142,13 @@ public function locations() {
chdir($cwd);
}
+ $this->_moveViewFiles();
+
$moves = array(
'libs' => 'Lib',
+ 'tests' => 'Test',
+ 'Test' . DS . 'cases' => 'Test' . DS . 'Case',
+ 'Test' . DS . 'fixtures' => 'Test' . DS . 'Fixture',
'vendors' . DS . 'shells' . DS . 'templates' => 'Console' . DS . 'Templates',
);
foreach($moves as $old => $new) {
@@ -145,6 +172,7 @@ public function locations() {
'Lib' => array('checkFolder' => false),
'Model',
'models',
+ 'Test' => array('regex' => '@class (\S*Test) extends CakeTestCase@'),
'tests',
'View',
'views',
@@ -154,6 +182,7 @@ public function locations() {
$defaultOptions = array(
'recursive' => true,
'checkFolder' => true,
+ 'regex' => '@class (\S*) .*{@i'
);
foreach($sourceDirs as $dir => $options) {
if (is_numeric($dir)) {
@@ -240,7 +269,7 @@ public function i18n() {
*
* - a(*) -> array(*)
* - e(*) -> echo *
- * - ife(*, *, *) -> empty(*) ? * : *
+ * - ife(*, *, *) -> !empty(*) ? * : *
* - a(*) -> array(*)
* - r(*, *, *) -> str_replace(*, *, *)
* - up(*) -> strtoupper(*)
@@ -268,9 +297,9 @@ public function basics() {
'echo \1'
),
array(
- 'ife(*, *, *) -> empty(*) ? * : *',
+ 'ife(*, *, *) -> !empty(*) ? * : *',
'/ife\((.*), (.*), (.*)\)/',
- 'empty(\1) ? \2 : \3'
+ '!empty(\1) ? \2 : \3'
),
array(
'r(*, *, *) -> str_replace(*, *, *)',
@@ -479,6 +508,39 @@ public function components() {
}
/**
+ * Move application views files to where they now should be
+ *
+ * Find all view files in the folder and determine where cake expects the file to be
+ *
+ * @return void
+ */
+ protected function _moveViewFiles() {
+ if (!is_dir('views')) {
+ return;
+ }
+
+ $dirs = scandir('views');
+ foreach ($dirs as $old) {
+ if (!is_dir('views' . DS . $old) || $old === '.' || $old === '..') {
+ continue;
+ }
+
+ $new = 'View' . DS . Inflector::camelize($old);
+ $old = 'views' . DS . $old;
+
+ $this->out(__d('cake_console', 'Moving %s to %s', $old, $new));
+ if (!$this->params['dry-run']) {
+ if ($this->params['git']) {
+ exec('git mv -f ' . escapeshellarg($old) . ' ' . escapeshellarg($new));
+ } else {
+ $Folder = new Folder($old);
+ $Folder->move($new);
+ }
+ }
+ }
+ }
+
+/**
* Move application php files to where they now should be
*
* Find all php files in the folder (honoring recursive) and determine where cake expects the file to be
@@ -513,7 +575,7 @@ protected function _movePhpFiles($path, $options) {
$file = $cwd . DS . $file;
$contents = file_get_contents($file);
- preg_match('@class (\S*) .*{@', $contents, $match);
+ preg_match($options['regex'], $contents, $match);
if (!$match) {
continue;
}
@@ -665,6 +727,10 @@ public function getOptionParser() {
'help' => __d('cake_console', 'Run all upgrade commands.'),
'parser' => $subcommandParser
))
+ ->addSubcommand('tests', array(
+ 'help' => __d('cake_console', 'Update tests class names to FooTest rather than FooTestCase.'),
+ 'parser' => $subcommandParser
+ ))
->addSubcommand('locations', array(
'help' => __d('cake_console', 'Move files and folders to their new homes.'),
'parser' => $subcommandParser
View
18 lib/Cake/Console/ConsoleErrorHandler.php
@@ -25,7 +25,7 @@
*
* @package Cake.Console
*/
-class ConsoleErrorHandler extends ErrorHandler {
+class ConsoleErrorHandler {
/**
* Standard error stream.
@@ -52,12 +52,13 @@ public static function getStderr() {
* @param Exception $exception The exception to handle
* @return void
*/
- public static function handleException(Exception $exception) {
+ public function handleException(Exception $exception) {
$stderr = self::getStderr();
$stderr->write(__d('cake_console', "<error>Error:</error> %s\n%s",
$exception->getMessage(),
$exception->getTraceAsString()
));
+ $this->_stop($exception->getCode() ? $exception->getCode() : 1);
}
/**
@@ -71,12 +72,12 @@ public static function handleException(Exception $exception) {
* @param array $context The backtrace of the error.
* @return void
*/
- public static function handleError($code, $description, $file = null, $line = null, $context = null) {
+ public function handleError($code, $description, $file = null, $line = null, $context = null) {
if (error_reporting() === 0) {
return;
}
$stderr = self::getStderr();
- list($name, $log) = self::_mapErrorCode($code);
+ list($name, $log) = ErrorHandler::mapErrorCode($code);
$message = __d('cake_console', '%s in [%s, line %s]', $description, $file, $line);
$stderr->write(__d('cake_console', "<error>%s Error:</error> %s\n", $name, $message));
@@ -85,4 +86,13 @@ public static function handleError($code, $description, $file = null, $line = nu
}
}
+/**
+ * Wrapper for exit(), used for testing.
+ *
+ * @param $code int The exit code.
+ */
+ protected function _stop($code = 0) {
+ exit($code);
+ }
+
}
View
14 lib/Cake/Console/Shell.php
@@ -351,7 +351,8 @@ public function runCommand($command, $argv) {
$this->OptionParser = $this->getOptionParser();
list($this->params, $this->args) = $this->OptionParser->parse($argv, $command);
} catch (ConsoleException $e) {
- return $this->out($this->OptionParser->help($command));
+ $this->out($this->OptionParser->help($command));
+ return false;
}
$this->command = $command;
@@ -373,7 +374,8 @@ public function runCommand($command, $argv) {
if ($isMain) {
return $this->main();
}
- return $this->out($this->OptionParser->help($command));
+ $this->out($this->OptionParser->help($command));
+ return false;
}
/**
@@ -446,13 +448,11 @@ public function in($prompt, $options = null, $default = null) {
}
}
if (is_array($options)) {
- while ($in == '' || ($in && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) {
+ while ($in === '' || ($in !== '' && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) {
$in = $this->_getInput($prompt, $options, $default);
}
}
- if ($in) {
- return $in;
- }
+ return $in;
}
/**
@@ -482,7 +482,7 @@ protected function _getInput($prompt, $options, $default) {
}
$result = trim($result);
- if ($default != null && empty($result)) {
+ if ($default !== null && ($result === '' || $result === null)) {
return $default;
}
return $result;
View
12 lib/Cake/Console/ShellDispatcher.php
@@ -135,8 +135,9 @@ protected function _bootstrap() {
App::build();
}
require_once CAKE . 'Console' . DS . 'ConsoleErrorHandler.php';
- set_exception_handler(array('ConsoleErrorHandler', 'handleException'));
- set_error_handler(array('ConsoleErrorHandler', 'handleError'), Configure::read('Error.level'));
+ $ErrorHandler = new ConsoleErrorHandler();
+ set_exception_handler(array($ErrorHandler, 'handleException'));
+ set_error_handler(array($ErrorHandler, 'handleError'), Configure::read('Error.level'));
if (!defined('FULL_BASE_URL')) {
define('FULL_BASE_URL', 'http://localhost');
@@ -200,20 +201,21 @@ public function dispatch() {
*
* @param string $shell Optionally the name of a plugin
* @return mixed An object
- * @throws MissingShellFileException when errors are encountered.
+ * @throws MissingShellException when errors are encountered.
*/
protected function _getShell($shell) {
list($plugin, $shell) = pluginSplit($shell, true);
-
$class = Inflector::camelize($shell) . 'Shell';
App::uses('Shell', 'Console');
App::uses('AppShell', 'Console');
App::uses($class, $plugin . 'Console/Command');