mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
"Fixes #4201, Cake i18n script in command line.
Fixed i18n shell to prompt for task commands. Changed i18n shell to create database tables using schema Changed acl shell to create database tables using schema" git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6516 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
d801e5c897
commit
2e3391006f
4 changed files with 36 additions and 43 deletions
|
@ -285,7 +285,9 @@ class ShellDispatcher {
|
|||
}
|
||||
|
||||
if ($loaded) {
|
||||
if (!class_exists('Shell')) {
|
||||
require CONSOLE_LIBS . 'shell.php';
|
||||
}
|
||||
require $this->shellPath;
|
||||
if (class_exists($this->shellClass)) {
|
||||
$command = null;
|
||||
|
|
|
@ -347,7 +347,8 @@ class AclShell extends Shell {
|
|||
* @access public
|
||||
*/
|
||||
function initdb() {
|
||||
$this->err('This command is deprecated. Please use, cake schema run create DbAcl');
|
||||
$this->Dispatch->args = array('schema', 'run', 'create', 'DbAcl');
|
||||
$this->Dispatch->dispatch();
|
||||
}
|
||||
/**
|
||||
* Show help screen.
|
||||
|
|
|
@ -54,6 +54,7 @@ class I18nShell extends Shell {
|
|||
* @access public
|
||||
*/
|
||||
function startup() {
|
||||
|
||||
if (isset($this->params['datasource'])) {
|
||||
$this->dataSource = $this->params['datasource'];
|
||||
}
|
||||
|
@ -104,27 +105,8 @@ class I18nShell extends Shell {
|
|||
* @access public
|
||||
*/
|
||||
function initdb() {
|
||||
$db =& ConnectionManager::getDataSource($this->dataSource);
|
||||
$this->out(__('Initializing Database...', true), true);
|
||||
$this->out(__('Creating i18n table ...', true), true);
|
||||
$sql = ' CREATE TABLE '.$db->fullTableName('i18n').' (
|
||||
'.$db->name('id').' '.$db->column($db->columns['primary_key']).',
|
||||
'.$db->name('locale').' '.$db->column(array('name' => 'varchar', 'limit' => 6)).' NOT NULL,
|
||||
'.$db->name('model').' '.$db->column($db->columns['string']).' NOT NULL,
|
||||
'.$db->name('foreign_key').' '.$db->column($db->columns['integer']).' NOT NULL,
|
||||
'.$db->name('field').' '.$db->column($db->columns['string']).' NOT NULL,
|
||||
'.$db->name('content').' '.$db->column($db->columns['text']).',
|
||||
PRIMARY KEY ('.$db->name('id').'),
|
||||
INDEX locale ('.$db->name('locale').'),
|
||||
INDEX model ('.$db->name('model').'),
|
||||
INDEX foreign_key ('.$db->name('foreign_key').'),
|
||||
INDEX field ('.$db->name('field').')
|
||||
)';
|
||||
if ($db->query($sql) === false) {
|
||||
die('Error: ' . $db->lastError());
|
||||
}
|
||||
|
||||
$this->out(__('Done.', true), true);
|
||||
$this->Dispatch->args = array('schema', 'run', 'create', 'i18n');
|
||||
$this->Dispatch->dispatch();
|
||||
}
|
||||
/**
|
||||
* Show help screen.
|
||||
|
|
|
@ -129,6 +129,20 @@ class ExtractTask extends Shell{
|
|||
* @access public
|
||||
*/
|
||||
function initialize() {
|
||||
}
|
||||
/**
|
||||
* Override startup
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function startup() {
|
||||
}
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (isset($this->params['files']) && !is_array($this->params['files'])) {
|
||||
$this->files = explode(',', $this->params['files']);
|
||||
}
|
||||
|
@ -148,7 +162,7 @@ class ExtractTask extends Shell{
|
|||
$this->path = $response;
|
||||
} else {
|
||||
$this->err('The directory path you supplied was not found. Please try again.');
|
||||
$this->initialize();
|
||||
$this->execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,27 +187,21 @@ class ExtractTask extends Shell{
|
|||
$this->__output = $response . DS;
|
||||
} else {
|
||||
$this->err('The directory path you supplied was not found. Please try again.');
|
||||
$this->initialize();
|
||||
$this->execute();
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->files)) {
|
||||
$this->files = $this->__searchDirectory();
|
||||
}
|
||||
$this->__extract();
|
||||
}
|
||||
/**
|
||||
* Override startup
|
||||
* Extract text
|
||||
*
|
||||
* @access public
|
||||
* @access private
|
||||
*/
|
||||
function startup() {
|
||||
}
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
function __extract() {
|
||||
$this->out('');
|
||||
$this->out('');
|
||||
$this->out(__('Extracting...', true));
|
||||
|
|
Loading…
Add table
Reference in a new issue