Skip to content

Commit

Permalink
Merge branch '2.0' of github.com:cakephp/cakephp into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Oct 16, 2011
2 parents b38c0e5 + 6ecbccc commit e47b970
Show file tree
Hide file tree
Showing 73 changed files with 201 additions and 360 deletions.
7 changes: 4 additions & 3 deletions lib/Cake/Console/ShellDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,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');

if (!class_exists($class)) {
throw new MissingShellFileException(array('shell' => $shell));
throw new MissingShellException(array(
'class' => $class
));
}
$Shell = new $class();
return $Shell;
Expand Down
6 changes: 4 additions & 2 deletions lib/Cake/Console/TaskCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct(Shell $Shell) {
* @param string $task Task name to load
* @param array $settings Settings for the task.
* @return Task A task object, Either the existing loaded task or a new one.
* @throws MissingTaskFileException, MissingTaskClassException when the task could not be found
* @throws MissingTaskException when the task could not be found
*/
public function load($task, $settings = array()) {
list($plugin, $name) = pluginSplit($task, true);
Expand All @@ -66,7 +66,9 @@ public function load($task, $settings = array()) {
App::uses($taskClass, $plugin . 'Console/Command/Task');
if (!class_exists($taskClass)) {
if (!class_exists($taskClass)) {
throw new MissingTaskClassException($taskClass);
throw new MissingTaskException(array(
'class' => $taskClass
));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs.template.objects
* @package Cake.Console.Templates.default.actions
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Templates/default/classes/controller.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Console.Templates.default.actions
* @package Cake.Console.Templates.default.classes
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Templates/default/classes/fixture.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Console.Templates.default.actions
* @package Cake.Console.Templates.default.classes
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Templates/default/classes/model.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Console.Templates.default.actions
* @package Cake.Console.Templates.default.classes
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Templates/default/classes/test.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Console.Templates.default.actions
* @package Cake.Console.Templates.default.classes
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Templates/default/views/form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs.templates.views
* @package Cake.Console.Templates.default.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Templates/default/views/index.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs.templates.views
* @package Cake.Console.Templates.default.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Templates/default/views/view.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs.templates.views
* @package Cake.Console.Templates.default.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package Cake.Console.Templates.skel.Controller
* @package app.Controller
*/
class AppController extends Controller {
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Console.Templates.skel.Controller
* @package app.Controller
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand All @@ -24,7 +24,7 @@
*
* Override this controller by placing a copy in controllers directory of an application
*
* @package Cake.Console.Templates.skel.Controller
* @package app.Controller
*/
class PagesController extends AppController {

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Templates/skel/Model/AppModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Add your application-wide methods in the class below, your models
* will inherit them.
*
* @package Cake.Console.Templates.skel.Model
* @package app.Model
*/
class AppModel extends Model {
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.elements.email.html
* @package app.View.Emails.html
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.elements.email.text
* @package app.View.Emails.text
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Console/Templates/skel/View/Helper/AppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package app.View.Helper
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand All @@ -27,7 +28,7 @@
* Add your application-wide methods in the class below, your helpers
* will inherit them.
*
* @package Cake.Console.Templates.skel.View.Helper
* @package app.View.Helper
*/
class AppHelper extends Helper {
}
2 changes: 1 addition & 1 deletion lib/Cake/Console/Templates/skel/View/Layouts/ajax.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts
* @package app.View.Layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand Down
5 changes: 2 additions & 3 deletions lib/Cake/Controller/ComponentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getController() {
* @param string $component Component name to load
* @param array $settings Settings for the component.
* @return Component A component object, Either the existing loaded component or a new one.
* @throws MissingComponentFileException, MissingComponentClassException when the component could not be found
* @throws MissingComponentException when the component could not be found
*/
public function load($component, $settings = array()) {
if (is_array($settings) && isset($settings['className'])) {
Expand All @@ -90,8 +90,7 @@ public function load($component, $settings = array()) {
$componentClass = $name . 'Component';
App::uses($componentClass, $plugin . 'Controller/Component');
if (!class_exists($componentClass)) {
throw new MissingComponentClassException(array(
'file' => Inflector::underscore($componentClass) . '.php',
throw new MissingComponentException(array(
'class' => $componentClass
));
}
Expand Down
78 changes: 18 additions & 60 deletions lib/Cake/Error/exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,37 +241,23 @@ public function __construct($message, $code = 404, Exception $previous = null) {
}

/**
* Used when a Component file cannot be found.
* Used when a component cannot be found.
*
* @package Cake.Error
*/
class MissingComponentFileException extends CakeException {
protected $_messageTemplate = 'Component file "%s" is missing.';
class MissingComponentException extends CakeException {
protected $_messageTemplate = 'Component class %s could not be found.';
}

/**
* Used when a Component class cannot be found.
* Used when a behavior cannot be found.
*
* @package Cake.Error
*/
class MissingComponentClassException extends CakeException {
protected $_messageTemplate = 'Component class "%s" is missing.';
class MissingBehaviorException extends CakeException {
protected $_messageTemplate = 'Behavior class %s could not be found.';
}

/**
* Used when a Behavior file cannot be found.
*
* @package Cake.Error
*/
class MissingBehaviorFileException extends CakeException { }

/**
* Used when a Behavior class cannot be found.
*
* @package Cake.Error
*/
class MissingBehaviorClassException extends CakeException { }

/**
* Used when a view file cannot be found.
*
Expand All @@ -291,24 +277,14 @@ class MissingLayoutException extends CakeException {
}

/**
* Used when a helper file cannot be found.
* Used when a helper cannot be found.
*
* @package Cake.Error
*/
class MissingHelperFileException extends CakeException {
protected $_messageTemplate = 'Helper file "%s" is missing.';
class MissingHelperException extends CakeException {
protected $_messageTemplate = 'Helper class %s could not be found.';
}

/**
* Used when a helper class cannot be found.
*
* @package Cake.Error
*/
class MissingHelperClassException extends CakeException {
protected $_messageTemplate = 'Helper class "%s" is missing.';
}


/**
* Runtime Exceptions for ConnectionManager
*
Expand All @@ -328,21 +304,12 @@ class MissingConnectionException extends CakeException {
}

/**
* Used when a Task file cannot be found.
*
* @package Cake.Error
*/
class MissingTaskFileException extends CakeException {
protected $_messageTemplate = 'Task file "%s" is missing.';
}

/**
* Used when a Task class cannot be found.
* Used when a Task cannot be found.
*
* @package Cake.Error
*/
class MissingTaskClassException extends CakeException {
protected $_messageTemplate = 'Task class "%s" is missing.';
class MissingTaskException extends CakeException {
protected $_messageTemplate = 'Task class %s could not be found.';
}

/**
Expand All @@ -355,21 +322,12 @@ class MissingShellMethodException extends CakeException {
}

/**
* Used when a shell class cannot be found.
*
* @package Cake.Error
*/
class MissingShellClassException extends CakeException {
protected $_messageTemplate = "Shell class %s could not be loaded.";
}

/**
* Used when a shell file cannot be found.
* Used when a shell cannot be found.
*
* @package Cake.Error
*/
class MissingShellFileException extends CakeException {
protected $_messageTemplate = "Shell file %s could not be loaded.";
class MissingShellException extends CakeException {
protected $_messageTemplate = 'Shell class %s could not be found.';
}

/**
Expand All @@ -382,12 +340,12 @@ class MissingDatasourceConfigException extends CakeException {
}

/**
* Exception class to be thrown when a datasource is not found
* Used when a datasource cannot be found.
*
* @package Cake.Error
*/
class MissingDatasourceFileException extends CakeException {
protected $_messageTemplate = 'Datasource "%s" was not found.';
class MissingDatasourceException extends CakeException {
protected $_messageTemplate = 'Datasource class %s could not be found.';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/AclNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AclNode extends AppModel {
*
* @var array
*/
public $actsAs = array('Tree' => array('nested'));
public $actsAs = array('Tree' => array('type' => 'nested'));

/**
* Constructor
Expand Down
9 changes: 5 additions & 4 deletions lib/Cake/Model/Behavior/AclBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ class AclBehavior extends ModelBehavior {
protected $_typeMaps = array('requester' => 'Aro', 'controlled' => 'Aco', 'both' => array('Aro', 'Aco'));

/**
* Sets up the configuation for the model, and loads ACL models if they haven't been already
* Sets up the configuration for the model, and loads ACL models if they haven't been already
*
* @param Model $model
* @param array $config
* @return void
*/
public function setup($model, $config = array()) {
if (is_string($config)) {
$config = array('type' => $config);
if (isset($config[0])) {
$config['type'] = $config[0];
unset($config[0]);
}
$this->settings[$model->name] = array_merge(array('type' => 'controlled'), (array)$config);
$this->settings[$model->name] = array_merge(array('type' => 'controlled'), $config);
$this->settings[$model->name]['type'] = strtolower($this->settings[$model->name]['type']);

$types = $this->_typeMaps[$this->settings[$model->name]['type']];
Expand Down
3 changes: 0 additions & 3 deletions lib/Cake/Model/Behavior/ContainableBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ public function setup($Model, $settings = array()) {
if (!isset($this->settings[$Model->alias])) {
$this->settings[$Model->alias] = array('recursive' => true, 'notices' => true, 'autoFields' => true);
}
if (!is_array($settings)) {
$settings = array();
}
$this->settings[$Model->alias] = array_merge($this->settings[$Model->alias], $settings);
}

Expand Down

0 comments on commit e47b970

Please sign in to comment.