Skip to content

Commit

Permalink
Merge branch '2.0' into 2.1
Browse files Browse the repository at this point in the history
Conflicts:
	lib/Cake/Model/Datasource/Database/Postgres.php
	lib/Cake/Test/Case/Console/TaskCollectionTest.php
	lib/Cake/Test/Case/Model/ModelIntegrationTest.php
	lib/Cake/Test/Case/Utility/ClassRegistryTest.php
	lib/Cake/Utility/ClassRegistry.php
  • Loading branch information
markstory committed Dec 12, 2011
2 parents 64eb38a + 8bb6f88 commit 2e8498e
Show file tree
Hide file tree
Showing 162 changed files with 920 additions and 306 deletions.
1 change: 1 addition & 0 deletions app/Config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
* timestamping regardless of debug value.
*/
//Configure::write('Asset.timestamp', true);

/**
* Compress CSS output by removing comments, whitespace, repeating tags, etc.
* This requires a/var/cache directory to be writable by the web server for caching.
Expand Down
1 change: 1 addition & 0 deletions app/View/Helper/AppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

App::uses('Helper', 'View');

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ public static function increment($key, $offset = 1, $config = 'default') {
self::set(null, $config);
return $success;
}

/**
* Decrement a number under the key and return decremented value.
*
Expand Down Expand Up @@ -401,6 +402,7 @@ public static function decrement($key, $offset = 1, $config = 'default') {
self::set(null, $config);
return $success;
}

/**
* Delete a key from the cache.
*
Expand Down
6 changes: 5 additions & 1 deletion lib/Cake/Cache/Engine/FileEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
*/

/**
* File Storage engine for cache
* File Storage engine for cache. Filestorage is the slowest cache storage
* to read and write. However, it is good for servers that don't have other storage
* engine available, or have content which is not performance sensitive.
*
* You can configure a FileEngine cache, using Cache::config()
*
* @package Cake.Cache.Engine
*/
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Cache/Engine/XcacheEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public function increment($key, $offset = 1) {
public function decrement($key, $offset = 1) {
return xcache_dec($key, $offset);
}

/**
* Delete a key from the cache
*
Expand Down
3 changes: 3 additions & 0 deletions lib/Cake/Console/Command/ApiShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
/**
* API shell to show method signatures of CakePHP core classes.
*
* Implementation of a Cake Shell to show CakePHP core method signatures.
*
* @package Cake.Console.Command
*/
class ApiShell extends AppShell {
Expand Down Expand Up @@ -151,6 +153,7 @@ public function getOptionParser() {
))->description(__d('cake_console', 'Lookup doc block comments for classes in CakePHP.'));
return $parser;
}

/**
* Show help for this shell.
*
Expand Down
6 changes: 5 additions & 1 deletion lib/Cake/Console/Command/BakeShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
App::uses('Model', 'Model');

/**
* Bake is a command-line code generation utility for automating programmer chores.
* Command-line code generation utility to automate programmer chores.
*
* Bake is CakePHP's code generation script, which can help you kickstart
* application development by writing fully functional skeleton controllers,
* models, and views. Going further, Bake can also write Unit Tests for you.
*
* @package Cake.Console.Command
* @link http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html
Expand Down
3 changes: 3 additions & 0 deletions lib/Cake/Console/Command/SchemaShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
/**
* Schema is a command-line database management utility for automating programmer chores.
*
* Schema is CakePHP's database management utility. This helps you maintain versions of
* of your database.
*
* @package Cake.Console.Command
* @link http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
*/
Expand Down
43 changes: 24 additions & 19 deletions lib/Cake/Console/Command/Task/ModelTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ public function execute() {
return $this->all();
}
$model = $this->_modelName($this->args[0]);
$object = $this->_getModelObject($model);
$this->listAll($this->connection);
$useTable = $this->getTable($model);
$object = $this->_getModelObject($model, $useTable);
if ($this->bake($object, false)) {
if ($this->_checkUnitTest()) {
$this->bakeFixture($model);
$this->bakeFixture($model, $useTable);
$this->bakeTest($model);
}
}
Expand Down Expand Up @@ -822,12 +824,14 @@ public function bakeTest($className) {
public function listAll($useDbConfig = null) {
$this->_tables = (array) $this->getAllTables($useDbConfig);

$this->_modelNames = array();
$count = count($this->_tables);
for ($i = 0; $i < $count; $i++) {
$this->_modelNames[] = $this->_modelName($this->_tables[$i]);
}
if ($this->interactive === true) {
$this->out(__d('cake_console', 'Possible Models based on your current database:'));
$this->_modelNames = array();
$count = count($this->_tables);
for ($i = 0; $i < $count; $i++) {
$this->_modelNames[] = $this->_modelName($this->_tables[$i]);
$this->out($i + 1 . ". " . $this->_modelNames[$i]);
}
}
Expand All @@ -842,26 +846,27 @@ public function listAll($useDbConfig = null) {
* @return string Table name
*/
public function getTable($modelName, $useDbConfig = null) {
if (!isset($useDbConfig)) {
$useDbConfig = $this->connection;
}

$db = ConnectionManager::getDataSource($useDbConfig);
$useTable = Inflector::tableize($modelName);
if (in_array($modelName, $this->_modelNames)) {
$modelNames = array_flip($this->_modelNames);
$useTable = $this->_tables[$modelNames[$modelName]];
}
$fullTableName = $db->fullTableName($useTable, false);
$tableIsGood = false;

if (array_search($useTable, $this->_tables) === false) {
$this->out();
$this->out(__d('cake_console', "Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
$tableIsGood = $this->in(__d('cake_console', 'Do you want to use this table?'), array('y', 'n'), 'y');
}
if (strtolower($tableIsGood) == 'n') {
$useTable = $this->in(__d('cake_console', 'What is the name of the table?'));
if ($this->interactive === true) {
if (!isset($useDbConfig)) {
$useDbConfig = $this->connection;
}
$db = ConnectionManager::getDataSource($useDbConfig);
$fullTableName = $db->fullTableName($useTable, false);
$tableIsGood = false;
if (array_search($useTable, $this->_tables) === false) {
$this->out();
$this->out(__d('cake_console', "Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
$tableIsGood = $this->in(__d('cake_console', 'Do you want to use this table?'), array('y', 'n'), 'y');
}
if (strtolower($tableIsGood) == 'n') {
$useTable = $this->in(__d('cake_console', 'What is the name of the table?'));
}
}
return $useTable;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/Task/PluginTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
App::uses('Folder', 'Utility');

/**
* Task class for creating a plugin
* The Plugin Task handles creating an empty plugin, ready to be used
*
* @package Cake.Console.Command.Task
*/
Expand Down
4 changes: 1 addition & 3 deletions lib/Cake/Console/Command/Task/ProjectTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,7 @@ public function securityCipherSeed($path) {
$File = new File($path . 'Config' . DS . 'core.php');
$contents = $File->read();
if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
if (!class_exists('Security')) {
require CAKE . 'Utility' . DS . 'security.php';
}
App::uses('Security', 'Utility');
$string = substr(bin2hex(Security::generateAuthKey()), 0, 30);
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents);
if ($File->write($result)) {
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Console/Command/UpgradeShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ public function exceptions() {
);
$this->_filesRegexpUpdate($patterns);
}

/**
* Move application views files to where they now should be
*
Expand Down
15 changes: 12 additions & 3 deletions lib/Cake/Console/Shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ class Shell extends Object {
*/
public $name = null;

/**
* The name of the plugin the shell belongs to.
* Is automatically set by ShellDispatcher when a shell is constructed.
*
* @var string
*/
public $plugin = null;

/**
* Contains tasks to load and instantiate
*
Expand Down Expand Up @@ -409,7 +417,8 @@ protected function _displayHelp($command) {
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::getOptionParser
*/
public function getOptionParser() {
$parser = new ConsoleOptionParser($this->name);
$name = ($this->plugin ? $this->plugin . '.' : '') . $this->name;
$parser = new ConsoleOptionParser($name);
return $parser;
}

Expand Down Expand Up @@ -716,10 +725,10 @@ protected function _controllerName($name) {
}

/**
* Creates the proper controller camelized name (singularized) for the specified name
* Creates the proper model camelized name (singularized) for the specified name
*
* @param string $name Name
* @return string Camelized and singularized controller name
* @return string Camelized and singularized model name
*/
protected function _modelName($name) {
return Inflector::camelize(Inflector::singularize($name));
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Console/ShellDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ protected function _getShell($shell) {
));
}
$Shell = new $class();
$Shell->plugin = trim($plugin, '.');
return $Shell;
}

Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Console/Templates/skel/Config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
* timestamping regardless of debug value.
*/
//Configure::write('Asset.timestamp', true);

/**
* Compress CSS output by removing comments, whitespace, repeating tags, etc.
* This requires a/var/cache directory to be writable by the web server for caching.
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ form .submit input[type=submit] {
form .submit input[type=submit]:hover {
background: #5BA150;
}

/* Form errors */
form .error {
background: #FFDACC;
Expand Down Expand Up @@ -646,6 +647,7 @@ pre {
overflow: auto;
text-shadow: none;
}

/* excerpt */
.cake-code-dump pre,
.cake-code-dump pre code {
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Console/Templates/skel/webroot/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}

/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
Expand All @@ -37,6 +38,7 @@
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}

/**
* The actual directory name for the "app".
*
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Console/Templates/skel/webroot/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}

/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
Expand All @@ -37,6 +38,7 @@
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}

/**
* The actual directory name for the "app".
*
Expand Down
8 changes: 8 additions & 0 deletions lib/Cake/Controller/CakeErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

/**
* Error Handling Controller
*
* Controller used by ErrorHandler to render error views.
*
* @package Cake.Controller
*/
class CakeErrorController extends AppController {

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Controller/Component/Auth/DigestAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function __construct(ComponentCollection $collection, $settings) {
$this->settings['opaque'] = md5($this->settings['realm']);
}
}

/**
* Authenticate a user using Digest HTTP auth. Will use the configured User model and attempt a
* login using Digest HTTP auth.
Expand Down Expand Up @@ -142,6 +143,7 @@ public function getUser($request) {
}
return false;
}

/**
* Find a user record using the standard options.
*
Expand Down
6 changes: 5 additions & 1 deletion lib/Cake/Controller/Component/RequestHandlerComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
App::uses('Xml', 'Utility');

/**
* Request object for handling HTTP requests
* Request object for handling alternative HTTP requests
*
* Alternative HTTP requests can come from wireless units like mobile phones, palmtop computers,
* and the like. These units have no use for Ajax requests, and this Component can tell how Cake
* should respond to the different needs of a handheld computer and a desktop machine.
*
* @package Cake.Controller.Component
* @link http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html
Expand Down
9 changes: 8 additions & 1 deletion lib/Cake/Controller/Component/SecurityComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@
App::uses('Security', 'Utility');

/**
* SecurityComponent
* The Security Component creates an easy way to integrate tighter security in
* your application. It provides methods for various tasks like:
*
* - Restricting which HTTP methods your application accepts.
* - CSRF protection.
* - Form tampering protection
* - Requiring that SSL be used.
* - Limiting cross controller communication.
*
* @package Cake.Controller.Component
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Controller/Component/SessionComponent.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* SessionComponent. Provides access to Sessions from the Controller layer
* SessionComponent. Provides access to Sessions from the Controller layer
*
* PHP 5
*
Expand All @@ -21,9 +21,9 @@
App::uses('CakeSession', 'Model/Datasource');

/**
* Session Component.
*
* Session handling from the controller.
* The CakePHP SessionComponent provides a way to persist client data between
* page requests. It acts as a wrapper for the `$_SESSION` as well as providing
* convenience methods for several `$_SESSION` related functions.
*
* @package Cake.Controller.Component
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html
Expand Down
6 changes: 6 additions & 0 deletions lib/Cake/Controller/ComponentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
App::uses('ObjectCollection', 'Utility');
App::uses('Component', 'Controller');

/**
* Components collection is used as a registry for loaded components and handles loading
* and constructing component class objects.
*
* @package Cake.Controller
*/
class ComponentCollection extends ObjectCollection {

/**
Expand Down
Loading

0 comments on commit 2e8498e

Please sign in to comment.