mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Ensure site works if executed in a chrooted enviornment where BASE_PATH is '/'. (#4069)
This commit is contained in:
parent
a64715beeb
commit
213a08aac7
@ -124,7 +124,11 @@ if(!isset($_SERVER['HTTP_HOST'])) {
|
||||
*/
|
||||
if(!defined('BASE_PATH')) {
|
||||
// Assuming that this file is sapphire/core/Core.php we can then determine the base path
|
||||
define('BASE_PATH', rtrim(dirname(dirname(dirname(__FILE__))), DIRECTORY_SEPARATOR));
|
||||
$candidateBasePath = rtrim(dirname(dirname(dirname(__FILE__))), DIRECTORY_SEPARATOR);
|
||||
// We can't have an empty BASE_PATH. Making it / means that double-slashes occur in places but that's benign.
|
||||
// This likely only happens on chrooted environemnts
|
||||
if($candidateBasePath == '') $candidateBasePath = DIRECTORY_SEPARATOR;
|
||||
define('BASE_PATH', $candidateBasePath);
|
||||
}
|
||||
if(!defined('BASE_URL')) {
|
||||
// Determine the base URL by comparing SCRIPT_NAME to SCRIPT_FILENAME and getting common elements
|
||||
|
Loading…
Reference in New Issue
Block a user