| Total Complexity | 9 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class SapphireInfo extends Controller |
||
| 14 | { |
||
| 15 | private static $allowed_actions = array( |
||
|
|
|||
| 16 | 'baseurl', |
||
| 17 | 'version', |
||
| 18 | 'environmenttype', |
||
| 19 | ); |
||
| 20 | |||
| 21 | protected function init() |
||
| 22 | { |
||
| 23 | parent::init(); |
||
| 24 | if (!Director::is_cli() && !Permission::check('ADMIN')) { |
||
| 25 | Security::permissionFailure(); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | public function Version() |
||
| 30 | { |
||
| 31 | $sapphireVersion = file_get_contents(FRAMEWORK_PATH . '/silverstripe_version'); |
||
| 32 | if (!$sapphireVersion) { |
||
| 33 | $sapphireVersion = _t('SilverStripe\\Admin\\LeftAndMain.VersionUnknown', 'unknown'); |
||
| 34 | } |
||
| 35 | return $sapphireVersion; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function EnvironmentType() |
||
| 39 | { |
||
| 40 | if (Director::isLive()) { |
||
| 41 | return "live"; |
||
| 42 | } elseif (Director::isTest()) { |
||
| 43 | return "test"; |
||
| 44 | } else { |
||
| 45 | return "dev"; |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | public function BaseURL() |
||
| 52 | } |
||
| 53 | } |
||
| 54 |