diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-06-29 14:16:27 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-06-29 14:18:09 +0200 |
commit | f8127046eea132733052f1edf1792012fcef776a (patch) | |
tree | 16d033a782dad77c34b7332bc3919ed933e7ac37 /lib | |
parent | 70eb20e3a7b65759cdea99279c53953379898d6f (diff) | |
download | nextcloud-server-f8127046eea132733052f1edf1792012fcef776a.tar.gz nextcloud-server-f8127046eea132733052f1edf1792012fcef776a.zip |
Unit tests added for MaintenancePlugin
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/connector/sabre/maintenanceplugin.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/private/connector/sabre/maintenanceplugin.php b/lib/private/connector/sabre/maintenanceplugin.php index 21d711e844c..c5a9ca6d54a 100644 --- a/lib/private/connector/sabre/maintenanceplugin.php +++ b/lib/private/connector/sabre/maintenanceplugin.php @@ -25,12 +25,16 @@ namespace OC\Connector\Sabre; +use OCP\IConfig; use Sabre\DAV\Exception\ServiceUnavailable; use Sabre\DAV\Server; use Sabre\DAV\ServerPlugin; class MaintenancePlugin extends ServerPlugin { + /** @var IConfig */ + private $config; + /** * Reference to main server object * @@ -39,6 +43,17 @@ class MaintenancePlugin extends ServerPlugin { private $server; /** + * @param IConfig $config + */ + public function __construct(IConfig $config) { + $this->config = $config; + if (is_null($config)) { + $this->config = \OC::$server->getConfig(); + } + } + + + /** * This initializes the plugin. * * This function is called by \Sabre\DAV\Server, after @@ -59,14 +74,13 @@ class MaintenancePlugin extends ServerPlugin { * in case the system is in maintenance mode. * * @throws ServiceUnavailable - * @internal param string $method * @return bool */ public function checkMaintenanceMode() { - if (\OC::$server->getSystemConfig()->getValue('singleuser', false)) { + if ($this->config->getSystemValue('singleuser', false)) { throw new ServiceUnavailable('System in single user mode.'); } - if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) { + if ($this->config->getSystemValue('maintenance', false)) { throw new ServiceUnavailable('System in maintenance mode.'); } if (\OC::checkUpgrade(false)) { |