mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
updating paths for shell, bake
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5063 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
7154feb7c8
commit
9b39236117
3 changed files with 39 additions and 13 deletions
|
@ -396,10 +396,16 @@ class ShellDispatcher {
|
|||
$app = $this->params['app'];
|
||||
}
|
||||
}
|
||||
if(in_array($app, array('cake', 'console', 'app'))){
|
||||
|
||||
if(empty($this->params['app']) && in_array($app, array('cake', 'console', 'app'))){
|
||||
$app = 'app';
|
||||
$this->params['working'] = dirname(dirname(__FILE__));
|
||||
}
|
||||
|
||||
if($this->params['working'] !== dirname(dirname(__FILE__))) {
|
||||
$this->params['root'] = $this->params['working'];
|
||||
}
|
||||
|
||||
$this->params = array_merge(array('app'=> $app, 'root'=> dirname($this->params['working'])), $this->params);
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -71,7 +71,7 @@ class BakeShell extends Shell {
|
|||
$this->hr();
|
||||
|
||||
if(!is_dir(CONFIGS)) {
|
||||
$this->project($this->params['working']);
|
||||
$this->project($this->params['app']);
|
||||
}
|
||||
|
||||
if(!config('database')) {
|
||||
|
@ -1858,6 +1858,11 @@ class BakeShell extends Shell {
|
|||
} else {
|
||||
$this->out('Unable to generate random hash for CAKE_SESSION_STRING, please change this yourself in ' . CONFIGS . 'core.php');
|
||||
}
|
||||
if($this->__setCake() === true ){
|
||||
$this->out('CAKE_CORE_INCLUDE_PATH set to ' . CAKE_CORE_INCLUDE_PATH);
|
||||
} else {
|
||||
$this->out('Unable to to set CAKE_CORE_INCLUDE_PATH, please change this yourself in ' . WWW_ROOT . 'index.php');
|
||||
}
|
||||
if(chmodr($projectPath.DS.'tmp', 0777) === false) {
|
||||
$this->out('Could not set permissions on '. $projectPath.DS.'tmp'.DS.'*');
|
||||
$this->out('You must manually check that these directories can be wrote to by the server');
|
||||
|
@ -1956,7 +1961,8 @@ class BakeShell extends Shell {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
function __generateHash(){
|
||||
|
||||
function __generateHash(){
|
||||
$file = file_get_contents(CONFIGS.'core.php');
|
||||
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_SESSION_STRING\\\',[\\t\\x20\'A-z0-9]*\\);)/', $file, $match)) {
|
||||
uses('Security');
|
||||
|
@ -1972,6 +1978,20 @@ class BakeShell extends Shell {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function __setCake(){
|
||||
$file = file_get_contents(APP.'webroot'.DS.'index.php');
|
||||
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $file, $match)) {
|
||||
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '".CAKE_CORE_INCLUDE_PATH."');", $file);
|
||||
if(file_put_contents(APP.'webroot'.DS.'index.php', $result)){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Outputs an ASCII art banner to standard output.
|
||||
*
|
||||
|
|
|
@ -71,10 +71,10 @@ class Shell extends Object {
|
|||
*/
|
||||
function __construct(&$dispatch) {
|
||||
$this->Dispatch = & $dispatch;
|
||||
$this->params = & $this->Dispatch->params;
|
||||
$this->args = & $this->Dispatch->args;
|
||||
$this->name = & $this->Dispatch->shellName;
|
||||
$this->command = & $this->Dispatch->shellCommand;
|
||||
$vars = array('params', 'args', 'shellName', 'shellCommand');
|
||||
foreach($vars as $var) {
|
||||
$this->{$var} = & $this->Dispatch->{$var};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Initializes the Shell
|
||||
|
|
Loading…
Add table
Reference in a new issue