2008-01-16 06:24:27 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Returns information about the current site instance.
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2008-06-15 15:33:53 +02:00
|
|
|
* @subpackage control
|
2008-01-16 06:24:27 +01:00
|
|
|
*/
|
|
|
|
class SapphireInfo extends Controller {
|
2013-03-21 19:48:54 +01:00
|
|
|
private static $allowed_actions = array(
|
2008-10-02 22:43:22 +02:00
|
|
|
'baseurl',
|
|
|
|
'version',
|
|
|
|
'environmenttype',
|
|
|
|
);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function init() {
|
2008-10-02 22:43:22 +02:00
|
|
|
parent::init();
|
|
|
|
if(!Director::is_cli() && !Permission::check('ADMIN')) return Security::permissionFailure();
|
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function Version() {
|
2012-03-24 04:38:57 +01:00
|
|
|
$sapphireVersion = file_get_contents(FRAMEWORK_PATH . '/silverstripe_version');
|
|
|
|
if(!$sapphireVersion) $sapphireVersion = _t('LeftAndMain.VersionUnknown', 'unknown');
|
2008-03-03 00:21:58 +01:00
|
|
|
return $sapphireVersion;
|
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function EnvironmentType() {
|
2008-03-03 00:21:58 +01:00
|
|
|
if(Director::isLive()) return "live";
|
|
|
|
else if(Director::isTest()) return "test";
|
|
|
|
else return "dev";
|
2008-01-16 06:24:27 +01:00
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function BaseURL() {
|
2008-03-03 00:21:58 +01:00
|
|
|
return Director::absoluteBaseURL();
|
|
|
|
}
|
2012-03-24 04:38:57 +01:00
|
|
|
}
|