mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
console cake cleanup and unification
remove duplicate define
This commit is contained in:
parent
96df2c4b68
commit
a9de83daeb
3 changed files with 20 additions and 12 deletions
|
@ -17,20 +17,24 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
$ds = DIRECTORY_SEPARATOR;
|
||||
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
|
||||
if (!defined('DS')) {
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
|
||||
|
||||
if (function_exists('ini_set')) {
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
|
||||
// the following line differs from its sibling
|
||||
// /lib/Cake/Console/Templates/skel/Console/cake.php
|
||||
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'));
|
||||
unset($root);
|
||||
}
|
||||
|
||||
if (!include $dispatcher) {
|
||||
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
||||
}
|
||||
unset($paths, $path, $dispatcher, $root, $ds);
|
||||
unset($dispatcher);
|
||||
|
||||
return ShellDispatcher::run($argv);
|
||||
|
|
|
@ -79,7 +79,6 @@ class ShellDispatcher {
|
|||
}
|
||||
|
||||
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
define('CAKE_CORE_INCLUDE_PATH', dirname(dirname(dirname(__FILE__))));
|
||||
define('CAKEPHP_SHELL', true);
|
||||
if (!defined('CORE_PATH')) {
|
||||
|
|
|
@ -17,21 +17,24 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
$ds = DIRECTORY_SEPARATOR;
|
||||
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
|
||||
if (!defined('DS')) {
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
|
||||
$found = false;
|
||||
$paths = explode(PATH_SEPARATOR, ini_get('include_path'));
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (file_exists($path . $ds . $dispatcher)) {
|
||||
if (file_exists($path . DS . $dispatcher)) {
|
||||
$found = $path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
$rootInstall = dirname(dirname(dirname(__FILE__))) . $ds . $dispatcher;
|
||||
$composerInstall = dirname(dirname(__FILE__)) . $ds . $dispatcher;
|
||||
$rootInstall = dirname(dirname(dirname(__FILE__))) . DS . $dispatcher;
|
||||
$composerInstall = dirname(dirname(__FILE__)) . DS . $dispatcher;
|
||||
|
||||
if (file_exists($composerInstall)) {
|
||||
include $composerInstall;
|
||||
|
@ -40,10 +43,12 @@ if (!$found) {
|
|||
} else {
|
||||
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
||||
}
|
||||
unset($rootInstall, $composerInstall);
|
||||
|
||||
} else {
|
||||
include $found . $ds . $dispatcher;
|
||||
include $found . DS . $dispatcher;
|
||||
}
|
||||
|
||||
unset($paths, $path, $found, $dispatcher, $root, $ds);
|
||||
unset($paths, $path, $found, $dispatcher);
|
||||
|
||||
return ShellDispatcher::run($argv);
|
||||
|
|
Loading…
Reference in a new issue