mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removing the last vestiges of the enable parameter.
Fixing issue where isset() stupidly plods along when doing a string index of a string. Updating DbAcl to use proper settings array. Fixes #1467
This commit is contained in:
parent
be563e1220
commit
b94edefb2c
8 changed files with 10 additions and 10 deletions
|
@ -48,11 +48,10 @@ class TaskCollection extends ObjectCollection {
|
||||||
*
|
*
|
||||||
* @param string $task Task name to load
|
* @param string $task Task name to load
|
||||||
* @param array $settings Settings for the task.
|
* @param array $settings Settings for the task.
|
||||||
* @param boolean $enable Whether or not this task should be enabled by default
|
|
||||||
* @return Task A task object, Either the existing loaded task or a new one.
|
* @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 MissingTaskFileException, MissingTaskClassException when the task could not be found
|
||||||
*/
|
*/
|
||||||
public function load($task, $settings = array(), $enable = true) {
|
public function load($task, $settings = array()) {
|
||||||
list($plugin, $name) = pluginSplit($task, true);
|
list($plugin, $name) = pluginSplit($task, true);
|
||||||
|
|
||||||
if (isset($this->_loaded[$name])) {
|
if (isset($this->_loaded[$name])) {
|
||||||
|
@ -72,6 +71,7 @@ class TaskCollection extends ObjectCollection {
|
||||||
$this->_loaded[$name] = new $taskClass(
|
$this->_loaded[$name] = new $taskClass(
|
||||||
$this->_Shell->stdout, $this->_Shell->stderr, $this->_Shell->stdin
|
$this->_Shell->stdout, $this->_Shell->stderr, $this->_Shell->stdin
|
||||||
);
|
);
|
||||||
|
$enable = isset($settings['enabled']) ? $settings['enabled'] : true;
|
||||||
if ($enable === true) {
|
if ($enable === true) {
|
||||||
$this->_enabled[] = $name;
|
$this->_enabled[] = $name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ class ComponentCollection extends ObjectCollection {
|
||||||
* @throws MissingComponentFileException, MissingComponentClassException when the component could not be found
|
* @throws MissingComponentFileException, MissingComponentClassException when the component could not be found
|
||||||
*/
|
*/
|
||||||
public function load($component, $settings = array()) {
|
public function load($component, $settings = array()) {
|
||||||
if (isset($settings['className'])) {
|
if (is_array($settings) && isset($settings['className'])) {
|
||||||
$alias = $component;
|
$alias = $component;
|
||||||
$component = $settings['className'];
|
$component = $settings['className'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ class BehaviorCollection extends ObjectCollection {
|
||||||
* @throws MissingBehaviorFileException or MissingBehaviorClassException when a behavior could not be found.
|
* @throws MissingBehaviorFileException or MissingBehaviorClassException when a behavior could not be found.
|
||||||
*/
|
*/
|
||||||
public function load($behavior, $config = array()) {
|
public function load($behavior, $config = array()) {
|
||||||
if (isset($config['className'])) {
|
if (is_array($config) && isset($config['className'])) {
|
||||||
$alias = $behavior;
|
$alias = $behavior;
|
||||||
$behavior = $config['className'];
|
$behavior = $config['className'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class AclNode extends AppModel {
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public $actsAs = array('Tree' => 'nested');
|
public $actsAs = array('Tree' => array('nested'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
|
@ -57,7 +57,7 @@ class HelperCollection extends ObjectCollection {
|
||||||
* @throws MissingHelperFileException, MissingHelperClassException when the helper could not be found
|
* @throws MissingHelperFileException, MissingHelperClassException when the helper could not be found
|
||||||
*/
|
*/
|
||||||
public function load($helper, $settings = array()) {
|
public function load($helper, $settings = array()) {
|
||||||
if (isset($settings['className'])) {
|
if (is_array($settings) && isset($settings['className'])) {
|
||||||
$alias = $helper;
|
$alias = $helper;
|
||||||
$helper = $settings['className'];
|
$helper = $settings['className'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -623,7 +623,7 @@ class View extends Object {
|
||||||
public function loadHelpers() {
|
public function loadHelpers() {
|
||||||
$helpers = HelperCollection::normalizeObjectArray($this->helpers);
|
$helpers = HelperCollection::normalizeObjectArray($this->helpers);
|
||||||
foreach ($helpers as $name => $properties) {
|
foreach ($helpers as $name => $properties) {
|
||||||
$this->Helpers->load($properties['class'], $properties['settings'], true);
|
$this->Helpers->load($properties['class'], $properties['settings']);
|
||||||
}
|
}
|
||||||
$this->_helpersLoaded = true;
|
$this->_helpersLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ class TaskCollectionTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testLoadWithEnableFalse() {
|
function testLoadWithEnableFalse() {
|
||||||
$result = $this->Tasks->load('DbConfig', array(), false);
|
$result = $this->Tasks->load('DbConfig', array('enabled' => false));
|
||||||
$this->assertInstanceOf('DbConfigTask', $result);
|
$this->assertInstanceOf('DbConfigTask', $result);
|
||||||
$this->assertInstanceOf('DbConfigTask', $this->Tasks->DbConfig);
|
$this->assertInstanceOf('DbConfigTask', $this->Tasks->DbConfig);
|
||||||
|
|
||||||
|
|
|
@ -54,16 +54,16 @@ class GenericObjectCollection extends ObjectCollection {
|
||||||
*
|
*
|
||||||
* @param string $object Object name
|
* @param string $object Object name
|
||||||
* @param array $settings Settings array
|
* @param array $settings Settings array
|
||||||
* @param boolean $enable Start object as enabled
|
|
||||||
* @return array List of loaded objects
|
* @return array List of loaded objects
|
||||||
*/
|
*/
|
||||||
public function load($object, $settings = array(), $enable = true) {
|
public function load($object, $settings = array()) {
|
||||||
list($plugin, $name) = pluginSplit($object);
|
list($plugin, $name) = pluginSplit($object);
|
||||||
if (isset($this->_loaded[$name])) {
|
if (isset($this->_loaded[$name])) {
|
||||||
return $this->_loaded[$name];
|
return $this->_loaded[$name];
|
||||||
}
|
}
|
||||||
$objectClass = $name . 'GenericObject';
|
$objectClass = $name . 'GenericObject';
|
||||||
$this->_loaded[$name] = new $objectClass($this, $settings);
|
$this->_loaded[$name] = new $objectClass($this, $settings);
|
||||||
|
$enable = isset($settings['enabled']) ? $settings['enabled'] : true;
|
||||||
if ($enable === true) {
|
if ($enable === true) {
|
||||||
$this->_enabled[] = $name;
|
$this->_enabled[] = $name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue