diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php
index 325773a81ea765281b0ea30a35f766dee249d2b3..fff3332ef49e011d23c8b58794b381ad35754f79 100644
--- a/apps/files/appinfo/remote.php
+++ b/apps/files/appinfo/remote.php
@@ -50,7 +50,7 @@ $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()
 // FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
 $server->addPlugin(new \OC\Connector\Sabre\DummyGetResponsePlugin());
 $server->addPlugin(new \OC\Connector\Sabre\FilesPlugin($objectTree));
-$server->addPlugin(new \OC\Connector\Sabre\MaintenancePlugin());
+$server->addPlugin(new \OC\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig()));
 $server->addPlugin(new \OC\Connector\Sabre\ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
 
 // wait with registering these until auth is handled and the filesystem is setup
diff --git a/apps/files_sharing/publicwebdav.php b/apps/files_sharing/publicwebdav.php
index c75f9d1c7b5cbae4dd24f555018e8afc847683dd..be7530897f6105930400b722ebbc6193db06bc0a 100644
--- a/apps/files_sharing/publicwebdav.php
+++ b/apps/files_sharing/publicwebdav.php
@@ -46,7 +46,7 @@ $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()
 // FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
 $server->addPlugin(new \OC\Connector\Sabre\DummyGetResponsePlugin());
 $server->addPlugin(new \OC\Connector\Sabre\FilesPlugin($objectTree));
-$server->addPlugin(new \OC\Connector\Sabre\MaintenancePlugin());
+$server->addPlugin(new \OC\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig()));
 $server->addPlugin(new \OC\Connector\Sabre\ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
 
 // wait with registering these until auth is handled and the filesystem is setup
diff --git a/lib/private/connector/sabre/maintenanceplugin.php b/lib/private/connector/sabre/maintenanceplugin.php
index 21d711e844ca2915a2d2b3b3d92626c9e29ac836..634e5a681280dad72c49569c826fdb3c4847be1a 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
 	 *
@@ -38,6 +42,17 @@ class MaintenancePlugin extends ServerPlugin {
 	 */
 	private $server;
 
+	/**
+	 * @param IConfig $config
+	 */
+	public function __construct(IConfig $config = null) {
+		$this->config = $config;
+		if (is_null($config)) {
+			$this->config = \OC::$server->getConfig();
+		}
+	}
+
+
 	/**
 	 * This initializes the plugin.
 	 *
@@ -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)) {
diff --git a/tests/lib/connector/sabre/MaintenancePluginTest.php b/tests/lib/connector/sabre/MaintenancePluginTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..e5b50f71de697acf4202cd0c7b627147c4d3050a
--- /dev/null
+++ b/tests/lib/connector/sabre/MaintenancePluginTest.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace Test\Connector\Sabre;
+
+use OC\Connector\Sabre\MaintenancePlugin;
+use Test\TestCase;
+use OCP\IConfig;
+
+/**
+ * Class MaintenancePluginTest
+ *
+ * @package Test\Connector\Sabre
+ */
+class MaintenancePluginTest extends TestCase {
+	/** @var IConfig */
+	private $config;
+	/** @var MaintenancePlugin */
+	private $maintenancePlugin;
+
+	public function setUp() {
+		parent::setUp();
+
+		$this->config = $this->getMock('\OCP\IConfig');
+		$this->maintenancePlugin = new MaintenancePlugin($this->config);
+	}
+
+	/**
+	 * @expectedException \Sabre\DAV\Exception\ServiceUnavailable
+	 * @expectedExceptionMessage System in single user mode.
+	 */
+	public function testSingleUserMode() {
+		$this->config
+			->expects($this->once())
+			->method('getSystemValue')
+			->with('singleuser', false)
+			->will($this->returnValue(true));
+
+		$this->maintenancePlugin->checkMaintenanceMode();
+	}
+
+	/**
+	 * @expectedException \Sabre\DAV\Exception\ServiceUnavailable
+	 * @expectedExceptionMessage System in single user mode.
+	 */
+	public function testMaintenanceMode() {
+		$this->config
+			->expects($this->exactly(1))
+			->method('getSystemValue')
+			->will($this->onConsecutiveCalls([false, true]));
+
+		$this->maintenancePlugin->checkMaintenanceMode();
+	}
+
+}