Upgrade CakePHP from 2.2.5 to 2.9.5

This commit is contained in:
Brm Ko 2017-02-26 15:29:44 +01:00
parent 5a580df460
commit 235a541597
793 changed files with 60746 additions and 23753 deletions

View file

@ -1,16 +1,17 @@
<?php
/**
* 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 Project
* @package Cake.Console.Command
* @since CakePHP 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('AppShell', 'Console/Command');
@ -23,6 +24,13 @@ App::uses('Inflector', 'Utility');
*/
class CommandListShell extends AppShell {
/**
* Contains tasks to load and instantiate
*
* @var array
*/
public $tasks = array('Command');
/**
* startup
*
@ -46,15 +54,16 @@ class CommandListShell extends AppShell {
$this->out(" -working: " . rtrim(APP, DS));
$this->out(" -root: " . rtrim(ROOT, DS));
$this->out(" -core: " . rtrim(CORE_PATH, DS));
$this->out(" -webroot: " . rtrim(WWW_ROOT, DS));
$this->out("");
$this->out(__d('cake_console', "<info>Changing Paths:</info>"), 2);
$this->out(__d('cake_console', "Your working path should be the same as your application path to change your path use the '-app' param."));
$this->out(__d('cake_console', "Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp"), 2);
$this->out(__d('cake_console', "Your working path should be the same as your application path. To change your path use the '-app' param."));
$this->out(__d('cake_console', "Example: %s or %s", '-app relative/path/to/myapp', '-app /absolute/path/to/myapp'), 2);
$this->out(__d('cake_console', "<info>Available Shells:</info>"), 2);
}
$shellList = $this->_getShellList();
$shellList = $this->Command->getShellList();
if (empty($shellList)) {
return;
}
@ -66,52 +75,10 @@ class CommandListShell extends AppShell {
}
}
/**
* Gets the shell command listing.
*
* @return array
*/
protected function _getShellList() {
$skipFiles = array('AppShell');
$plugins = CakePlugin::loaded();
$shellList = array_fill_keys($plugins, null) + array('CORE' => null, 'app' => null);
$corePath = App::core('Console/Command');
$shells = App::objects('file', $corePath[0]);
$shells = array_diff($shells, $skipFiles);
$this->_appendShells('CORE', $shells, $shellList);
$appShells = App::objects('Console/Command', null, false);
$appShells = array_diff($appShells, $shells, $skipFiles);
$this->_appendShells('app', $appShells, $shellList);
foreach ($plugins as $plugin) {
$pluginShells = App::objects($plugin . '.Console/Command');
$this->_appendShells($plugin, $pluginShells, $shellList);
}
return array_filter($shellList);
}
/**
* Scan the provided paths for shells, and append them into $shellList
*
* @param string $type
* @param array $shells
* @param array $shellList
* @return array
*/
protected function _appendShells($type, $shells, &$shellList) {
foreach ($shells as $shell) {
$shellList[$type][] = Inflector::underscore(str_replace('Shell', '', $shell));
}
}
/**
* Output text.
*
* @param array $shellList
* @param array $shellList The shell list.
* @return void
*/
protected function _asText($shellList) {
@ -129,7 +96,7 @@ class CommandListShell extends AppShell {
/**
* Output as XML
*
* @param array $shellList
* @param array $shellList The shell list.
* @return void
*/
protected function _asXml($shellList) {
@ -154,21 +121,24 @@ class CommandListShell extends AppShell {
}
/**
* get the option parser
* Gets the option parser instance and configures it.
*
* @return void
* @return ConsoleOptionParser
*/
public function getOptionParser() {
$parser = parent::getOptionParser();
return $parser->description(__d('cake_console', 'Get the list of available shells for this CakePHP application.'))
->addOption('sort', array(
'help' => __d('cake_console', 'Does nothing (deprecated)'),
'boolean' => true
))
->addOption('xml', array(
'help' => __d('cake_console', 'Get the listing as XML.'),
'boolean' => true
));
$parser->description(
__d('cake_console', 'Get the list of available shells for this CakePHP application.')
)->addOption('sort', array(
'help' => __d('cake_console', 'Does nothing (deprecated)'),
'boolean' => true
))->addOption('xml', array(
'help' => __d('cake_console', 'Get the listing as XML.'),
'boolean' => true
));
return $parser;
}
}