mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix most of the coding standards issues in Console/
This commit is contained in:
parent
2a7bee0a5c
commit
db8c6b5c78
36 changed files with 146 additions and 158 deletions
|
@ -200,7 +200,7 @@ class AclShell extends AppShell {
|
|||
}
|
||||
$this->out(__d('cake_console', 'Path:'));
|
||||
$this->hr();
|
||||
for ($i = 0; $i < count($nodes); $i++) {
|
||||
for ($i = 0, $len = count($nodes); $i < $len; $i++) {
|
||||
$this->_outputNode($class, $nodes[$i], $i);
|
||||
}
|
||||
}
|
||||
|
@ -366,8 +366,9 @@ class AclShell extends AppShell {
|
|||
'help' => __d('cake_console', 'Type of node to create.')
|
||||
);
|
||||
|
||||
$parser->description(__d('cake_console', 'A console tool for managing the DbAcl'))
|
||||
->addSubcommand('create', array(
|
||||
$parser->description(
|
||||
__d('cake_console', 'A console tool for managing the DbAcl')
|
||||
)->addSubcommand('create', array(
|
||||
'help' => __d('cake_console', 'Create a new ACL node'),
|
||||
'parser' => array(
|
||||
'description' => __d('cake_console', 'Creates a new ACL object <node> under the parent'),
|
||||
|
@ -514,8 +515,9 @@ class AclShell extends AppShell {
|
|||
if (!isset($this->args[0]) || !isset($this->args[1])) {
|
||||
return false;
|
||||
}
|
||||
extract($this->_dataVars($this->args[0]));
|
||||
$key = is_numeric($this->args[1]) ? $secondary_id : 'alias';
|
||||
$dataVars = $this->_dataVars($this->args[0]);
|
||||
extract($dataVars);
|
||||
$key = is_numeric($this->args[1]) ? $dataVars['secondary_id'] : 'alias';
|
||||
$conditions = array($class . '.' . $key => $this->args[1]);
|
||||
$possibility = $this->Acl->{$class}->find('all', compact('conditions'));
|
||||
if (empty($possibility)) {
|
||||
|
@ -602,4 +604,5 @@ class AclShell extends AppShell {
|
|||
$vars['class'] = $class;
|
||||
return $vars;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class ApiShell extends AppShell {
|
|||
$this->error(__d('cake_console', '%s not found', $class));
|
||||
}
|
||||
|
||||
$parsed = $this->_parseClass($path . $class .'.php', $class);
|
||||
$parsed = $this->_parseClass($path . $class . '.php', $class);
|
||||
|
||||
if (!empty($parsed)) {
|
||||
if (isset($this->params['method'])) {
|
||||
|
@ -166,14 +166,14 @@ class ApiShell extends AppShell {
|
|||
|
||||
$commands = array(
|
||||
'path' => "\t<type>\n" .
|
||||
"\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n".
|
||||
"\t\tAvailable values:\n\n".
|
||||
"\t\tbehavior\tLook for class in CakePHP behavior path\n".
|
||||
"\t\tcache\tLook for class in CakePHP cache path\n".
|
||||
"\t\tcontroller\tLook for class in CakePHP controller path\n".
|
||||
"\t\tcomponent\tLook for class in CakePHP component path\n".
|
||||
"\t\thelper\tLook for class in CakePHP helper path\n".
|
||||
"\t\tmodel\tLook for class in CakePHP model path\n".
|
||||
"\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n" .
|
||||
"\t\tAvailable values:\n\n" .
|
||||
"\t\tbehavior\tLook for class in CakePHP behavior path\n" .
|
||||
"\t\tcache\tLook for class in CakePHP cache path\n" .
|
||||
"\t\tcontroller\tLook for class in CakePHP controller path\n" .
|
||||
"\t\tcomponent\tLook for class in CakePHP component path\n" .
|
||||
"\t\thelper\tLook for class in CakePHP helper path\n" .
|
||||
"\t\tmodel\tLook for class in CakePHP model path\n" .
|
||||
"\t\tview\tLook for class in CakePHP view path\n",
|
||||
'className' => "\t<className>\n" .
|
||||
"\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n"
|
||||
|
@ -203,7 +203,7 @@ class ApiShell extends AppShell {
|
|||
$parsed = array();
|
||||
|
||||
if (!class_exists($class)) {
|
||||
if (!include_once($path)) {
|
||||
if (!include_once $path) {
|
||||
$this->err(__d('cake_console', '%s could not be found', $path));
|
||||
}
|
||||
}
|
||||
|
@ -234,4 +234,5 @@ class ApiShell extends AppShell {
|
|||
ksort($parsed);
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -209,9 +209,9 @@ class BakeShell extends AppShell {
|
|||
public function getOptionParser() {
|
||||
$parser = parent::getOptionParser();
|
||||
return $parser->description(__d('cake_console',
|
||||
'The Bake script generates controllers, views and models for your application.'
|
||||
. ' If run with no command line arguments, Bake guides the user through the class creation process.'
|
||||
. ' You can customize the generation process by telling Bake where different parts of your application are using command line arguments.'
|
||||
'The Bake script generates controllers, views and models for your application.' .
|
||||
' If run with no command line arguments, Bake guides the user through the class creation process.' .
|
||||
' You can customize the generation process by telling Bake where different parts of your application are using command line arguments.'
|
||||
))->addSubcommand('all', array(
|
||||
'help' => __d('cake_console', 'Bake a complete MVC. optional <name> of a Model'),
|
||||
))->addSubcommand('project', array(
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<?php
|
||||
/**
|
||||
* Command list Shell
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
|
@ -46,7 +42,7 @@ class CommandListShell extends AppShell {
|
|||
public function main() {
|
||||
if (empty($this->params['xml'])) {
|
||||
$this->out(__d('cake_console', "<info>Current Paths:</info>"), 2);
|
||||
$this->out(" -app: ". APP_DIR);
|
||||
$this->out(" -app: " . APP_DIR);
|
||||
$this->out(" -working: " . rtrim(APP, DS));
|
||||
$this->out(" -root: " . rtrim(ROOT, DS));
|
||||
$this->out(" -core: " . rtrim(CORE_PATH, DS));
|
||||
|
@ -234,4 +230,5 @@ class CommandListShell extends AppShell {
|
|||
'boolean' => true
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<?php
|
||||
/**
|
||||
* CakePHP Console Shell
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
|
@ -343,7 +339,7 @@ class ConsoleShell extends AppShell {
|
|||
Router::reload();
|
||||
extract(Router::getNamedExpressions());
|
||||
|
||||
if (!@include(APP . 'Config' . DS . 'routes.php')) {
|
||||
if (!@include APP . 'Config' . DS . 'routes.php') {
|
||||
return false;
|
||||
}
|
||||
CakePlugin::routes();
|
||||
|
@ -359,4 +355,5 @@ class ConsoleShell extends AppShell {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -117,4 +117,5 @@ class I18nShell extends AppShell {
|
|||
'parser' => $this->Extract->getOptionParser()
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ class SchemaShell extends AppShell {
|
|||
$count = 0;
|
||||
if (!empty($result[1])) {
|
||||
foreach ($result[1] as $file) {
|
||||
if (preg_match('/'.preg_quote($fileName).'(?:[_\d]*)?\.php$/', $file)) {
|
||||
if (preg_match('/' . preg_quote($fileName) . '(?:[_\d]*)?\.php$/', $file)) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class SchemaShell extends AppShell {
|
|||
}
|
||||
}
|
||||
$db = ConnectionManager::getDataSource($this->Schema->connection);
|
||||
$contents = "\n\n" . $db->dropSchema($Schema) . "\n\n". $db->createSchema($Schema);
|
||||
$contents = "\n\n" . $db->dropSchema($Schema) . "\n\n" . $db->createSchema($Schema);
|
||||
|
||||
if ($write) {
|
||||
if (strpos($write, '.sql') === false) {
|
||||
|
@ -529,4 +529,5 @@ class SchemaShell extends AppShell {
|
|||
));
|
||||
return $parser;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -145,17 +145,16 @@ class ControllerTask extends BakeTask {
|
|||
$useDynamicScaffold = 'n';
|
||||
$wannaBakeCrud = 'y';
|
||||
|
||||
|
||||
$question[] = __d('cake_console', "Would you like to build your controller interactively?");
|
||||
if (file_exists($this->path . $controllerName .'Controller.php')) {
|
||||
if (file_exists($this->path . $controllerName . 'Controller.php')) {
|
||||
$question[] = __d('cake_console', "Warning: Choosing no will overwrite the %sController.", $controllerName);
|
||||
}
|
||||
$doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y');
|
||||
$doItInteractive = $this->in(implode("\n", $question), array('y', 'n'), 'y');
|
||||
|
||||
if (strtolower($doItInteractive) == 'y') {
|
||||
$this->interactive = true;
|
||||
$useDynamicScaffold = $this->in(
|
||||
__d('cake_console', "Would you like to use dynamic scaffolding?"), array('y','n'), 'n'
|
||||
__d('cake_console', "Would you like to use dynamic scaffolding?"), array('y', 'n'), 'n'
|
||||
);
|
||||
|
||||
if (strtolower($useDynamicScaffold) == 'y') {
|
||||
|
@ -233,7 +232,7 @@ class ControllerTask extends BakeTask {
|
|||
$output = '';
|
||||
$length = count($$var);
|
||||
foreach ($$var as $i => $propElement) {
|
||||
if ($i != $length -1) {
|
||||
if ($i != $length - 1) {
|
||||
$output .= ucfirst($propElement) . ', ';
|
||||
} else {
|
||||
$output .= ucfirst($propElement);
|
||||
|
@ -468,48 +467,4 @@ class ControllerTask extends BakeTask {
|
|||
))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function help() {
|
||||
$this->hr();
|
||||
$this->out("Usage: cake bake controller <arg1> <arg2>...");
|
||||
$this->hr();
|
||||
$this->out('Arguments:');
|
||||
$this->out();
|
||||
$this->out("<name>");
|
||||
$this->out("\tName of the controller to bake. Can use Plugin.name");
|
||||
$this->out("\tas a shortcut for plugin baking.");
|
||||
$this->out();
|
||||
$this->out('Params:');
|
||||
$this->out();
|
||||
$this->out('-connection <config>');
|
||||
$this->out("\tset db config <config>. uses 'default' if none is specified");
|
||||
$this->out();
|
||||
$this->out('Commands:');
|
||||
$this->out();
|
||||
$this->out("controller <name>");
|
||||
$this->out("\tbakes controller with var \$scaffold");
|
||||
$this->out();
|
||||
$this->out("controller <name> public");
|
||||
$this->out("\tbakes controller with basic crud actions");
|
||||
$this->out("\t(index, view, add, edit, delete)");
|
||||
$this->out();
|
||||
$this->out("controller <name> admin");
|
||||
$this->out("\tbakes a controller with basic crud actions for one of the");
|
||||
$this->out("\tConfigure::read('Routing.prefixes') methods.");
|
||||
$this->out();
|
||||
$this->out("controller <name> public admin");
|
||||
$this->out("\tbakes a controller with basic crud actions for one");
|
||||
$this->out("\tConfigure::read('Routing.prefixes') and non admin methods.");
|
||||
$this->out("\t(index, view, add, edit, delete,");
|
||||
$this->out("\tadmin_index, admin_view, admin_edit, admin_add, admin_delete)");
|
||||
$this->out();
|
||||
$this->out("controller all");
|
||||
$this->out("\tbakes all controllers with CRUD methods.");
|
||||
$this->out();
|
||||
$this->_stop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ class DbConfigTask extends AppShell {
|
|||
$connections = array_keys($configs);
|
||||
|
||||
if (count($connections) > 1) {
|
||||
$useDbConfig = $this->in(__d('cake_console', 'Use Database Config') .':', $connections, $useDbConfig);
|
||||
$useDbConfig = $this->in(__d('cake_console', 'Use Database Config') . ':', $connections, $useDbConfig);
|
||||
}
|
||||
return $useDbConfig;
|
||||
}
|
||||
|
@ -380,4 +380,5 @@ class DbConfigTask extends AppShell {
|
|||
__d('cake_console', 'Bake new database configuration settings.')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -584,8 +584,10 @@ class ExtractTask extends AppShell {
|
|||
*/
|
||||
protected function _getStrings(&$position, $target) {
|
||||
$strings = array();
|
||||
while (count($strings) < $target && ($this->_tokens[$position] == ',' || $this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING)) {
|
||||
if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING && $this->_tokens[$position+1] == '.') {
|
||||
$count = count($strings);
|
||||
while ($count < $target && ($this->_tokens[$position] == ',' || $this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING)) {
|
||||
$count = count($strings);
|
||||
if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING && $this->_tokens[$position + 1] == '.') {
|
||||
$string = '';
|
||||
while ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING || $this->_tokens[$position] == '.') {
|
||||
if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING) {
|
||||
|
@ -694,4 +696,5 @@ class ExtractTask extends AppShell {
|
|||
protected function _isExtractingApp() {
|
||||
return $this->_paths === array(APP);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class FixtureTask extends BakeTask {
|
|||
'help' => __d('cake_console', 'Used with --count and <name>/all commands to pull [n] records from the live tables, where [n] is either --count or the default of 10'),
|
||||
'short' => 'r',
|
||||
'boolean' => true
|
||||
))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));;
|
||||
))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -170,7 +170,7 @@ class ModelTask extends BakeTask {
|
|||
$max = count($options);
|
||||
while (!$valid) {
|
||||
foreach ($options as $i => $option) {
|
||||
$this->out($i + 1 .'. ' . $option);
|
||||
$this->out($i + 1 . '. ' . $option);
|
||||
}
|
||||
if (empty($prompt)) {
|
||||
$prompt = __d('cake_console', 'Make a selection from the choices above');
|
||||
|
@ -297,7 +297,7 @@ class ModelTask extends BakeTask {
|
|||
*/
|
||||
protected function _printAssociation($modelName, $type, $associations) {
|
||||
if (!empty($associations[$type])) {
|
||||
for ($i = 0; $i < count($associations[$type]); $i++) {
|
||||
for ($i = 0, $len = count($associations[$type]); $i < $len; $i++) {
|
||||
$out = "\t" . $modelName . ' ' . $type . ' ' . $associations[$type][$i]['alias'];
|
||||
$this->out($out);
|
||||
}
|
||||
|
@ -498,11 +498,14 @@ class ModelTask extends BakeTask {
|
|||
}
|
||||
|
||||
if (empty($this->_tables)) {
|
||||
$this->_tables = (array) $this->getAllTables();
|
||||
$this->_tables = (array)$this->getAllTables();
|
||||
}
|
||||
|
||||
$associations = array(
|
||||
'belongsTo' => array(), 'hasMany' => array(), 'hasOne' => array(), 'hasAndBelongsToMany' => array()
|
||||
'belongsTo' => array(),
|
||||
'hasMany' => array(),
|
||||
'hasOne' => array(),
|
||||
'hasAndBelongsToMany' => array()
|
||||
);
|
||||
|
||||
$associations = $this->findBelongsTo($model, $associations);
|
||||
|
@ -780,8 +783,14 @@ class ModelTask extends BakeTask {
|
|||
} else {
|
||||
$data['name'] = $name;
|
||||
}
|
||||
$defaults = array('associations' => array(), 'validate' => array(), 'primaryKey' => 'id',
|
||||
'useTable' => null, 'useDbConfig' => 'default', 'displayField' => null);
|
||||
$defaults = array(
|
||||
'associations' => array(),
|
||||
'validate' => array(),
|
||||
'primaryKey' => 'id',
|
||||
'useTable' => null,
|
||||
'useDbConfig' => 'default',
|
||||
'displayField' => null
|
||||
);
|
||||
$data = array_merge($defaults, $data);
|
||||
|
||||
$pluginPath = '';
|
||||
|
@ -824,7 +833,7 @@ class ModelTask extends BakeTask {
|
|||
* @return array
|
||||
*/
|
||||
public function listAll($useDbConfig = null) {
|
||||
$this->_tables = (array) $this->getAllTables($useDbConfig);
|
||||
$this->_tables = (array)$this->getAllTables($useDbConfig);
|
||||
|
||||
$this->_modelNames = array();
|
||||
$count = count($this->_tables);
|
||||
|
@ -975,4 +984,5 @@ class ModelTask extends BakeTask {
|
|||
$this->Fixture->plugin = $this->plugin;
|
||||
$this->Fixture->bake($className, $useTable);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ class PluginTask extends AppShell {
|
|||
$out = "<?php\n\n";
|
||||
$out .= "class {$plugin}AppController extends AppController {\n\n";
|
||||
$out .= "}\n\n";
|
||||
$this->createFile($this->path . $plugin. DS . 'Controller' . DS . $controllerFileName, $out);
|
||||
$this->createFile($this->path . $plugin . DS . 'Controller' . DS . $controllerFileName, $out);
|
||||
|
||||
$modelFileName = $plugin . 'AppModel.php';
|
||||
|
||||
|
@ -167,7 +167,7 @@ class PluginTask extends AppShell {
|
|||
$max = count($pathOptions);
|
||||
while (!$valid) {
|
||||
foreach ($pathOptions as $i => $option) {
|
||||
$this->out($i + 1 .'. ' . $option);
|
||||
$this->out($i + 1 . '. ' . $option);
|
||||
}
|
||||
$prompt = __d('cake_console', 'Choose a plugin path from the paths above.');
|
||||
$choice = $this->in($prompt);
|
||||
|
@ -191,7 +191,6 @@ class PluginTask extends AppShell {
|
|||
))->addArgument('name', array(
|
||||
'help' => __d('cake_console', 'CamelCased name of the plugin to create.')
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ class ProjectTask extends AppShell {
|
|||
$project = $this->in($prompt, null, APP . 'myapp');
|
||||
}
|
||||
|
||||
|
||||
if ($project && !Folder::isAbsolute($project) && isset($_SERVER['PWD'])) {
|
||||
$project = $_SERVER['PWD'] . DS . $project;
|
||||
}
|
||||
|
@ -112,7 +111,7 @@ class ProjectTask extends AppShell {
|
|||
$this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/index.php', CAKE_CORE_INCLUDE_PATH));
|
||||
$this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/test.php', CAKE_CORE_INCLUDE_PATH));
|
||||
} else {
|
||||
$this->err(__d('cake_console', 'Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' .DS .'index.php'));
|
||||
$this->err(__d('cake_console', 'Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' . DS .'index.php'));
|
||||
$success = false;
|
||||
}
|
||||
if ($success && $hardCode) {
|
||||
|
@ -231,8 +230,8 @@ class ProjectTask extends AppShell {
|
|||
$app = basename($dir);
|
||||
$path = $dir . 'View' . DS . 'Pages' . DS;
|
||||
$source = CAKE . 'Console' . DS . 'Templates' . DS .'default' . DS . 'views' . DS . 'home.ctp';
|
||||
include($source);
|
||||
return $this->createFile($path.'home.ctp', $output);
|
||||
include $source;
|
||||
return $this->createFile($path . 'home.ctp', $output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -149,7 +149,7 @@ class TemplateTask extends AppShell {
|
|||
extract($this->templateVars);
|
||||
ob_start();
|
||||
ob_implicit_flush(0);
|
||||
include($templateFile);
|
||||
include $templateFile;
|
||||
$content = ob_get_clean();
|
||||
return $content;
|
||||
}
|
||||
|
@ -214,4 +214,5 @@ class TemplateTask extends AppShell {
|
|||
$this->err(__d('cake_console', 'Could not find template for %s', $filename));
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -291,6 +291,7 @@ class TestTask extends BakeTask {
|
|||
* @param string $type The type of thing having a test generated.
|
||||
* @param string $plugin The plugin name.
|
||||
* @return string
|
||||
* @throws CakeException When invalid object types are requested.
|
||||
*/
|
||||
public function mapType($type, $plugin) {
|
||||
$type = ucfirst($type);
|
||||
|
@ -397,8 +398,8 @@ class TestTask extends BakeTask {
|
|||
protected function _addFixture($name) {
|
||||
$parent = get_parent_class($name);
|
||||
$prefix = 'app.';
|
||||
if (strtolower($parent) != 'appmodel' && strtolower(substr($parent, -8)) == 'appmodel') {
|
||||
$pluginName = substr($parent, 0, strlen($parent) -8);
|
||||
if (strtolower($parent) != 'appmodel' && strtolower(substr($parent, - 8)) == 'appmodel') {
|
||||
$pluginName = substr($parent, 0, strlen($parent) - 8);
|
||||
$prefix = 'plugin.' . Inflector::underscore($pluginName) . '.';
|
||||
}
|
||||
$fixture = $prefix . Inflector::underscore($name);
|
||||
|
@ -530,4 +531,5 @@ class TestTask extends BakeTask {
|
|||
'help' => __d('cake_console', 'CamelCased name of the plugin to bake tests for.')
|
||||
))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -464,4 +464,5 @@ class ViewTask extends BakeTask {
|
|||
}
|
||||
return $associations;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -192,7 +192,6 @@ class TestShell extends Shell {
|
|||
'output' => 'text',
|
||||
);
|
||||
|
||||
|
||||
if (strpos($this->args[0], '.php')) {
|
||||
$category = $this->_mapFileToCategory($this->args[0]);
|
||||
$params['case'] = $this->_mapFileToCase($this->args[0], $category);
|
||||
|
@ -431,4 +430,5 @@ class TestShell extends Shell {
|
|||
}
|
||||
return 'app';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -207,4 +207,5 @@ class TestsuiteShell extends TestShell {
|
|||
|
||||
$this->_run($args, $this->_runnerOptions());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ class UpgradeShell extends AppShell {
|
|||
$helpers = array_merge($pluginHelpers, $helpers);
|
||||
foreach ($helpers as $helper) {
|
||||
$helper = preg_replace('/Helper$/', '', $helper);
|
||||
$oldHelper = strtolower(substr($helper, 0, 1)).substr($helper, 1);
|
||||
$oldHelper = strtolower(substr($helper, 0, 1)) . substr($helper, 1);
|
||||
$patterns[] = array(
|
||||
"\${$oldHelper} to \$this->{$helper}",
|
||||
"/\\\${$oldHelper}->/",
|
||||
|
@ -355,7 +355,7 @@ class UpgradeShell extends AppShell {
|
|||
$pluginPath = App::pluginPath($this->params['plugin']);
|
||||
$this->_paths = array(
|
||||
$pluginPath . 'controllers' . DS,
|
||||
$pluginPath . 'controllers' . DS . 'components' .DS,
|
||||
$pluginPath . 'controllers' . DS . 'components' . DS,
|
||||
$pluginPath . 'views' . DS,
|
||||
);
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ class UpgradeShell extends AppShell {
|
|||
$pluginPath = App::pluginPath($this->params['plugin']);
|
||||
$this->_paths = array(
|
||||
$pluginPath . 'controllers' . DS,
|
||||
$pluginPath . 'controllers' . DS . 'components' .DS,
|
||||
$pluginPath . 'controllers' . DS . 'components' . DS,
|
||||
);
|
||||
}
|
||||
$patterns = array(
|
||||
|
@ -604,7 +604,7 @@ class UpgradeShell extends AppShell {
|
|||
protected function _moveAppClasses() {
|
||||
$files = array(
|
||||
APP . 'app_controller.php' => APP . 'Controller' . DS . 'AppController.php',
|
||||
APP . 'controllers' . DS .'app_controller.php' => APP . 'Controller' . DS . 'AppController.php',
|
||||
APP . 'controllers' . DS . 'app_controller.php' => APP . 'Controller' . DS . 'AppController.php',
|
||||
APP . 'app_model.php' => APP . 'Model' . DS . 'AppModel.php',
|
||||
APP . 'models' . DS . 'app_model.php' => APP . 'Model' . DS . 'AppModel.php',
|
||||
);
|
||||
|
@ -706,7 +706,7 @@ class UpgradeShell extends AppShell {
|
|||
if (!$this->params['dry-run']) {
|
||||
if ($this->params['git']) {
|
||||
exec('git mv -f ' . escapeshellarg($file) . ' ' . escapeshellarg($file . '__'));
|
||||
exec('git mv -f ' . escapeshellarg($file. '__') . ' ' . escapeshellarg($new));
|
||||
exec('git mv -f ' . escapeshellarg($file . '__') . ' ' . escapeshellarg($new));
|
||||
} else {
|
||||
rename($file, $new);
|
||||
}
|
||||
|
@ -854,4 +854,5 @@ class UpgradeShell extends AppShell {
|
|||
'parser' => $subcommandParser
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* @package Cake.Console
|
||||
*/
|
||||
class ConsoleInput {
|
||||
|
||||
/**
|
||||
* Input value.
|
||||
*
|
||||
|
@ -46,4 +47,5 @@ class ConsoleInput {
|
|||
public function read() {
|
||||
return fgets($this->_input);
|
||||
}
|
||||
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
* @package Cake.Console
|
||||
*/
|
||||
class ConsoleInputArgument {
|
||||
|
||||
/**
|
||||
* Name of the argument.
|
||||
*
|
||||
|
@ -125,7 +126,7 @@ class ConsoleInputArgument {
|
|||
* @return boolean
|
||||
*/
|
||||
public function isRequired() {
|
||||
return (bool) $this->_required;
|
||||
return (bool)$this->_required;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,4 +166,5 @@ class ConsoleInputArgument {
|
|||
}
|
||||
return $parent;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* @package Cake.Console
|
||||
*/
|
||||
class ConsoleInputOption {
|
||||
|
||||
/**
|
||||
* Name of the option
|
||||
*
|
||||
|
@ -171,7 +172,7 @@ class ConsoleInputOption {
|
|||
* @return boolean
|
||||
*/
|
||||
public function isBoolean() {
|
||||
return (bool) $this->_boolean;
|
||||
return (bool)$this->_boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,4 +217,5 @@ class ConsoleInputOption {
|
|||
}
|
||||
return $parent;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -117,4 +117,5 @@ class ConsoleInputSubcommand {
|
|||
$command->addAttribute('help', $this->_help);
|
||||
return $parent;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -551,6 +551,7 @@ class ConsoleOptionParser {
|
|||
* @param string $option The option to parse.
|
||||
* @param array $params The params to append the parsed value into
|
||||
* @return array Params with $option added in.
|
||||
* @throws ConsoleException When unknown short options are encountered.
|
||||
*/
|
||||
protected function _parseShortOption($option, $params) {
|
||||
$key = substr($option, 1);
|
||||
|
@ -597,7 +598,6 @@ class ConsoleOptionParser {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check to see if $name has an option (short/long) defined for it.
|
||||
*
|
||||
|
|
|
@ -284,4 +284,5 @@ class ConsoleOutput {
|
|||
public function __destruct() {
|
||||
fclose($this->_output);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ App::uses('String', 'Utility');
|
|||
* @since CakePHP(tm) v 2.0
|
||||
*/
|
||||
class HelpFormatter {
|
||||
|
||||
/**
|
||||
* The maximum number of arguments shown when generating usage.
|
||||
*
|
||||
|
@ -196,4 +197,5 @@ class HelpFormatter {
|
|||
}
|
||||
return $string ? $xml->asXml() : $xml;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -812,4 +812,5 @@ class Shell extends Object {
|
|||
}
|
||||
return current(App::path('plugins')) . $pluginName . DS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -328,4 +328,5 @@ class ShellDispatcher {
|
|||
protected function _stop($status = 0) {
|
||||
exit($status);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ App::uses('ObjectCollection', 'Utility');
|
|||
* @package Cake.Console
|
||||
*/
|
||||
class TaskCollection extends ObjectCollection {
|
||||
|
||||
/**
|
||||
* Shell to use to set params to tasks.
|
||||
*
|
||||
|
|
|
@ -39,29 +39,29 @@ class DbAclSchema extends CakeSchema {
|
|||
}
|
||||
|
||||
public $acos = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
|
||||
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'model' => array('type' => 'string', 'null' => true),
|
||||
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'alias' => array('type' => 'string', 'null' => true),
|
||||
'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||
'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||
);
|
||||
|
||||
public $aros = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
|
||||
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'model' => array('type' => 'string', 'null' => true),
|
||||
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'alias' => array('type' => 'string', 'null' => true),
|
||||
'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||
'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||
);
|
||||
|
||||
public $aros_acos = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
|
||||
'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
|
||||
'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10),
|
||||
'_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||
|
|
|
@ -39,12 +39,12 @@ class i18nSchema extends CakeSchema {
|
|||
}
|
||||
|
||||
public $i18n = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
|
||||
'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
|
||||
'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
|
||||
'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
|
||||
'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
|
||||
'content' => array('type' => 'text', 'null' => true, 'default' => NULL),
|
||||
'content' => array('type' => 'text', 'null' => true, 'default' => null),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
|
||||
);
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ class SessionsSchema extends CakeSchema {
|
|||
|
||||
public $cake_sessions = array(
|
||||
'id' => array('type' => 'string', 'null' => false, 'key' => 'primary'),
|
||||
'data' => array('type' => 'text', 'null' => true, 'default' => NULL),
|
||||
'expires' => array('type' => 'integer', 'null' => true, 'default' => NULL),
|
||||
'data' => array('type' => 'text', 'null' => true, 'default' => null),
|
||||
'expires' => array('type' => 'integer', 'null' => true, 'default' => null),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||
);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ if (function_exists('ini_set')) {
|
|||
ini_set('include_path', $root . PATH_SEPARATOR . __CAKE_PATH__ . PATH_SEPARATOR . ini_get('include_path'));
|
||||
}
|
||||
|
||||
if (!include($dispatcher)) {
|
||||
if (!include $dispatcher) {
|
||||
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
||||
}
|
||||
unset($paths, $path, $dispatcher, $root, $ds);
|
||||
|
|
|
@ -55,7 +55,7 @@ class PagesController extends AppController {
|
|||
if (!$count) {
|
||||
$this->redirect('/');
|
||||
}
|
||||
$page = $subpage = $title_for_layout = null;
|
||||
$page = $subpage = $title = null;
|
||||
|
||||
if (!empty($path[0])) {
|
||||
$page = $path[0];
|
||||
|
@ -64,9 +64,11 @@ class PagesController extends AppController {
|
|||
$subpage = $path[1];
|
||||
}
|
||||
if (!empty($path[$count - 1])) {
|
||||
$title_for_layout = Inflector::humanize($path[$count - 1]);
|
||||
$title = Inflector::humanize($path[$count - 1]);
|
||||
}
|
||||
$this->set(compact('page', 'subpage', 'title_for_layout'));
|
||||
$this->set(compact('page', 'subpage'));
|
||||
$this->set('title_for_layout', $title);
|
||||
$this->render(implode('/', $path));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ if (!$found && function_exists('ini_set')) {
|
|||
ini_set('include_path', $root . $ds . PATH_SEPARATOR . ini_get('include_path'));
|
||||
}
|
||||
|
||||
if (!include($dispatcher)) {
|
||||
if (!include $dispatcher) {
|
||||
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
||||
}
|
||||
unset($paths, $path, $found, $dispatcher, $root, $ds);
|
||||
|
|
Loading…
Reference in a new issue