Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Made _stop() usage in Consoles / Tasks more consistent

  • Loading branch information...
commit dad1f16eaf1c9e83459e35f6286b0c53c8185e9d 1 parent 54ca435
@tersmitten tersmitten authored
View
2  lib/Cake/Console/Command/AclShell.php
@@ -82,7 +82,7 @@ public function startup() {
$out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n";
$out .= "--------------------------------------------------\n";
$this->err($out);
- $this->_stop();
+ return $this->_stop();
}
if ($this->command) {
View
2  lib/Cake/Console/Command/ApiShell.php
@@ -100,7 +100,7 @@ public function main() {
if (isset($this->params['method'])) {
if (!isset($parsed[$this->params['method']])) {
$this->err(__d('cake_console', '%s::%s() could not be found', $class, $this->params['method']));
- $this->_stop();
+ return $this->_stop();
}
$method = $parsed[$this->params['method']];
$this->out($class . '::' . $method['method'] . $method['parameters']);
View
20 lib/Cake/Console/Command/SchemaShell.php
@@ -106,11 +106,11 @@ public function view() {
$File = new File($this->Schema->path . DS . $this->params['file']);
if ($File->exists()) {
$this->out($File->read());
- $this->_stop();
+ return $this->_stop();
} else {
$file = $this->Schema->path . DS . $this->params['file'];
$this->err(__d('cake_console', 'Schema file (%s) could not be found.', $file));
- $this->_stop();
+ return $this->_stop();
}
}
@@ -184,10 +184,10 @@ public function generate() {
if ($this->Schema->write($content)) {
$this->out(__d('cake_console', 'Schema file: %s generated', $content['file']));
- $this->_stop();
+ return $this->_stop();
} else {
$this->err(__d('cake_console', 'Schema file: %s generated'));
- $this->_stop();
+ return $this->_stop();
}
}
@@ -205,7 +205,7 @@ public function dump() {
$Schema = $this->Schema->load();
if (!$Schema) {
$this->err(__d('cake_console', 'Schema could not be loaded'));
- $this->_stop();
+ return $this->_stop();
}
if (!empty($this->params['write'])) {
if ($this->params['write'] == 1) {
@@ -229,10 +229,10 @@ public function dump() {
if ($File->write($contents)) {
$this->out(__d('cake_console', 'SQL dump file created in %s', $File->pwd()));
- $this->_stop();
+ return $this->_stop();
} else {
$this->err(__d('cake_console', 'SQL dump could not be created'));
- $this->_stop();
+ return $this->_stop();
}
}
$this->out($contents);
@@ -290,7 +290,7 @@ protected function _loadSchema() {
$this->err(__d('cake_console', 'The chosen schema could not be loaded. Attempted to load:'));
$this->err(__d('cake_console', 'File: %s', $this->Schema->path . DS . $this->Schema->file));
$this->err(__d('cake_console', 'Name: %s', $this->Schema->name));
- $this->_stop();
+ return $this->_stop();
}
$table = null;
if (isset($this->args[1])) {
@@ -323,7 +323,7 @@ protected function _create(CakeSchema $Schema, $table = null) {
}
if (empty($drop) || empty($create)) {
$this->out(__d('cake_console', 'Schema is up to date.'));
- $this->_stop();
+ return $this->_stop();
}
$this->out("\n" . __d('cake_console', 'The following table(s) will be dropped.'));
@@ -375,7 +375,7 @@ protected function _update(&$Schema, $table = null) {
if (empty($contents)) {
$this->out(__d('cake_console', 'Schema is up to date.'));
- $this->_stop();
+ return $this->_stop();
}
$this->out("\n" . __d('cake_console', 'The following statements will run.'));
View
2  lib/Cake/Console/Command/Task/ControllerTask.php
@@ -289,7 +289,7 @@ public function bakeActions($controllerName, $admin = null, $wannaUseSession = t
App::uses($modelImport, $plugin . 'Model');
if (!class_exists($modelImport)) {
$this->err(__d('cake_console', 'You must have a model for this class to build basic methods. Please try again.'));
- $this->_stop();
+ return $this->_stop();
}
$modelObj = ClassRegistry::init($currentModelName);
View
2  lib/Cake/Console/Command/Task/DbConfigTask.php
@@ -77,7 +77,7 @@ public function initialize() {
public function execute() {
if (empty($this->args)) {
$this->_interactive();
- $this->_stop();
+ return $this->_stop();
}
}
View
2  lib/Cake/Console/Command/Task/ExtractTask.php
@@ -207,7 +207,7 @@ public function execute() {
$response = $this->in($message, null, rtrim($this->_paths[0], DS) . DS . 'Locale');
if (strtoupper($response) === 'Q') {
$this->out(__d('cake_console', 'Extract Aborted'));
- $this->_stop();
+ return $this->_stop();
} elseif ($this->_isPathUsable($response)) {
$this->_output = $response . DS;
break;
View
4 lib/Cake/Console/Command/Task/ModelTask.php
@@ -911,7 +911,7 @@ public function getAllTables($useDbConfig = null) {
}
if (empty($tables)) {
$this->err(__d('cake_console', 'Your database does not have any tables.'));
- $this->_stop();
+ return $this->_stop();
}
return $tables;
}
@@ -933,7 +933,7 @@ public function getName($useDbConfig = null) {
if ($enteredModel === 'q') {
$this->out(__d('cake_console', 'Exit'));
- $this->_stop();
+ return $this->_stop();
}
if (!$enteredModel || intval($enteredModel) > count($this->_modelNames)) {
View
2  lib/Cake/Console/Command/Task/ProjectTask.php
@@ -417,7 +417,7 @@ public function getPrefix() {
$this->out(__d('cake_console', 'You need to enable %s in %s to use prefix routing.',
'Configure::write(\'Routing.prefixes\', array(\'admin\'))',
'/app/Config/core.php'));
- $this->_stop();
+ return $this->_stop();
}
return $admin . '_';
}
View
4 lib/Cake/Console/Command/Task/ViewTask.php
@@ -267,7 +267,7 @@ protected function _loadController() {
if (!class_exists($controllerClassName)) {
$file = $controllerClassName . '.php';
$this->err(__d('cake_console', "The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file));
- $this->_stop();
+ return $this->_stop();
}
$controllerObj = new $controllerClassName();
$controllerObj->plugin = $this->plugin;
@@ -334,7 +334,7 @@ public function customAction() {
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n'), 'y');
if (strtolower($looksGood) === 'y') {
$this->bake($action, ' ');
- $this->_stop();
+ return $this->_stop();
} else {
$this->out(__d('cake_console', 'Bake Aborted.'));
}
View
4 lib/Cake/Console/ConsoleErrorHandler.php
@@ -60,7 +60,7 @@ public function handleException(Exception $exception) {
$exception->getMessage(),
$exception->getTraceAsString()
));
- $this->_stop($exception->getCode() ? $exception->getCode() : 1);
+ return $this->_stop($exception->getCode() ? $exception->getCode() : 1);
}
/**
@@ -88,7 +88,7 @@ public function handleError($code, $description, $file = null, $line = null, $co
}
if ($log === LOG_ERR) {
- $this->_stop(1);
+ return $this->_stop(1);
}
}
View
6 lib/Cake/Console/Shell.php
@@ -504,7 +504,7 @@ protected function _getInput($prompt, $options, $default) {
$result = $this->stdin->read();
if ($result === false) {
- $this->_stop(1);
+ return $this->_stop(1);
}
$result = trim($result);
@@ -618,7 +618,7 @@ public function error($title, $message = null) {
if (!empty($message)) {
$this->err($message);
}
- $this->_stop(1);
+ return $this->_stop(1);
}
/**
@@ -656,7 +656,7 @@ public function createFile($path, $contents) {
if (strtolower($key) === 'q') {
$this->out(__d('cake_console', '<error>Quitting</error>.'), 2);
- $this->_stop();
+ return $this->_stop();
} elseif (strtolower($key) !== 'y') {
$this->out(__d('cake_console', 'Skip `%s`', $path), 2);
return false;
View
2  lib/Cake/Console/ShellDispatcher.php
@@ -65,7 +65,7 @@ public function __construct($args = array(), $bootstrap = true) {
*/
public static function run($argv) {
$dispatcher = new ShellDispatcher($argv);
- $dispatcher->_stop($dispatcher->dispatch() === false ? 1 : 0);
+ return $dispatcher->_stop($dispatcher->dispatch() === false ? 1 : 0);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.