ENHANCEMENT Added Director::get_environment_type()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63463 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-10-01 14:40:29 +00:00
parent 40fd160743
commit 655395a8e7

View File

@ -621,6 +621,23 @@ class Director {
}
}
/**
* Can also be checked with {@link Director::isDev()}, {@link Director::isTest()}, and {@link Director::isLive()}.
*
* @return string 'dev', 'test' or 'live'
*/
static function get_environment_type() {
if(Director::isLive()) {
return 'live';
} elseif(Director::isTest()) {
return 'test';
} elseif(Director::isDev()) {
return 'dev';
} else {
return false;
}
}
/**
* Specify HTTP_HOST values that are development environments.
* For information about environment types, see {@link Director::set_environment_type()}.