[Pkg-owncloud-commits] [owncloud] 169/205: In case of maintenance we should add a message to the exception

David Prévot taffit at moszumanska.debian.org
Thu Jul 2 17:37:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit e236e564afd4ee69b0853cfb3f2915255c3e2d29
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Mon Jun 29 12:31:01 2015 +0200

    In case of maintenance we should add a message to the exception
---
 lib/private/connector/sabre/maintenanceplugin.php | 24 ++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/lib/private/connector/sabre/maintenanceplugin.php b/lib/private/connector/sabre/maintenanceplugin.php
index 9a59693..21d711e 100644
--- a/lib/private/connector/sabre/maintenanceplugin.php
+++ b/lib/private/connector/sabre/maintenanceplugin.php
@@ -25,13 +25,16 @@
 
 namespace OC\Connector\Sabre;
 
-class MaintenancePlugin extends \Sabre\DAV\ServerPlugin
-{
+use Sabre\DAV\Exception\ServiceUnavailable;
+use Sabre\DAV\Server;
+use Sabre\DAV\ServerPlugin;
+
+class MaintenancePlugin extends ServerPlugin {
 
 	/**
 	 * Reference to main server object
 	 *
-	 * @var \Sabre\DAV\Server
+	 * @var Server
 	 */
 	private $server;
 
@@ -43,11 +46,10 @@ class MaintenancePlugin extends \Sabre\DAV\ServerPlugin
 	 *
 	 * This method should set up the required event subscriptions.
 	 *
-	 * @param \Sabre\DAV\Server $server
+	 * @param Server $server
 	 * @return void
 	 */
-	public function initialize(\Sabre\DAV\Server $server) {
-
+	public function initialize(Server $server) {
 		$this->server = $server;
 		$this->server->on('beforeMethod', array($this, 'checkMaintenanceMode'), 10);
 	}
@@ -56,19 +58,19 @@ class MaintenancePlugin extends \Sabre\DAV\ServerPlugin
 	 * This method is called before any HTTP method and returns http status code 503
 	 * in case the system is in maintenance mode.
 	 *
-	 * @throws \Sabre\DAV\Exception\ServiceUnavailable
+	 * @throws ServiceUnavailable
 	 * @internal param string $method
 	 * @return bool
 	 */
 	public function checkMaintenanceMode() {
 		if (\OC::$server->getSystemConfig()->getValue('singleuser', false)) {
-			throw new \Sabre\DAV\Exception\ServiceUnavailable();
+			throw new ServiceUnavailable('System in single user mode.');
 		}
-		if (\OC_Config::getValue('maintenance', false)) {
-			throw new \Sabre\DAV\Exception\ServiceUnavailable();
+		if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) {
+			throw new ServiceUnavailable('System in maintenance mode.');
 		}
 		if (\OC::checkUpgrade(false)) {
-			throw new \Sabre\DAV\Exception\ServiceUnavailable('Upgrade needed');
+			throw new ServiceUnavailable('Upgrade needed');
 		}
 
 		return true;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list