mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
parent
9a7adc46f8
commit
09b3a24f30
@ -418,6 +418,13 @@ variable set-up process. This generally encouraged bad practice and should be av
|
|||||||
logic early in the bootstrap, this is best placed in the `_config.php` files.
|
logic early in the bootstrap, this is best placed in the `_config.php` files.
|
||||||
|
|
||||||
Note also that `$_FILE_TO_URL_MAPPING` has been removed and replaced with `SS_BASE_URL` env var.
|
Note also that `$_FILE_TO_URL_MAPPING` has been removed and replaced with `SS_BASE_URL` env var.
|
||||||
|
This url must be an absolute url with an optional protocol. The following are valid, for example:
|
||||||
|
|
||||||
|
```
|
||||||
|
SS_BASE_URL="http://localhost/"
|
||||||
|
SS_BASE_URL="https://localhost/"
|
||||||
|
SS_BASE_URL="//localhost/"
|
||||||
|
```
|
||||||
|
|
||||||
The global values `$database` and `$databaseConfig` have been deprecated, as has `ConfigureFromEnv.php`
|
The global values `$database` and `$databaseConfig` have been deprecated, as has `ConfigureFromEnv.php`
|
||||||
which is no longer necessary.
|
which is no longer necessary.
|
||||||
|
@ -72,6 +72,20 @@ if (!getenv('SS_IGNORE_DOT_ENV')) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate SS_BASE_URL is absolute
|
||||||
|
if (getenv('SS_BASE_URL') && !preg_match('#^(\w+:)?//.*#', getenv('SS_BASE_URL'))) {
|
||||||
|
call_user_func(function () {
|
||||||
|
$base = getenv('SS_BASE_URL');
|
||||||
|
user_error(
|
||||||
|
"SS_BASE_URL should be an absolute url with protocol "
|
||||||
|
. "(http://$base) or without protocol (//$base)",
|
||||||
|
E_USER_WARNING
|
||||||
|
);
|
||||||
|
// Treat as protocol-less absolute url
|
||||||
|
$base = '//' . $base;
|
||||||
|
putenv("SS_BASE_URL=$base");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!defined('BASE_URL')) {
|
if (!defined('BASE_URL')) {
|
||||||
define('BASE_URL', call_user_func(function () {
|
define('BASE_URL', call_user_func(function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user