Merge pull request #7770 from dhensby/pulls/4.0/add-public-dir-constants

Add `PUBLIC_*` constants to 4.0.x for easier compatibility
This commit is contained in:
Damian Mooyman 2018-01-18 09:02:36 +13:00 committed by GitHub
commit 6b69907d1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,6 @@ use SilverStripe\Core\TempFolder;
* This file is the Framework constants bootstrap. It will prepare some basic common constants.
*
* It takes care of:
* - Normalisation of $_SERVER values
* - Initialisation of necessary constants (mostly paths)
*
* Initialized constants:
@ -23,6 +22,8 @@ use SilverStripe\Core\TempFolder;
* - THEMES_PATH: Absolute filepath, e.g. "/var/www/my-webroot/themes"
* - FRAMEWORK_DIR: Path relative to webroot, e.g. "framework"
* - FRAMEWORK_PATH:Absolute filepath, e.g. "/var/www/my-webroot/framework"
* - PUBLIC_DIR: Webroot path relative to project root, e.g. "public" or ""
* - PUBLIC_PATH: Absolute path to webroot, e.g. "/var/www/project/public"
* - THIRDPARTY_DIR: Path relative to webroot, e.g. "framework/thirdparty"
* - THIRDPARTY_PATH: Absolute filepath, e.g. "/var/www/my-webroot/framework/thirdparty"
*/
@ -57,6 +58,14 @@ if (!defined('BASE_PATH')) {
}));
}
// Set public webroot dir / path
if (!defined('PUBLIC_DIR')) {
define('PUBLIC_DIR', '');
}
if (!defined('PUBLIC_PATH')) {
define('PUBLIC_PATH', BASE_PATH);
}
// Allow a first class env var to be set that disables .env file loading
if (!Environment::getEnv('SS_IGNORE_DOT_ENV')) {
call_user_func(function () {