2008-01-16 06:24:27 +01:00
|
|
|
<?php
|
2016-06-23 01:37:22 +02:00
|
|
|
|
2016-08-19 00:51:35 +02:00
|
|
|
namespace SilverStripe\Dev;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
use SilverStripe\Control\Director;
|
2016-06-23 01:37:22 +02:00
|
|
|
use SilverStripe\Security\Permission;
|
|
|
|
use SilverStripe\Security\Security;
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2008-01-16 06:24:27 +01:00
|
|
|
/**
|
|
|
|
* Returns information about the current site instance.
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
2015-02-23 14:46:00 +01:00
|
|
|
protected function init() {
|
2008-10-02 22:43:22 +02:00
|
|
|
parent::init();
|
2016-08-19 00:51:35 +02:00
|
|
|
if(!Director::is_cli() && !Permission::check('ADMIN')) {
|
|
|
|
Security::permissionFailure();
|
|
|
|
}
|
2008-10-02 22:43:22 +02:00
|
|
|
}
|
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
|
|
|
}
|