mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
updating shell task handling, removing bake2
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5076 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
e8292ec7fd
commit
1875d74e4a
4 changed files with 16 additions and 115 deletions
|
@ -275,7 +275,6 @@ class ShellDispatcher {
|
||||||
|
|
||||||
$task = Inflector::camelize($command);
|
$task = Inflector::camelize($command);
|
||||||
if(in_array($task, $shell->taskNames)) {
|
if(in_array($task, $shell->taskNames)) {
|
||||||
$shell->initialize();
|
|
||||||
$task = Inflector::camelize($command);
|
$task = Inflector::camelize($command);
|
||||||
$shell->{$task}->initialize();
|
$shell->{$task}->initialize();
|
||||||
$shell->{$task}->execute();
|
$shell->{$task}->execute();
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.libs
|
* @subpackage cake.cake.console
|
||||||
* @since CakePHP(tm) v 0.10.5.1732
|
* @since CakePHP(tm) v 1.2.0.5074
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @modifiedby $LastChangedBy$
|
* @modifiedby $LastChangedBy$
|
||||||
* @lastmodified $Date$
|
* @lastmodified $Date$
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
<?php
|
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
|
||||||
* Short description for file.
|
|
||||||
*
|
|
||||||
* Long description for file
|
|
||||||
*
|
|
||||||
* PHP versions 4 and 5
|
|
||||||
*
|
|
||||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
|
||||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
|
||||||
* 1785 E. Sahara Avenue, Suite 490-204
|
|
||||||
* Las Vegas, Nevada 89104
|
|
||||||
*
|
|
||||||
* Licensed under The MIT License
|
|
||||||
* Redistributions of files must retain the above copyright notice.
|
|
||||||
*
|
|
||||||
* @filesource
|
|
||||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
|
||||||
* @package cake
|
|
||||||
* @subpackage cake.cake.scripts.bake
|
|
||||||
* @since CakePHP(tm) v 1.2
|
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
||||||
*/
|
|
||||||
class Bake2Shell extends Shell {
|
|
||||||
|
|
||||||
var $task = null;
|
|
||||||
|
|
||||||
function initialize() {
|
|
||||||
pr($this->args);
|
|
||||||
if(isset($this->args[0])) {
|
|
||||||
$this->task = $this->args[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
if($this->task == null) {
|
|
||||||
$this->err('No Task specified');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$task = $this->_loadTask($this->task);
|
|
||||||
if ($task !== null) {
|
|
||||||
$task->execute($this->args);
|
|
||||||
} else {
|
|
||||||
$this->err("Task not found: " . $this->task . "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _loadTask($taskName = null) {
|
|
||||||
|
|
||||||
if(!$taskName) {
|
|
||||||
$taskName = $this->task;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$taskName) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$loaded = false;
|
|
||||||
foreach($this->Dispatch->shellPaths as $path) {
|
|
||||||
$this->taskPath = $path . 'tasks' . DS . $taskName.'.php';
|
|
||||||
if (file_exists($this->taskPath)) {
|
|
||||||
$loaded = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($loaded) {
|
|
||||||
require CONSOLE_LIBS . 'tasks' . DS . 'bake.php';
|
|
||||||
require $this->taskPath;
|
|
||||||
|
|
||||||
$this->taskClass = $taskName.'Task';
|
|
||||||
if(class_exists($this->taskClass)) {
|
|
||||||
return new $this->taskClass($this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _readConfigFile($fileName) {
|
|
||||||
$fileLineArray = file($fileName);
|
|
||||||
foreach($fileLineArray as $fileLine) {
|
|
||||||
$dataLine = trim($fileLine);
|
|
||||||
$delimiter = strpos($dataLine, '=');
|
|
||||||
if ($delimiter > 0) {
|
|
||||||
$key = strtolower(trim(substr($dataLine, 0, $delimiter)));
|
|
||||||
$value = trim(substr($dataLine, $delimiter + 1));
|
|
||||||
$iniSetting[$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $iniSetting;
|
|
||||||
}
|
|
||||||
|
|
||||||
function help() {
|
|
||||||
echo "Usage: php bake2.php task [param1, ...]\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -123,12 +123,18 @@ class Shell extends Object {
|
||||||
* Initializes the Shell
|
* Initializes the Shell
|
||||||
* can be overriden in subclasses
|
* can be overriden in subclasses
|
||||||
*
|
*
|
||||||
* @return null
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initialize() {
|
function initialize() {
|
||||||
|
|
||||||
$this->_loadModels();
|
$this->_loadModels();
|
||||||
|
$this->_welcome();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Displays a header for the shell
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function _welcome() {
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out('App : '. APP_DIR);
|
$this->out('App : '. APP_DIR);
|
||||||
$this->out('Path: '. ROOT . DS . APP_DIR);
|
$this->out('Path: '. ROOT . DS . APP_DIR);
|
||||||
|
|
Loading…
Add table
Reference in a new issue