diff --git a/core/control/SapphireInfo.php b/core/control/SapphireInfo.php index f8b4685e5..56ba7c78a 100644 --- a/core/control/SapphireInfo.php +++ b/core/control/SapphireInfo.php @@ -4,8 +4,26 @@ * Returns information about the current site instance. */ class SapphireInfo extends Controller { - function baseurl() { - return Director::absoluteBaseUrl() . "\n"; + function Version() { + $sapphireVersionFile = file_get_contents('../sapphire/silverstripe_version'); + + if(strstr($sapphireVersionFile, "/sapphire/trunk")) { + $sapphireVersion = "trunk"; + } else { + preg_match("/sapphire\/(?:(?:branches)|(?:tags))(?:\/rc)?\/([A-Za-z0-9._-]+)\/silverstripe_version/", $sapphireVersionFile, $matches); + $sapphireVersion = $matches[1]; + } + + return $sapphireVersion; } + function EnvironmentType() { + if(Director::isLive()) return "live"; + else if(Director::isTest()) return "test"; + else return "dev"; + } + + function BaseURL() { + return Director::absoluteBaseURL(); + } } \ No newline at end of file diff --git a/templates/SapphireInfo.ss b/templates/SapphireInfo.ss new file mode 100644 index 000000000..774f4dbff --- /dev/null +++ b/templates/SapphireInfo.ss @@ -0,0 +1,15 @@ + +
+