mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Re-adding support for PHP's include_path.
Moving constants that are made of other constants into bootstrap.php
This commit is contained in:
parent
e083b21dfe
commit
721c438817
7 changed files with 113 additions and 46 deletions
|
@ -3,8 +3,6 @@
|
||||||
/**
|
/**
|
||||||
* Command-line code generation utility to automate programmer chores.
|
* Command-line code generation utility to automate programmer chores.
|
||||||
*
|
*
|
||||||
* Shell dispatcher class
|
|
||||||
*
|
|
||||||
* PHP 5
|
* PHP 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
@ -15,10 +13,29 @@
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link http://cakephp.org CakePHP(tm) Project
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
* @package app.console
|
* @package app.Console
|
||||||
* @since CakePHP(tm) v 1.2.0.5012
|
* @since CakePHP(tm) v 2.0
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
require_once(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'lib'. DIRECTORY_SEPARATOR . 'Cake' . DIRECTORY_SEPARATOR . 'Console' . DIRECTORY_SEPARATOR . 'ShellDispatcher.php');
|
$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)) {
|
||||||
|
$found = $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found && function_exists('ini_set')) {
|
||||||
|
$root = dirname(dirname(dirname(__FILE__)));
|
||||||
|
ini_set('include_path', $root . $ds. 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!include($dispatcher)) {
|
||||||
|
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
unset($paths, $path, $found, $dispatcher, $root, $ds);
|
||||||
|
|
||||||
return ShellDispatcher::run($argv);
|
return ShellDispatcher::run($argv);
|
||||||
|
|
|
@ -44,13 +44,17 @@
|
||||||
if (!defined('APP_DIR')) {
|
if (!defined('APP_DIR')) {
|
||||||
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
|
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
|
||||||
*
|
*
|
||||||
|
* Un-comment this line to specify a fixed path to CakePHP.
|
||||||
|
* This should point at the directory containg `Cake`.
|
||||||
|
*
|
||||||
|
* For ease of development CakePHP uses PHP's include_path. If you
|
||||||
|
* cannot modify your include_path set this value.
|
||||||
*/
|
*/
|
||||||
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
|
||||||
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editing below this line should NOT be necessary.
|
* Editing below this line should NOT be necessary.
|
||||||
|
@ -63,11 +67,20 @@
|
||||||
if (!defined('WWW_ROOT')) {
|
if (!defined('WWW_ROOT')) {
|
||||||
define('WWW_ROOT', dirname(__FILE__) . DS);
|
define('WWW_ROOT', dirname(__FILE__) . DS);
|
||||||
}
|
}
|
||||||
if (!defined('CORE_PATH')) {
|
|
||||||
define('APP_PATH', ROOT . DS . APP_DIR . DS);
|
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
if (function_exists('ini_set')) {
|
||||||
|
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
||||||
}
|
}
|
||||||
if (!include(CORE_PATH . 'Cake' . DS . 'bootstrap.php')) {
|
if (!include('Cake' . DS . 'bootstrap.php')) {
|
||||||
|
$failed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
|
||||||
|
$failed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($failed)) {
|
||||||
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
|
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,14 @@ ini_set('display_errors', 1);
|
||||||
if (!defined('APP_DIR')) {
|
if (!defined('APP_DIR')) {
|
||||||
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The absolute path to the "Cake" directory, WITHOUT a trailing DS.
|
* The absolute path to the "Cake" directory, WITHOUT a trailing DS.
|
||||||
*
|
*
|
||||||
|
* For ease of development CakePHP uses PHP's include_path. If you
|
||||||
|
* need to cannot modify your include_path, you can set this path.
|
||||||
*/
|
*/
|
||||||
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
|
||||||
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editing below this line should not be necessary.
|
* Editing below this line should not be necessary.
|
||||||
|
@ -63,11 +64,20 @@ if (!defined('WEBROOT_DIR')) {
|
||||||
if (!defined('WWW_ROOT')) {
|
if (!defined('WWW_ROOT')) {
|
||||||
define('WWW_ROOT', dirname(__FILE__) . DS);
|
define('WWW_ROOT', dirname(__FILE__) . DS);
|
||||||
}
|
}
|
||||||
if (!defined('CORE_PATH')) {
|
|
||||||
define('APP_PATH', ROOT . DS . APP_DIR . DS);
|
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
if (function_exists('ini_set')) {
|
||||||
|
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
||||||
|
}
|
||||||
|
if (!include('Cake' . DS . 'bootstrap.php')) {
|
||||||
|
$failed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
|
||||||
|
$failed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!include(CORE_PATH . 'Cake' . DS . 'bootstrap.php')) {
|
if (!empty($failed)) {
|
||||||
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
|
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,17 @@
|
||||||
if (!defined('APP_DIR')) {
|
if (!defined('APP_DIR')) {
|
||||||
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
|
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
|
||||||
*
|
*
|
||||||
|
* Un-comment this line to specify a fixed path to CakePHP.
|
||||||
|
* This should point at the directory containg `Cake`.
|
||||||
|
*
|
||||||
|
* For ease of development CakePHP uses PHP's include_path. If you
|
||||||
|
* need to squeeze a bit more performance you can set this path.
|
||||||
*/
|
*/
|
||||||
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
|
||||||
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editing below this line should NOT be necessary.
|
* Editing below this line should NOT be necessary.
|
||||||
|
@ -63,11 +67,20 @@
|
||||||
if (!defined('WWW_ROOT')) {
|
if (!defined('WWW_ROOT')) {
|
||||||
define('WWW_ROOT', dirname(__FILE__) . DS);
|
define('WWW_ROOT', dirname(__FILE__) . DS);
|
||||||
}
|
}
|
||||||
if (!defined('CORE_PATH')) {
|
|
||||||
define('APP_PATH', ROOT . DS . APP_DIR . DS);
|
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
if (function_exists('ini_set')) {
|
||||||
|
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
||||||
}
|
}
|
||||||
if (!include(CORE_PATH . 'Cake' . DS . 'bootstrap.php')) {
|
if (!include('Cake' . DS . 'bootstrap.php')) {
|
||||||
|
$failed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
|
||||||
|
$failed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($failed)) {
|
||||||
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
|
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,5 +89,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
App::uses('Dispatcher', 'Routing');
|
App::uses('Dispatcher', 'Routing');
|
||||||
|
|
||||||
$Dispatcher = new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding'))));
|
$Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding'))));
|
||||||
|
|
|
@ -44,13 +44,14 @@ ini_set('display_errors', 1);
|
||||||
if (!defined('APP_DIR')) {
|
if (!defined('APP_DIR')) {
|
||||||
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The absolute path to the "Cake" directory, WITHOUT a trailing DS.
|
* The absolute path to the "Cake" directory, WITHOUT a trailing DS.
|
||||||
*
|
*
|
||||||
|
* For ease of development CakePHP uses PHP's include_path. If you
|
||||||
|
* need to cannot modify your include_path, you can set this path.
|
||||||
*/
|
*/
|
||||||
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
|
||||||
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editing below this line should not be necessary.
|
* Editing below this line should not be necessary.
|
||||||
|
@ -63,11 +64,20 @@ if (!defined('WEBROOT_DIR')) {
|
||||||
if (!defined('WWW_ROOT')) {
|
if (!defined('WWW_ROOT')) {
|
||||||
define('WWW_ROOT', dirname(__FILE__) . DS);
|
define('WWW_ROOT', dirname(__FILE__) . DS);
|
||||||
}
|
}
|
||||||
if (!defined('CORE_PATH')) {
|
|
||||||
define('APP_PATH', ROOT . DS . APP_DIR . DS);
|
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
if (function_exists('ini_set')) {
|
||||||
|
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
||||||
|
}
|
||||||
|
if (!include('Cake' . DS . 'bootstrap.php')) {
|
||||||
|
$failed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
|
||||||
|
$failed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!include(CORE_PATH . 'Cake' . DS . 'bootstrap.php')) {
|
if (!empty($failed)) {
|
||||||
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
|
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
* @since CakePHP(tm) v 1.2.0.5012
|
* @since CakePHP(tm) v 1.2.0.5012
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR. 'ShellDispatcher.php');
|
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ShellDispatcher.php');
|
||||||
|
|
||||||
return ShellDispatcher::run($argv);
|
return ShellDispatcher::run($argv);
|
||||||
|
|
|
@ -23,18 +23,21 @@ if (!defined('E_DEPRECATED')) {
|
||||||
}
|
}
|
||||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||||
|
|
||||||
/**
|
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
* If the index.php file is used instead of an .htaccess file
|
define('CAKE_CORE_INCLUDE_PATH', dirname(dirname(__FILE__)));
|
||||||
* or if the user can not set the web root to use the public
|
}
|
||||||
* directory we will define ROOT there, otherwise we set it
|
|
||||||
* here.
|
if (!defined('CORE_PATH')) {
|
||||||
*/
|
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
||||||
if (!defined('ROOT')) {
|
}
|
||||||
define('ROOT', '../');
|
|
||||||
}
|
if (!defined('APP_PATH')) {
|
||||||
if (!defined('WEBROOT_DIR')) {
|
define('APP_PATH', ROOT . DS . APP_DIR . DS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined('WEBROOT_DIR')) {
|
||||||
define('WEBROOT_DIR', 'webroot');
|
define('WEBROOT_DIR', 'webroot');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path to the cake directory.
|
* Path to the cake directory.
|
||||||
|
|
Loading…
Reference in a new issue