mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
e5f1ca3bbe
1. Separated responsibility of handleAction so that it no longer bootstraps the controller and cleans up after the request is handled. 2. NEW beforeHandleRequest to take responsibility of bootstrapping the controller 3. NEW afterHandleRequest to take responsibility of cleanup for the controller 4. NEW calling init on controllers deprecated in favour of callInit() which takes responsibility of enforcing that "base init" is called and the before and after hooks 5. NEW Added prepareResponse to Controller for dealing with responses from controllers 6. NEW setResponse added to controller for setting response objects on the controller
35 lines
844 B
PHP
35 lines
844 B
PHP
<?php
|
|
/**
|
|
* Returns information about the current site instance.
|
|
* @package framework
|
|
* @subpackage control
|
|
*/
|
|
class SapphireInfo extends Controller {
|
|
private static $allowed_actions = array(
|
|
'baseurl',
|
|
'version',
|
|
'environmenttype',
|
|
);
|
|
|
|
protected function init() {
|
|
parent::init();
|
|
if(!Director::is_cli() && !Permission::check('ADMIN')) return Security::permissionFailure();
|
|
}
|
|
|
|
public function Version() {
|
|
$sapphireVersion = file_get_contents(FRAMEWORK_PATH . '/silverstripe_version');
|
|
if(!$sapphireVersion) $sapphireVersion = _t('LeftAndMain.VersionUnknown', 'unknown');
|
|
return $sapphireVersion;
|
|
}
|
|
|
|
public function EnvironmentType() {
|
|
if(Director::isLive()) return "live";
|
|
else if(Director::isTest()) return "test";
|
|
else return "dev";
|
|
}
|
|
|
|
public function BaseURL() {
|
|
return Director::absoluteBaseURL();
|
|
}
|
|
}
|