silverstripe-framework/Dev/SapphireInfo.php

43 lines
978 B
PHP
Raw Normal View History

<?php
2016-06-23 01:37:22 +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;
/**
* Returns information about the current site instance.
*/
class SapphireInfo extends Controller {
private static $allowed_actions = array(
'baseurl',
'version',
'environmenttype',
);
2014-08-15 08:53:05 +02:00
protected function init() {
parent::init();
if(!Director::is_cli() && !Permission::check('ADMIN')) {
Security::permissionFailure();
}
}
2014-08-15 08:53:05 +02:00
public function Version() {
$sapphireVersion = file_get_contents(FRAMEWORK_PATH . '/silverstripe_version');
if(!$sapphireVersion) $sapphireVersion = _t('LeftAndMain.VersionUnknown', 'unknown');
return $sapphireVersion;
}
2014-08-15 08:53:05 +02:00
public function EnvironmentType() {
if(Director::isLive()) return "live";
else if(Director::isTest()) return "test";
else return "dev";
}
2014-08-15 08:53:05 +02:00
public function BaseURL() {
return Director::absoluteBaseURL();
}
}