2008-01-16 05:24:27 +00:00
|
|
|
<?php
|
2016-06-23 11:37:22 +12:00
|
|
|
|
2016-08-19 10:51:35 +12:00
|
|
|
namespace SilverStripe\Dev;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
use SilverStripe\Control\Director;
|
2016-06-23 11:37:22 +12:00
|
|
|
use SilverStripe\Security\Permission;
|
|
|
|
use SilverStripe\Security\Security;
|
2016-08-19 10:51:35 +12:00
|
|
|
|
2008-01-16 05:24:27 +00:00
|
|
|
/**
|
|
|
|
* Returns information about the current site instance.
|
|
|
|
*/
|
2016-11-29 12:31:16 +13:00
|
|
|
class SapphireInfo extends Controller
|
|
|
|
{
|
|
|
|
private static $allowed_actions = array(
|
|
|
|
'baseurl',
|
|
|
|
'version',
|
|
|
|
'environmenttype',
|
|
|
|
);
|
2014-08-15 18:53:05 +12:00
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
protected function init()
|
|
|
|
{
|
|
|
|
parent::init();
|
|
|
|
if (!Director::is_cli() && !Permission::check('ADMIN')) {
|
|
|
|
Security::permissionFailure();
|
|
|
|
}
|
|
|
|
}
|
2014-08-15 18:53:05 +12:00
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
public function Version()
|
|
|
|
{
|
|
|
|
$sapphireVersion = file_get_contents(FRAMEWORK_PATH . '/silverstripe_version');
|
|
|
|
if (!$sapphireVersion) {
|
2017-04-20 13:15:24 +12:00
|
|
|
$sapphireVersion = _t('SilverStripe\\Admin\\LeftAndMain.VersionUnknown', 'unknown');
|
2016-11-29 12:31:16 +13:00
|
|
|
}
|
|
|
|
return $sapphireVersion;
|
|
|
|
}
|
2014-08-15 18:53:05 +12:00
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
public function EnvironmentType()
|
|
|
|
{
|
|
|
|
if (Director::isLive()) {
|
|
|
|
return "live";
|
|
|
|
} elseif (Director::isTest()) {
|
|
|
|
return "test";
|
|
|
|
} else {
|
|
|
|
return "dev";
|
|
|
|
}
|
|
|
|
}
|
2014-08-15 18:53:05 +12:00
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
public function BaseURL()
|
|
|
|
{
|
|
|
|
return Director::absoluteBaseURL();
|
|
|
|
}
|
2012-03-24 16:38:57 +13:00
|
|
|
}
|