Completed
Push — stable10 ( 453e52...4cd5d8 )
by Joas
33s
created
apps/dav/lib/Connector/Sabre/Exception/Forbidden.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -24,42 +24,42 @@
 block discarded – undo
24 24
 
25 25
 class Forbidden extends \Sabre\DAV\Exception\Forbidden {
26 26
 
27
-	const NS_OWNCLOUD = 'http://owncloud.org/ns';
27
+    const NS_OWNCLOUD = 'http://owncloud.org/ns';
28 28
 
29
-	/**
30
-	 * @var bool
31
-	 */
32
-	private $retry;
29
+    /**
30
+     * @var bool
31
+     */
32
+    private $retry;
33 33
 
34
-	/**
35
-	 * @param string $message
36
-	 * @param bool $retry
37
-	 * @param \Exception $previous
38
-	 */
39
-	public function __construct($message, $retry = false, \Exception $previous = null) {
40
-		parent::__construct($message, 0, $previous);
41
-		$this->retry = $retry;
42
-	}
34
+    /**
35
+     * @param string $message
36
+     * @param bool $retry
37
+     * @param \Exception $previous
38
+     */
39
+    public function __construct($message, $retry = false, \Exception $previous = null) {
40
+        parent::__construct($message, 0, $previous);
41
+        $this->retry = $retry;
42
+    }
43 43
 
44
-	/**
45
-	 * This method allows the exception to include additional information
46
-	 * into the WebDAV error response
47
-	 *
48
-	 * @param \Sabre\DAV\Server $server
49
-	 * @param \DOMElement $errorNode
50
-	 * @return void
51
-	 */
52
-	public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
44
+    /**
45
+     * This method allows the exception to include additional information
46
+     * into the WebDAV error response
47
+     *
48
+     * @param \Sabre\DAV\Server $server
49
+     * @param \DOMElement $errorNode
50
+     * @return void
51
+     */
52
+    public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
53 53
 
54
-		// set ownCloud namespace
55
-		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
54
+        // set ownCloud namespace
55
+        $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
56 56
 
57
-		// adding the retry node
58
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
59
-		$errorNode->appendChild($error);
57
+        // adding the retry node
58
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
59
+        $errorNode->appendChild($error);
60 60
 
61
-		// adding the message node
62
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
63
-		$errorNode->appendChild($error);
64
-	}
61
+        // adding the message node
62
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
63
+        $errorNode->appendChild($error);
64
+    }
65 65
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,17 +49,17 @@
 block discarded – undo
49 49
 	 * @param \DOMElement $errorNode
50 50
 	 * @return void
51 51
 	 */
52
-	public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
52
+	public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) {
53 53
 
54 54
 		// set ownCloud namespace
55 55
 		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
56 56
 
57 57
 		// adding the retry node
58
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
58
+		$error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true));
59 59
 		$errorNode->appendChild($error);
60 60
 
61 61
 		// adding the message node
62
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
62
+		$error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage());
63 63
 		$errorNode->appendChild($error);
64 64
 	}
65 65
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -26,53 +26,53 @@
 block discarded – undo
26 26
 
27 27
 class InvalidPath extends Exception {
28 28
 
29
-	const NS_OWNCLOUD = 'http://owncloud.org/ns';
29
+    const NS_OWNCLOUD = 'http://owncloud.org/ns';
30 30
 
31
-	/**
32
-	 * @var bool
33
-	 */
34
-	private $retry;
31
+    /**
32
+     * @var bool
33
+     */
34
+    private $retry;
35 35
 
36
-	/**
37
-	 * @param string $message
38
-	 * @param bool $retry
39
-	 */
40
-	public function __construct($message, $retry = false) {
41
-		parent::__construct($message);
42
-		$this->retry = $retry;
43
-	}
36
+    /**
37
+     * @param string $message
38
+     * @param bool $retry
39
+     */
40
+    public function __construct($message, $retry = false) {
41
+        parent::__construct($message);
42
+        $this->retry = $retry;
43
+    }
44 44
 
45
-	/**
46
-	 * Returns the HTTP status code for this exception
47
-	 *
48
-	 * @return int
49
-	 */
50
-	public function getHTTPCode() {
45
+    /**
46
+     * Returns the HTTP status code for this exception
47
+     *
48
+     * @return int
49
+     */
50
+    public function getHTTPCode() {
51 51
 
52
-		return 400;
52
+        return 400;
53 53
 
54
-	}
54
+    }
55 55
 
56
-	/**
57
-	 * This method allows the exception to include additional information
58
-	 * into the WebDAV error response
59
-	 *
60
-	 * @param \Sabre\DAV\Server $server
61
-	 * @param \DOMElement $errorNode
62
-	 * @return void
63
-	 */
64
-	public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
56
+    /**
57
+     * This method allows the exception to include additional information
58
+     * into the WebDAV error response
59
+     *
60
+     * @param \Sabre\DAV\Server $server
61
+     * @param \DOMElement $errorNode
62
+     * @return void
63
+     */
64
+    public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
65 65
 
66
-		// set ownCloud namespace
67
-		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
66
+        // set ownCloud namespace
67
+        $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
68 68
 
69
-		// adding the retry node
70
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
71
-		$errorNode->appendChild($error);
69
+        // adding the retry node
70
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
71
+        $errorNode->appendChild($error);
72 72
 
73
-		// adding the message node
74
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
75
-		$errorNode->appendChild($error);
76
-	}
73
+        // adding the message node
74
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
75
+        $errorNode->appendChild($error);
76
+    }
77 77
 
78 78
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,17 +61,17 @@
 block discarded – undo
61 61
 	 * @param \DOMElement $errorNode
62 62
 	 * @return void
63 63
 	 */
64
-	public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
64
+	public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) {
65 65
 
66 66
 		// set ownCloud namespace
67 67
 		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
68 68
 
69 69
 		// adding the retry node
70
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
70
+		$error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true));
71 71
 		$errorNode->appendChild($error);
72 72
 
73 73
 		// adding the message node
74
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
74
+		$error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage());
75 75
 		$errorNode->appendChild($error);
76 76
 	}
77 77
 
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,27 +29,27 @@
 block discarded – undo
29 29
 
30 30
 class PasswordLoginForbidden extends NotAuthenticated {
31 31
 
32
-	const NS_OWNCLOUD = 'http://owncloud.org/ns';
33
-
34
-	public function getHTTPCode() {
35
-		return 401;
36
-	}
37
-
38
-	/**
39
-	 * This method allows the exception to include additional information
40
-	 * into the WebDAV error response
41
-	 *
42
-	 * @param Server $server
43
-	 * @param DOMElement $errorNode
44
-	 * @return void
45
-	 */
46
-	public function serialize(Server $server, DOMElement $errorNode) {
47
-
48
-		// set ownCloud namespace
49
-		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
50
-
51
-		$error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'password login forbidden');
52
-		$errorNode->appendChild($error);
53
-	}
32
+    const NS_OWNCLOUD = 'http://owncloud.org/ns';
33
+
34
+    public function getHTTPCode() {
35
+        return 401;
36
+    }
37
+
38
+    /**
39
+     * This method allows the exception to include additional information
40
+     * into the WebDAV error response
41
+     *
42
+     * @param Server $server
43
+     * @param DOMElement $errorNode
44
+     * @return void
45
+     */
46
+    public function serialize(Server $server, DOMElement $errorNode) {
47
+
48
+        // set ownCloud namespace
49
+        $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
50
+
51
+        $error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'password login forbidden');
52
+        $errorNode->appendChild($error);
53
+    }
54 54
 
55 55
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/FileLocked.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,20 +30,20 @@
 block discarded – undo
30 30
 
31 31
 class FileLocked extends \Sabre\DAV\Exception {
32 32
 
33
-	public function __construct($message = "", $code = 0, Exception $previous = null) {
34
-		if($previous instanceof \OCP\Files\LockNotAcquiredException) {
35
-			$message = sprintf('Target file %s is locked by another process.', $previous->path);
36
-		}
37
-		parent::__construct($message, $code, $previous);
38
-	}
33
+    public function __construct($message = "", $code = 0, Exception $previous = null) {
34
+        if($previous instanceof \OCP\Files\LockNotAcquiredException) {
35
+            $message = sprintf('Target file %s is locked by another process.', $previous->path);
36
+        }
37
+        parent::__construct($message, $code, $previous);
38
+    }
39 39
 
40
-	/**
41
-	 * Returns the HTTP status code for this exception
42
-	 *
43
-	 * @return int
44
-	 */
45
-	public function getHTTPCode() {
40
+    /**
41
+     * Returns the HTTP status code for this exception
42
+     *
43
+     * @return int
44
+     */
45
+    public function getHTTPCode() {
46 46
 
47
-		return 423;
48
-	}
47
+        return 423;
48
+    }
49 49
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 class FileLocked extends \Sabre\DAV\Exception {
32 32
 
33 33
 	public function __construct($message = "", $code = 0, Exception $previous = null) {
34
-		if($previous instanceof \OCP\Files\LockNotAcquiredException) {
34
+		if ($previous instanceof \OCP\Files\LockNotAcquiredException) {
35 35
 			$message = sprintf('Target file %s is locked by another process.', $previous->path);
36 36
 		}
37 37
 		parent::__construct($message, $code, $previous);
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
  */
32 32
 class UnsupportedMediaType extends \Sabre\DAV\Exception {
33 33
 
34
-	/**
35
-	 * Returns the HTTP status code for this exception
36
-	 *
37
-	 * @return int
38
-	 */
39
-	public function getHTTPCode() {
34
+    /**
35
+     * Returns the HTTP status code for this exception
36
+     *
37
+     * @return int
38
+     */
39
+    public function getHTTPCode() {
40 40
 
41
-		return 415;
41
+        return 415;
42 42
 
43
-	}
43
+    }
44 44
 
45 45
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
  */
32 32
 class EntityTooLarge extends \Sabre\DAV\Exception {
33 33
 
34
-	/**
35
-	 * Returns the HTTP status code for this exception
36
-	 *
37
-	 * @return int
38
-	 */
39
-	public function getHTTPCode() {
34
+    /**
35
+     * Returns the HTTP status code for this exception
36
+     *
37
+     * @return int
38
+     */
39
+    public function getHTTPCode() {
40 40
 
41
-		return 413;
41
+        return 413;
42 42
 
43
-	}
43
+    }
44 44
 
45 45
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/ServerFactory.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		$server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
118 118
 		// Some WebDAV clients do require Class 2 WebDAV support (locking), since
119 119
 		// we do not provide locking we emulate it using a fake locking plugin.
120
-		if($this->request->isUserAgent([
120
+		if ($this->request->isUserAgent([
121 121
 				'/WebDAVFS/',
122 122
 				'/Microsoft Office OneNote 2013/',
123 123
 				'/Microsoft-WebDAV-MiniRedir/',
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		}
131 131
 
132 132
 		// wait with registering these until auth is handled and the filesystem is setup
133
-		$server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) {
133
+		$server->on('beforeMethod', function() use ($server, $objectTree, $viewCallBack) {
134 134
 			// ensure the skeleton is copied
135 135
 			$userFolder = \OC::$server->getUserFolder();
136 136
 			
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 			);
163 163
 			$server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view));
164 164
 
165
-			if($this->userSession->isLoggedIn()) {
165
+			if ($this->userSession->isLoggedIn()) {
166 166
 				$server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager));
167 167
 				$server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
168 168
 					$objectTree,
Please login to merge, or discard this patch.
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -41,154 +41,154 @@
 block discarded – undo
41 41
 use Sabre\DAV\Auth\Backend\BackendInterface;
42 42
 
43 43
 class ServerFactory {
44
-	/** @var IConfig */
45
-	private $config;
46
-	/** @var ILogger */
47
-	private $logger;
48
-	/** @var IDBConnection */
49
-	private $databaseConnection;
50
-	/** @var IUserSession */
51
-	private $userSession;
52
-	/** @var IMountManager */
53
-	private $mountManager;
54
-	/** @var ITagManager */
55
-	private $tagManager;
56
-	/** @var IRequest */
57
-	private $request;
58
-	/** @var IPreview  */
59
-	private $previewManager;
44
+    /** @var IConfig */
45
+    private $config;
46
+    /** @var ILogger */
47
+    private $logger;
48
+    /** @var IDBConnection */
49
+    private $databaseConnection;
50
+    /** @var IUserSession */
51
+    private $userSession;
52
+    /** @var IMountManager */
53
+    private $mountManager;
54
+    /** @var ITagManager */
55
+    private $tagManager;
56
+    /** @var IRequest */
57
+    private $request;
58
+    /** @var IPreview  */
59
+    private $previewManager;
60 60
 
61
-	/**
62
-	 * @param IConfig $config
63
-	 * @param ILogger $logger
64
-	 * @param IDBConnection $databaseConnection
65
-	 * @param IUserSession $userSession
66
-	 * @param IMountManager $mountManager
67
-	 * @param ITagManager $tagManager
68
-	 * @param IRequest $request
69
-	 * @param IPreview $previewManager
70
-	 */
71
-	public function __construct(
72
-		IConfig $config,
73
-		ILogger $logger,
74
-		IDBConnection $databaseConnection,
75
-		IUserSession $userSession,
76
-		IMountManager $mountManager,
77
-		ITagManager $tagManager,
78
-		IRequest $request,
79
-		IPreview $previewManager
80
-	) {
81
-		$this->config = $config;
82
-		$this->logger = $logger;
83
-		$this->databaseConnection = $databaseConnection;
84
-		$this->userSession = $userSession;
85
-		$this->mountManager = $mountManager;
86
-		$this->tagManager = $tagManager;
87
-		$this->request = $request;
88
-		$this->previewManager = $previewManager;
89
-	}
61
+    /**
62
+     * @param IConfig $config
63
+     * @param ILogger $logger
64
+     * @param IDBConnection $databaseConnection
65
+     * @param IUserSession $userSession
66
+     * @param IMountManager $mountManager
67
+     * @param ITagManager $tagManager
68
+     * @param IRequest $request
69
+     * @param IPreview $previewManager
70
+     */
71
+    public function __construct(
72
+        IConfig $config,
73
+        ILogger $logger,
74
+        IDBConnection $databaseConnection,
75
+        IUserSession $userSession,
76
+        IMountManager $mountManager,
77
+        ITagManager $tagManager,
78
+        IRequest $request,
79
+        IPreview $previewManager
80
+    ) {
81
+        $this->config = $config;
82
+        $this->logger = $logger;
83
+        $this->databaseConnection = $databaseConnection;
84
+        $this->userSession = $userSession;
85
+        $this->mountManager = $mountManager;
86
+        $this->tagManager = $tagManager;
87
+        $this->request = $request;
88
+        $this->previewManager = $previewManager;
89
+    }
90 90
 
91
-	/**
92
-	 * @param string $baseUri
93
-	 * @param string $requestUri
94
-	 * @param BackendInterface $authBackend
95
-	 * @param callable $viewCallBack callback that should return the view for the dav endpoint
96
-	 * @return Server
97
-	 */
98
-	public function createServer($baseUri,
99
-								 $requestUri,
100
-								 BackendInterface $authBackend,
101
-								 callable $viewCallBack) {
102
-		// Fire up server
103
-		$objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree();
104
-		$server = new \OCA\DAV\Connector\Sabre\Server($objectTree);
105
-		// Set URL explicitly due to reverse-proxy situations
106
-		$server->httpRequest->setUrl($requestUri);
107
-		$server->setBaseUri($baseUri);
91
+    /**
92
+     * @param string $baseUri
93
+     * @param string $requestUri
94
+     * @param BackendInterface $authBackend
95
+     * @param callable $viewCallBack callback that should return the view for the dav endpoint
96
+     * @return Server
97
+     */
98
+    public function createServer($baseUri,
99
+                                    $requestUri,
100
+                                    BackendInterface $authBackend,
101
+                                    callable $viewCallBack) {
102
+        // Fire up server
103
+        $objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree();
104
+        $server = new \OCA\DAV\Connector\Sabre\Server($objectTree);
105
+        // Set URL explicitly due to reverse-proxy situations
106
+        $server->httpRequest->setUrl($requestUri);
107
+        $server->setBaseUri($baseUri);
108 108
 
109
-		// Load plugins
110
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config));
111
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin($this->config));
112
-		$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
113
-		// FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
114
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin());
115
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger));
116
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
117
-		// Some WebDAV clients do require Class 2 WebDAV support (locking), since
118
-		// we do not provide locking we emulate it using a fake locking plugin.
119
-		if($this->request->isUserAgent([
120
-				'/WebDAVFS/',
121
-				'/Microsoft Office OneNote 2013/',
122
-				'/Microsoft-WebDAV-MiniRedir/',
123
-		])) {
124
-			$server->addPlugin(new \OCA\DAV\Connector\Sabre\FakeLockerPlugin());
125
-		}
109
+        // Load plugins
110
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config));
111
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin($this->config));
112
+        $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
113
+        // FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
114
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin());
115
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger));
116
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
117
+        // Some WebDAV clients do require Class 2 WebDAV support (locking), since
118
+        // we do not provide locking we emulate it using a fake locking plugin.
119
+        if($this->request->isUserAgent([
120
+                '/WebDAVFS/',
121
+                '/Microsoft Office OneNote 2013/',
122
+                '/Microsoft-WebDAV-MiniRedir/',
123
+        ])) {
124
+            $server->addPlugin(new \OCA\DAV\Connector\Sabre\FakeLockerPlugin());
125
+        }
126 126
 
127
-		if (BrowserErrorPagePlugin::isBrowserRequest($this->request)) {
128
-			$server->addPlugin(new BrowserErrorPagePlugin());
129
-		}
127
+        if (BrowserErrorPagePlugin::isBrowserRequest($this->request)) {
128
+            $server->addPlugin(new BrowserErrorPagePlugin());
129
+        }
130 130
 
131
-		// wait with registering these until auth is handled and the filesystem is setup
132
-		$server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) {
133
-			// ensure the skeleton is copied
134
-			$userFolder = \OC::$server->getUserFolder();
131
+        // wait with registering these until auth is handled and the filesystem is setup
132
+        $server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) {
133
+            // ensure the skeleton is copied
134
+            $userFolder = \OC::$server->getUserFolder();
135 135
 			
136
-			/** @var \OC\Files\View $view */
137
-			$view = $viewCallBack($server);
138
-			$rootInfo = $view->getFileInfo('');
136
+            /** @var \OC\Files\View $view */
137
+            $view = $viewCallBack($server);
138
+            $rootInfo = $view->getFileInfo('');
139 139
 
140
-			// Create ownCloud Dir
141
-			if ($rootInfo->getType() === 'dir') {
142
-				$root = new \OCA\DAV\Connector\Sabre\Directory($view, $rootInfo, $objectTree);
143
-			} else {
144
-				$root = new \OCA\DAV\Connector\Sabre\File($view, $rootInfo);
145
-			}
146
-			$objectTree->init($root, $view, $this->mountManager);
140
+            // Create ownCloud Dir
141
+            if ($rootInfo->getType() === 'dir') {
142
+                $root = new \OCA\DAV\Connector\Sabre\Directory($view, $rootInfo, $objectTree);
143
+            } else {
144
+                $root = new \OCA\DAV\Connector\Sabre\File($view, $rootInfo);
145
+            }
146
+            $objectTree->init($root, $view, $this->mountManager);
147 147
 
148
-			$server->addPlugin(
149
-				new \OCA\DAV\Connector\Sabre\FilesPlugin(
150
-					$objectTree,
151
-					$view,
152
-					$this->config,
153
-					$this->request,
154
-					$this->previewManager,
155
-					false,
156
-					!$this->config->getSystemValue('debug', false)
157
-				)
158
-			);
159
-			$server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view));
148
+            $server->addPlugin(
149
+                new \OCA\DAV\Connector\Sabre\FilesPlugin(
150
+                    $objectTree,
151
+                    $view,
152
+                    $this->config,
153
+                    $this->request,
154
+                    $this->previewManager,
155
+                    false,
156
+                    !$this->config->getSystemValue('debug', false)
157
+                )
158
+            );
159
+            $server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view));
160 160
 
161
-			if($this->userSession->isLoggedIn()) {
162
-				$server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager));
163
-				$server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
164
-					$objectTree,
165
-					$this->userSession,
166
-					$userFolder,
167
-					\OC::$server->getShareManager()
168
-				));
169
-				$server->addPlugin(new \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin(\OC::$server->getCommentsManager(), $this->userSession));
170
-				$server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesReportPlugin(
171
-					$objectTree,
172
-					$view,
173
-					\OC::$server->getSystemTagManager(),
174
-					\OC::$server->getSystemTagObjectMapper(),
175
-					$this->userSession,
176
-					\OC::$server->getGroupManager(),
177
-					$userFolder
178
-				));
179
-				// custom properties plugin must be the last one
180
-				$server->addPlugin(
181
-					new \Sabre\DAV\PropertyStorage\Plugin(
182
-						new \OCA\DAV\Connector\Sabre\CustomPropertiesBackend(
183
-							$objectTree,
184
-							$this->databaseConnection,
185
-							$this->userSession->getUser()
186
-						)
187
-					)
188
-				);
189
-			}
190
-			$server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin());
191
-		}, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request
192
-		return $server;
193
-	}
161
+            if($this->userSession->isLoggedIn()) {
162
+                $server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager));
163
+                $server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
164
+                    $objectTree,
165
+                    $this->userSession,
166
+                    $userFolder,
167
+                    \OC::$server->getShareManager()
168
+                ));
169
+                $server->addPlugin(new \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin(\OC::$server->getCommentsManager(), $this->userSession));
170
+                $server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesReportPlugin(
171
+                    $objectTree,
172
+                    $view,
173
+                    \OC::$server->getSystemTagManager(),
174
+                    \OC::$server->getSystemTagObjectMapper(),
175
+                    $this->userSession,
176
+                    \OC::$server->getGroupManager(),
177
+                    $userFolder
178
+                ));
179
+                // custom properties plugin must be the last one
180
+                $server->addPlugin(
181
+                    new \Sabre\DAV\PropertyStorage\Plugin(
182
+                        new \OCA\DAV\Connector\Sabre\CustomPropertiesBackend(
183
+                            $objectTree,
184
+                            $this->databaseConnection,
185
+                            $this->userSession->getUser()
186
+                        )
187
+                    )
188
+                );
189
+            }
190
+            $server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin());
191
+        }, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request
192
+        return $server;
193
+    }
194 194
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,6 +114,6 @@
 block discarded – undo
114 114
 			'Line' => $ex->getLine(),
115 115
 			'User' => $user,
116 116
 		];
117
-		$this->logger->log($level, 'Exception: ' . json_encode($exception), ['app' => $this->appName]);
117
+		$this->logger->log($level, 'Exception: '.json_encode($exception), ['app' => $this->appName]);
118 118
 	}
119 119
 }
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -32,85 +32,85 @@
 block discarded – undo
32 32
 use Sabre\HTTP\Response;
33 33
 
34 34
 class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
35
-	protected $nonFatalExceptions = array(
36
-		'Sabre\DAV\Exception\NotAuthenticated' => true,
37
-		// If tokenauth can throw this exception (which is basically as
38
-		// NotAuthenticated. So not fatal.
39
-		'OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden' => true,
40
-		// the sync client uses this to find out whether files exist,
41
-		// so it is not always an error, log it as debug
42
-		'Sabre\DAV\Exception\NotFound' => true,
43
-		// this one mostly happens when the same file is uploaded at
44
-		// exactly the same time from two clients, only one client
45
-		// wins, the second one gets "Precondition failed"
46
-		'Sabre\DAV\Exception\PreconditionFailed' => true,
47
-		// forbidden can be expected when trying to upload to
48
-		// read-only folders for example
49
-		'Sabre\DAV\Exception\Forbidden' => true,
50
-	);
35
+    protected $nonFatalExceptions = array(
36
+        'Sabre\DAV\Exception\NotAuthenticated' => true,
37
+        // If tokenauth can throw this exception (which is basically as
38
+        // NotAuthenticated. So not fatal.
39
+        'OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden' => true,
40
+        // the sync client uses this to find out whether files exist,
41
+        // so it is not always an error, log it as debug
42
+        'Sabre\DAV\Exception\NotFound' => true,
43
+        // this one mostly happens when the same file is uploaded at
44
+        // exactly the same time from two clients, only one client
45
+        // wins, the second one gets "Precondition failed"
46
+        'Sabre\DAV\Exception\PreconditionFailed' => true,
47
+        // forbidden can be expected when trying to upload to
48
+        // read-only folders for example
49
+        'Sabre\DAV\Exception\Forbidden' => true,
50
+    );
51 51
 
52
-	/** @var string */
53
-	private $appName;
52
+    /** @var string */
53
+    private $appName;
54 54
 
55
-	/** @var ILogger */
56
-	private $logger;
55
+    /** @var ILogger */
56
+    private $logger;
57 57
 
58
-	/**
59
-	 * @param string $loggerAppName app name to use when logging
60
-	 * @param ILogger $logger
61
-	 */
62
-	public function __construct($loggerAppName, $logger) {
63
-		$this->appName = $loggerAppName;
64
-		$this->logger = $logger;
65
-	}
58
+    /**
59
+     * @param string $loggerAppName app name to use when logging
60
+     * @param ILogger $logger
61
+     */
62
+    public function __construct($loggerAppName, $logger) {
63
+        $this->appName = $loggerAppName;
64
+        $this->logger = $logger;
65
+    }
66 66
 
67
-	/**
68
-	 * This initializes the plugin.
69
-	 *
70
-	 * This function is called by \Sabre\DAV\Server, after
71
-	 * addPlugin is called.
72
-	 *
73
-	 * This method should set up the required event subscriptions.
74
-	 *
75
-	 * @param \Sabre\DAV\Server $server
76
-	 * @return void
77
-	 */
78
-	public function initialize(\Sabre\DAV\Server $server) {
67
+    /**
68
+     * This initializes the plugin.
69
+     *
70
+     * This function is called by \Sabre\DAV\Server, after
71
+     * addPlugin is called.
72
+     *
73
+     * This method should set up the required event subscriptions.
74
+     *
75
+     * @param \Sabre\DAV\Server $server
76
+     * @return void
77
+     */
78
+    public function initialize(\Sabre\DAV\Server $server) {
79 79
 
80
-		$server->on('exception', array($this, 'logException'), 10);
81
-	}
80
+        $server->on('exception', array($this, 'logException'), 10);
81
+    }
82 82
 
83
-	/**
84
-	 * Log exception
85
-	 *
86
-	 */
87
-	public function logException(\Exception $ex) {
88
-		$exceptionClass = get_class($ex);
89
-		$level = \OCP\Util::FATAL;
90
-		if (isset($this->nonFatalExceptions[$exceptionClass])) {
91
-			$level = \OCP\Util::DEBUG;
92
-		}
83
+    /**
84
+     * Log exception
85
+     *
86
+     */
87
+    public function logException(\Exception $ex) {
88
+        $exceptionClass = get_class($ex);
89
+        $level = \OCP\Util::FATAL;
90
+        if (isset($this->nonFatalExceptions[$exceptionClass])) {
91
+            $level = \OCP\Util::DEBUG;
92
+        }
93 93
 
94
-		$message = $ex->getMessage();
95
-		if ($ex instanceof Exception) {
96
-			if (empty($message)) {
97
-				$response = new Response($ex->getHTTPCode());
98
-				$message = $response->getStatusText();
99
-			}
100
-			$message = "HTTP/1.1 {$ex->getHTTPCode()} $message";
101
-		}
94
+        $message = $ex->getMessage();
95
+        if ($ex instanceof Exception) {
96
+            if (empty($message)) {
97
+                $response = new Response($ex->getHTTPCode());
98
+                $message = $response->getStatusText();
99
+            }
100
+            $message = "HTTP/1.1 {$ex->getHTTPCode()} $message";
101
+        }
102 102
 
103
-		$user = \OC_User::getUser();
103
+        $user = \OC_User::getUser();
104 104
 
105
-		$exception = [
106
-			'Message' => $message,
107
-			'Exception' => $exceptionClass,
108
-			'Code' => $ex->getCode(),
109
-			'Trace' => $ex->getTraceAsString(),
110
-			'File' => $ex->getFile(),
111
-			'Line' => $ex->getLine(),
112
-			'User' => $user,
113
-		];
114
-		$this->logger->log($level, 'Exception: ' . json_encode($exception), ['app' => $this->appName]);
115
-	}
105
+        $exception = [
106
+            'Message' => $message,
107
+            'Exception' => $exceptionClass,
108
+            'Code' => $ex->getCode(),
109
+            'Trace' => $ex->getTraceAsString(),
110
+            'File' => $ex->getFile(),
111
+            'Line' => $ex->getLine(),
112
+            'User' => $user,
113
+        ];
114
+        $this->logger->log($level, 'Exception: ' . json_encode($exception), ['app' => $this->appName]);
115
+    }
116 116
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/SyncBirthdayCalendar.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -33,55 +33,55 @@
 block discarded – undo
33 33
 
34 34
 class SyncBirthdayCalendar extends Command {
35 35
 
36
-	/** @var BirthdayService */
37
-	private $birthdayService;
36
+    /** @var BirthdayService */
37
+    private $birthdayService;
38 38
 
39
-	/** @var IUserManager */
40
-	private $userManager;
39
+    /** @var IUserManager */
40
+    private $userManager;
41 41
 
42
-	/**
43
-	 * @param IUserManager $userManager
44
-	 * @param BirthdayService $birthdayService
45
-	 */
46
-	function __construct(IUserManager $userManager, BirthdayService $birthdayService) {
47
-		parent::__construct();
48
-		$this->birthdayService = $birthdayService;
49
-		$this->userManager = $userManager;
50
-	}
42
+    /**
43
+     * @param IUserManager $userManager
44
+     * @param BirthdayService $birthdayService
45
+     */
46
+    function __construct(IUserManager $userManager, BirthdayService $birthdayService) {
47
+        parent::__construct();
48
+        $this->birthdayService = $birthdayService;
49
+        $this->userManager = $userManager;
50
+    }
51 51
 
52
-	protected function configure() {
53
-		$this
54
-			->setName('dav:sync-birthday-calendar')
55
-			->setDescription('Synchronizes the birthday calendar')
56
-			->addArgument('user',
57
-				InputArgument::OPTIONAL,
58
-				'User for whom the birthday calendar will be synchronized');
59
-	}
52
+    protected function configure() {
53
+        $this
54
+            ->setName('dav:sync-birthday-calendar')
55
+            ->setDescription('Synchronizes the birthday calendar')
56
+            ->addArgument('user',
57
+                InputArgument::OPTIONAL,
58
+                'User for whom the birthday calendar will be synchronized');
59
+    }
60 60
 
61
-	/**
62
-	 * @param InputInterface $input
63
-	 * @param OutputInterface $output
64
-	 */
65
-	protected function execute(InputInterface $input, OutputInterface $output) {
66
-		$user = $input->getArgument('user');
67
-		if (!is_null($user)) {
68
-			if (!$this->userManager->userExists($user)) {
69
-				throw new \InvalidArgumentException("User <$user> in unknown.");
70
-			}
71
-			$output->writeln("Start birthday calendar sync for $user");
72
-			$this->birthdayService->syncUser($user);
73
-			return;
74
-		}
75
-		$output->writeln("Start birthday calendar sync for all users ...");
76
-		$p = new ProgressBar($output);
77
-		$p->start();
78
-		$this->userManager->callForAllUsers(function($user) use ($p)  {
79
-			$p->advance();
80
-			/** @var IUser $user */
81
-			$this->birthdayService->syncUser($user->getUID());
82
-		});
61
+    /**
62
+     * @param InputInterface $input
63
+     * @param OutputInterface $output
64
+     */
65
+    protected function execute(InputInterface $input, OutputInterface $output) {
66
+        $user = $input->getArgument('user');
67
+        if (!is_null($user)) {
68
+            if (!$this->userManager->userExists($user)) {
69
+                throw new \InvalidArgumentException("User <$user> in unknown.");
70
+            }
71
+            $output->writeln("Start birthday calendar sync for $user");
72
+            $this->birthdayService->syncUser($user);
73
+            return;
74
+        }
75
+        $output->writeln("Start birthday calendar sync for all users ...");
76
+        $p = new ProgressBar($output);
77
+        $p->start();
78
+        $this->userManager->callForAllUsers(function($user) use ($p)  {
79
+            $p->advance();
80
+            /** @var IUser $user */
81
+            $this->birthdayService->syncUser($user->getUID());
82
+        });
83 83
 
84
-		$p->finish();
85
-		$output->writeln('');
86
-	}
84
+        $p->finish();
85
+        $output->writeln('');
86
+    }
87 87
 }
Please login to merge, or discard this patch.