mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-05 15:43:53 +02:00
Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
parent
5a580df460
commit
235a541597
793 changed files with 60746 additions and 23753 deletions
|
@ -4,21 +4,22 @@
|
|||
* and constructing task class objects.
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @since CakePHP(tm) v 2.0
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('ObjectCollection', 'Utility');
|
||||
|
||||
/**
|
||||
* Collection object for Tasks. Provides features
|
||||
* Collection object for Tasks. Provides features
|
||||
* for lazily loading tasks, and firing callbacks on loaded tasks.
|
||||
*
|
||||
* @package Cake.Console
|
||||
|
@ -42,15 +43,24 @@ class TaskCollection extends ObjectCollection {
|
|||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Shell $Shell
|
||||
* @param Shell $Shell The shell this task collection is attached to.
|
||||
*/
|
||||
public function __construct(Shell $Shell) {
|
||||
$this->_Shell = $Shell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads/constructs a task. Will return the instance in the collection
|
||||
* if it already exists.
|
||||
* Loads/constructs a task. Will return the instance in the registry if it already exists.
|
||||
*
|
||||
* You can alias your task as an existing task by setting the 'className' key, i.e.,
|
||||
* ```
|
||||
* public $tasks = array(
|
||||
* 'DbConfig' => array(
|
||||
* 'className' => 'Bakeplus.DbConfigure'
|
||||
* );
|
||||
* );
|
||||
* ```
|
||||
* All calls to the `DbConfig` task would use `DbConfigure` found in the `Bakeplus` plugin instead.
|
||||
*
|
||||
* @param string $task Task name to load
|
||||
* @param array $settings Settings for the task.
|
||||
|
@ -58,25 +68,33 @@ class TaskCollection extends ObjectCollection {
|
|||
* @throws MissingTaskException when the task could not be found
|
||||
*/
|
||||
public function load($task, $settings = array()) {
|
||||
if (is_array($settings) && isset($settings['className'])) {
|
||||
$alias = $task;
|
||||
$task = $settings['className'];
|
||||
}
|
||||
list($plugin, $name) = pluginSplit($task, true);
|
||||
if (!isset($alias)) {
|
||||
$alias = $name;
|
||||
}
|
||||
|
||||
if (isset($this->_loaded[$name])) {
|
||||
return $this->_loaded[$name];
|
||||
if (isset($this->_loaded[$alias])) {
|
||||
return $this->_loaded[$alias];
|
||||
}
|
||||
$taskClass = $name . 'Task';
|
||||
App::uses($taskClass, $plugin . 'Console/Command/Task');
|
||||
if (!class_exists($taskClass)) {
|
||||
if (!class_exists($taskClass)) {
|
||||
throw new MissingTaskException(array(
|
||||
'class' => $taskClass
|
||||
));
|
||||
}
|
||||
|
||||
$exists = class_exists($taskClass);
|
||||
if (!$exists) {
|
||||
throw new MissingTaskException(array(
|
||||
'class' => $taskClass,
|
||||
'plugin' => substr($plugin, 0, -1)
|
||||
));
|
||||
}
|
||||
|
||||
$this->_loaded[$name] = new $taskClass(
|
||||
$this->_loaded[$alias] = new $taskClass(
|
||||
$this->_Shell->stdout, $this->_Shell->stderr, $this->_Shell->stdin
|
||||
);
|
||||
return $this->_loaded[$name];
|
||||
return $this->_loaded[$alias];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue