1 <?php
2 3 4 5
6
7
8 9 10
11 class LeftAndMainQuota extends LeftAndMainDecorator {
12
13 function init() {
14 Requirements::css('webylon/css/cms_layout.css');
15 }
16
17 function alternateAccessCheck() {
18 if (trim(WebylonSiteConfig::$cms_disabled) != '') {
19 return false;
20 }
21 return true;
22 }
23 24 25 26 27
28 static function sizeStatus() {
29 $realPath = realpath(dirname(BASE_PATH) . '/config/current_size');
30
31 $data = array(
32 'Used' => 0,
33 'Quota' => 0,
34 'State' => 'ok',
35 'Blocked' => false,
36 );
37
38 if (file_exists($realPath)) {
39 $sizeInfo = file_get_contents($realPath);
40 $parts = preg_split('/\t/', $sizeInfo);
41 $data['Used'] = (int) $parts[0];
42 $data['Quota'] = (int) $parts[4];
43 $data['State'] = strtolower(trim($parts[3]));
44 if ($data['Used'] > $data['Quota']) {
45 $data['State'] = 'over';
46 }
47 elseif ($data['Used'] > 0.9 * $data['Quota']) {
48 $data['State'] = 'warning';
49 }
50 else {
51 $data['State'] = 'ok';
52 }
53 if ($data['State'] == 'over') {
54 $data['Blocked'] = WebylonSiteConfig::$block_oversized;
55 }
56 }
57
58 return new ArrayData($data);
59 }
60
61 function WebylonVersion() {
62 $file = BASE_PATH . '/webylon/.version';
63 if (file_exists($file))
64 return file_get_contents($file);
65 return $this->owner->CMSVersion();
66 }
67 }
68
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-