Added /SapphireInfo URL with some basic version information

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@50452 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-03-02 23:21:58 +00:00
parent db1932b57c
commit a0fb07d8ba
2 changed files with 35 additions and 2 deletions

View File

@ -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();
}
}

15
templates/SapphireInfo.ss Normal file
View File

@ -0,0 +1,15 @@
<html>
<head>
<title>Sapphire Application Information</title>
</head>
<body>
<h1>Sapphire Application Information</h1>
<dl>
<dt>Sapphire version:</dt> <dd>$Version</dd>
<dt>Environment type:</dt> <dd>$EnvironmentType</dd>
<dt>Site URL:</dt> <dd>$BaseURL</dd>
</dl>
</body>
</html>