mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.0' into 2.1
Conflicts: lib/Cake/Model/CakeSchema.php
This commit is contained in:
commit
0568746bfd
7 changed files with 16 additions and 39 deletions
|
@ -19,16 +19,8 @@
|
||||||
*/
|
*/
|
||||||
$ds = DIRECTORY_SEPARATOR;
|
$ds = DIRECTORY_SEPARATOR;
|
||||||
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
|
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
|
||||||
$found = false;
|
|
||||||
$paths = explode(PATH_SEPARATOR, ini_get('include_path'));
|
|
||||||
|
|
||||||
foreach ($paths as $path) {
|
if (function_exists('ini_set')) {
|
||||||
if (file_exists($path . $ds . $dispatcher)) {
|
|
||||||
$found = $path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$found && function_exists('ini_set')) {
|
|
||||||
$root = dirname(dirname(dirname(__FILE__)));
|
$root = dirname(dirname(dirname(__FILE__)));
|
||||||
ini_set('include_path', $root . $ds. 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
ini_set('include_path', $root . $ds. 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
||||||
}
|
}
|
||||||
|
@ -36,6 +28,6 @@ if (!$found && function_exists('ini_set')) {
|
||||||
if (!include($dispatcher)) {
|
if (!include($dispatcher)) {
|
||||||
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
unset($paths, $path, $found, $dispatcher, $root, $ds);
|
unset($paths, $path, $dispatcher, $root, $ds);
|
||||||
|
|
||||||
return ShellDispatcher::run($argv);
|
return ShellDispatcher::run($argv);
|
||||||
|
|
|
@ -47,11 +47,11 @@ class ConsoleShell extends AppShell {
|
||||||
public $models = array();
|
public $models = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override initialize of the Shell
|
* Override startup of the Shell
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize() {
|
public function startup() {
|
||||||
App::uses('Dispatcher', 'Routing');
|
App::uses('Dispatcher', 'Routing');
|
||||||
$this->Dispatcher = new Dispatcher();
|
$this->Dispatcher = new Dispatcher();
|
||||||
$this->models = App::objects('Model');
|
$this->models = App::objects('Model');
|
||||||
|
|
|
@ -49,23 +49,16 @@ class SchemaShell extends AppShell {
|
||||||
*/
|
*/
|
||||||
protected $_dry = null;
|
protected $_dry = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Override initialize
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function initialize() {
|
|
||||||
$this->_welcome();
|
|
||||||
$this->out('Cake Schema Shell');
|
|
||||||
$this->hr();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override startup
|
* Override startup
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function startup() {
|
public function startup() {
|
||||||
|
$this->_welcome();
|
||||||
|
$this->out('Cake Schema Shell');
|
||||||
|
$this->hr();
|
||||||
|
|
||||||
$name = $path = $connection = $plugin = null;
|
$name = $path = $connection = $plugin = null;
|
||||||
if (!empty($this->params['name'])) {
|
if (!empty($this->params['name'])) {
|
||||||
$name = $this->params['name'];
|
$name = $this->params['name'];
|
||||||
|
|
|
@ -19,23 +19,15 @@
|
||||||
*/
|
*/
|
||||||
$ds = DIRECTORY_SEPARATOR;
|
$ds = DIRECTORY_SEPARATOR;
|
||||||
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
|
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
|
||||||
$found = false;
|
|
||||||
$paths = explode(PATH_SEPARATOR, ini_get('include_path'));
|
|
||||||
|
|
||||||
foreach ($paths as $path) {
|
if (function_exists('ini_set')) {
|
||||||
if (file_exists($path . $ds . $dispatcher)) {
|
|
||||||
$found = $path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$found && function_exists('ini_set')) {
|
|
||||||
$root = dirname(dirname(dirname(__FILE__)));
|
$root = dirname(dirname(dirname(__FILE__)));
|
||||||
ini_set('include_path', __CAKE_PATH__ . PATH_SEPARATOR . ini_get('include_path'));
|
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);
|
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
unset($paths, $path, $found, $dispatcher, $root, $ds);
|
unset($paths, $path, $dispatcher, $root, $ds);
|
||||||
|
|
||||||
return ShellDispatcher::run($argv);
|
return ShellDispatcher::run($argv);
|
||||||
|
|
|
@ -384,9 +384,9 @@ class CakeSchema extends Object {
|
||||||
}
|
}
|
||||||
$out .= "}\n";
|
$out .= "}\n";
|
||||||
|
|
||||||
$file = new SplFileObject($path . DS . $file, 'w+');
|
$file = new File($path . DS . $file, true);
|
||||||
$content = "<?php\n{$out}";
|
$content = "<?php \n{$out}";
|
||||||
if ($file->fwrite($content)) {
|
if ($file->write($content)) {
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -559,7 +559,7 @@ class CakeRequest implements ArrayAccess {
|
||||||
public function here($base = true) {
|
public function here($base = true) {
|
||||||
$url = $this->here;
|
$url = $this->here;
|
||||||
if (!empty($this->query)) {
|
if (!empty($this->query)) {
|
||||||
$url .= '?' . http_build_query($this->query);
|
$url .= '?' . http_build_query($this->query, null, '&');
|
||||||
}
|
}
|
||||||
if (!$base) {
|
if (!$base) {
|
||||||
$url = preg_replace('/^' . preg_quote($this->base, '/') . '/', '', $url, 1);
|
$url = preg_replace('/^' . preg_quote($this->base, '/') . '/', '', $url, 1);
|
||||||
|
|
|
@ -188,7 +188,7 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
$this->Shell->args = array('TestPlugin.schema');
|
$this->Shell->args = array('TestPlugin.schema');
|
||||||
$this->Shell->startup();
|
$this->Shell->startup();
|
||||||
$this->Shell->expects($this->exactly(2))->method('_stop');
|
$this->Shell->expects($this->exactly(2))->method('_stop');
|
||||||
$this->Shell->expects($this->exactly(2))->method('out');
|
$this->Shell->expects($this->atLeastOnce())->method('out');
|
||||||
$this->Shell->view();
|
$this->Shell->view();
|
||||||
|
|
||||||
$this->Shell->args = array();
|
$this->Shell->args = array();
|
||||||
|
|
Loading…
Reference in a new issue