@@ -35,59 +35,59 @@ |
||
| 35 | 35 | |
| 36 | 36 | class MaintenancePlugin extends ServerPlugin { |
| 37 | 37 | |
| 38 | - /** @var IConfig */ |
|
| 39 | - private $config; |
|
| 38 | + /** @var IConfig */ |
|
| 39 | + private $config; |
|
| 40 | 40 | |
| 41 | - /** @var \OCP\IL10N */ |
|
| 42 | - private $l10n; |
|
| 41 | + /** @var \OCP\IL10N */ |
|
| 42 | + private $l10n; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Reference to main server object |
|
| 46 | - * |
|
| 47 | - * @var Server |
|
| 48 | - */ |
|
| 49 | - private $server; |
|
| 44 | + /** |
|
| 45 | + * Reference to main server object |
|
| 46 | + * |
|
| 47 | + * @var Server |
|
| 48 | + */ |
|
| 49 | + private $server; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param IConfig $config |
|
| 53 | - */ |
|
| 54 | - public function __construct(IConfig $config, IL10N $l10n) { |
|
| 55 | - $this->config = $config; |
|
| 56 | - $this->l10n = \OC::$server->getL10N('dav'); |
|
| 57 | - } |
|
| 51 | + /** |
|
| 52 | + * @param IConfig $config |
|
| 53 | + */ |
|
| 54 | + public function __construct(IConfig $config, IL10N $l10n) { |
|
| 55 | + $this->config = $config; |
|
| 56 | + $this->l10n = \OC::$server->getL10N('dav'); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * This initializes the plugin. |
|
| 62 | - * |
|
| 63 | - * This function is called by \Sabre\DAV\Server, after |
|
| 64 | - * addPlugin is called. |
|
| 65 | - * |
|
| 66 | - * This method should set up the required event subscriptions. |
|
| 67 | - * |
|
| 68 | - * @param \Sabre\DAV\Server $server |
|
| 69 | - * @return void |
|
| 70 | - */ |
|
| 71 | - public function initialize(\Sabre\DAV\Server $server) { |
|
| 72 | - $this->server = $server; |
|
| 73 | - $this->server->on('beforeMethod:*', [$this, 'checkMaintenanceMode'], 1); |
|
| 74 | - } |
|
| 60 | + /** |
|
| 61 | + * This initializes the plugin. |
|
| 62 | + * |
|
| 63 | + * This function is called by \Sabre\DAV\Server, after |
|
| 64 | + * addPlugin is called. |
|
| 65 | + * |
|
| 66 | + * This method should set up the required event subscriptions. |
|
| 67 | + * |
|
| 68 | + * @param \Sabre\DAV\Server $server |
|
| 69 | + * @return void |
|
| 70 | + */ |
|
| 71 | + public function initialize(\Sabre\DAV\Server $server) { |
|
| 72 | + $this->server = $server; |
|
| 73 | + $this->server->on('beforeMethod:*', [$this, 'checkMaintenanceMode'], 1); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * This method is called before any HTTP method and returns http status code 503 |
|
| 78 | - * in case the system is in maintenance mode. |
|
| 79 | - * |
|
| 80 | - * @throws ServiceUnavailable |
|
| 81 | - * @return bool |
|
| 82 | - */ |
|
| 83 | - public function checkMaintenanceMode() { |
|
| 84 | - if ($this->config->getSystemValueBool('maintenance')) { |
|
| 85 | - throw new ServiceUnavailable($this->l10n->t('System is in maintenance mode.')); |
|
| 86 | - } |
|
| 87 | - if (Util::needUpgrade()) { |
|
| 88 | - throw new ServiceUnavailable($this->l10n->t('Upgrade needed')); |
|
| 89 | - } |
|
| 76 | + /** |
|
| 77 | + * This method is called before any HTTP method and returns http status code 503 |
|
| 78 | + * in case the system is in maintenance mode. |
|
| 79 | + * |
|
| 80 | + * @throws ServiceUnavailable |
|
| 81 | + * @return bool |
|
| 82 | + */ |
|
| 83 | + public function checkMaintenanceMode() { |
|
| 84 | + if ($this->config->getSystemValueBool('maintenance')) { |
|
| 85 | + throw new ServiceUnavailable($this->l10n->t('System is in maintenance mode.')); |
|
| 86 | + } |
|
| 87 | + if (Util::needUpgrade()) { |
|
| 88 | + throw new ServiceUnavailable($this->l10n->t('Upgrade needed')); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - return true; |
|
| 92 | - } |
|
| 91 | + return true; |
|
| 92 | + } |
|
| 93 | 93 | } |