mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Changing order of text in project task.
Making ProjectTask::getPrefix silent when interactive = false. Making ProjectTask silent from View task if all or a controller name is provided.
This commit is contained in:
parent
db526ddfb7
commit
61d56cd275
2 changed files with 22 additions and 12 deletions
|
@ -281,30 +281,39 @@ class ProjectTask extends Shell {
|
|||
$admin = '';
|
||||
$prefixes = Configure::read('Routing.prefixes');
|
||||
if (!empty($prefixes)) {
|
||||
if ($this->interactive) {
|
||||
$this->out();
|
||||
$this->out(__('You have more than one routing prefix configured', true));
|
||||
}
|
||||
if (count($prefixes) == 1) {
|
||||
return $prefixes[0] . '_';
|
||||
}
|
||||
$options = array();
|
||||
foreach ($prefixes as $i => $prefix) {
|
||||
$options[] = $i + 1;
|
||||
$this->out($i + 1 . '. ' . $prefix);
|
||||
if ($this->interactive) {
|
||||
$this->out($i + 1 . '. ' . $prefix);
|
||||
}
|
||||
}
|
||||
$selection = $this->in(__('Please choose a prefix to bake with.', true), $options, 1);
|
||||
return $prefixes[$selection - 1] . '_';
|
||||
}
|
||||
|
||||
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
|
||||
$this->out(__('What would you like the prefix route to be?', true));
|
||||
$this->out(__('Example: www.example.com/admin/controller', true));
|
||||
while ($admin == '') {
|
||||
$admin = $this->in(__("What would you like the prefix route to be?", true), null, 'admin');
|
||||
}
|
||||
if ($this->cakeAdmin($admin) !== true) {
|
||||
$this->out(__('Unable to write to /app/config/core.php.', true));
|
||||
if ($this->interactive) {
|
||||
$this->hr();
|
||||
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
|
||||
$this->_stop();
|
||||
$this->out(__('What would you like the prefix route to be?', true));
|
||||
$this->out(__('Example: www.example.com/admin/controller', true));
|
||||
while ($admin == '') {
|
||||
$admin = $this->in(__("Enter a routing prefix:", true), null, 'admin');
|
||||
}
|
||||
if ($this->cakeAdmin($admin) !== true) {
|
||||
$this->out(__('Unable to write to /app/config/core.php.', true));
|
||||
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
|
||||
$this->_stop();
|
||||
}
|
||||
return $admin . '_';
|
||||
}
|
||||
return $admin . '_';
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -112,6 +112,7 @@ class ViewTask extends Shell {
|
|||
$this->controllerName = Inflector::camelize($this->args[0]);
|
||||
$this->controllerPath = Inflector::underscore($this->controllerName);
|
||||
|
||||
$this->Project->interactive = false;
|
||||
if (strtolower($this->args[0]) == 'all') {
|
||||
return $this->all();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue