mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API Protect Director::get_environment_type() from invoking
This commit is contained in:
parent
ff47bc03d7
commit
e74556b322
@ -571,9 +571,11 @@ class Director implements TemplateGlobalProvider
|
|||||||
* - SERVER_NAME
|
* - SERVER_NAME
|
||||||
* - gethostname()
|
* - gethostname()
|
||||||
*
|
*
|
||||||
|
* @param bool $respectConfig Set to false to ignore config override
|
||||||
|
* (Necessary for checking host pre-config)
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function host()
|
public static function host($respectConfig = true)
|
||||||
{
|
{
|
||||||
$headerOverride = false;
|
$headerOverride = false;
|
||||||
if (TRUSTED_PROXY) {
|
if (TRUSTED_PROXY) {
|
||||||
@ -591,6 +593,7 @@ class Director implements TemplateGlobalProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($respectConfig) {
|
||||||
if ($host = Director::config()->uninherited('alternate_host')) {
|
if ($host = Director::config()->uninherited('alternate_host')) {
|
||||||
return $host;
|
return $host;
|
||||||
}
|
}
|
||||||
@ -600,6 +603,7 @@ class Director implements TemplateGlobalProvider
|
|||||||
return parse_url($baseURL, PHP_URL_HOST);
|
return parse_url($baseURL, PHP_URL_HOST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($headerOverride) {
|
if ($headerOverride) {
|
||||||
return $headerOverride;
|
return $headerOverride;
|
||||||
@ -1173,10 +1177,11 @@ class Director implements TemplateGlobalProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if we are running on one of the test servers
|
// Check if we are running on one of the test servers
|
||||||
if (in_array(static::host(), self::$dev_servers)) {
|
// Note: Bypass config for checking environment type
|
||||||
|
if (in_array(static::host(false), self::$dev_servers)) {
|
||||||
return 'dev';
|
return 'dev';
|
||||||
}
|
}
|
||||||
if (in_array(static::host(), self::$test_servers)) {
|
if (in_array(static::host(false), self::$test_servers)) {
|
||||||
return 'test';
|
return 'test';
|
||||||
}
|
}
|
||||||
return 'live';
|
return 'live';
|
||||||
|
Loading…
Reference in New Issue
Block a user