Completed
Push — master ( f0fcf8...bd8352 )
by Morris
19:34
created
apps/dav/lib/Server.php 2 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -64,220 +64,220 @@
 block discarded – undo
64 64
 
65 65
 class Server {
66 66
 
67
-	/** @var IRequest */
68
-	private $request;
67
+    /** @var IRequest */
68
+    private $request;
69 69
 
70
-	/** @var  string */
71
-	private $baseUri;
70
+    /** @var  string */
71
+    private $baseUri;
72 72
 
73
-	/** @var Connector\Sabre\Server  */
74
-	private $server;
73
+    /** @var Connector\Sabre\Server  */
74
+    private $server;
75 75
 
76
-	public function __construct(IRequest $request, $baseUri) {
77
-		$this->request = $request;
78
-		$this->baseUri = $baseUri;
79
-		$logger = \OC::$server->getLogger();
80
-		$dispatcher = \OC::$server->getEventDispatcher();
81
-		$sendInvitations = \OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes';
76
+    public function __construct(IRequest $request, $baseUri) {
77
+        $this->request = $request;
78
+        $this->baseUri = $baseUri;
79
+        $logger = \OC::$server->getLogger();
80
+        $dispatcher = \OC::$server->getEventDispatcher();
81
+        $sendInvitations = \OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes';
82 82
 
83
-		$root = new RootCollection();
84
-		$this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
83
+        $root = new RootCollection();
84
+        $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
85 85
 
86
-		// Add maintenance plugin
87
-		$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig()));
86
+        // Add maintenance plugin
87
+        $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig()));
88 88
 
89
-		// Backends
90
-		$authBackend = new Auth(
91
-			\OC::$server->getSession(),
92
-			\OC::$server->getUserSession(),
93
-			\OC::$server->getRequest(),
94
-			\OC::$server->getTwoFactorAuthManager(),
95
-			\OC::$server->getBruteForceThrottler()
96
-		);
89
+        // Backends
90
+        $authBackend = new Auth(
91
+            \OC::$server->getSession(),
92
+            \OC::$server->getUserSession(),
93
+            \OC::$server->getRequest(),
94
+            \OC::$server->getTwoFactorAuthManager(),
95
+            \OC::$server->getBruteForceThrottler()
96
+        );
97 97
 
98
-		// Set URL explicitly due to reverse-proxy situations
99
-		$this->server->httpRequest->setUrl($this->request->getRequestUri());
100
-		$this->server->setBaseUri($this->baseUri);
98
+        // Set URL explicitly due to reverse-proxy situations
99
+        $this->server->httpRequest->setUrl($this->request->getRequestUri());
100
+        $this->server->setBaseUri($this->baseUri);
101 101
 
102
-		$this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
103
-		$authPlugin = new Plugin();
104
-		$authPlugin->addBackend(new PublicAuth());
105
-		$this->server->addPlugin($authPlugin);
102
+        $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
103
+        $authPlugin = new Plugin();
104
+        $authPlugin->addBackend(new PublicAuth());
105
+        $this->server->addPlugin($authPlugin);
106 106
 
107
-		// allow setup of additional auth backends
108
-		$event = new SabrePluginEvent($this->server);
109
-		$dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
107
+        // allow setup of additional auth backends
108
+        $event = new SabrePluginEvent($this->server);
109
+        $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
110 110
 
111
-		$bearerAuthBackend = new BearerAuth(
112
-			\OC::$server->getUserSession(),
113
-			\OC::$server->getSession(),
114
-			\OC::$server->getRequest()
115
-		);
116
-		$authPlugin->addBackend($bearerAuthBackend);
117
-		// because we are throwing exceptions this plugin has to be the last one
118
-		$authPlugin->addBackend($authBackend);
111
+        $bearerAuthBackend = new BearerAuth(
112
+            \OC::$server->getUserSession(),
113
+            \OC::$server->getSession(),
114
+            \OC::$server->getRequest()
115
+        );
116
+        $authPlugin->addBackend($bearerAuthBackend);
117
+        // because we are throwing exceptions this plugin has to be the last one
118
+        $authPlugin->addBackend($authBackend);
119 119
 
120
-		// debugging
121
-		if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
122
-			$this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
123
-		} else {
124
-			$this->server->addPlugin(new DummyGetResponsePlugin());
125
-		}
120
+        // debugging
121
+        if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
122
+            $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
123
+        } else {
124
+            $this->server->addPlugin(new DummyGetResponsePlugin());
125
+        }
126 126
 
127
-		$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
128
-		$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
129
-		$this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
127
+        $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
128
+        $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
129
+        $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
130 130
 
131
-		// acl
132
-		$acl = new DavAclPlugin();
133
-		$acl->principalCollectionSet = [
134
-			'principals/users', 'principals/groups'
135
-		];
136
-		$acl->defaultUsernamePath = 'principals/users';
137
-		$this->server->addPlugin($acl);
131
+        // acl
132
+        $acl = new DavAclPlugin();
133
+        $acl->principalCollectionSet = [
134
+            'principals/users', 'principals/groups'
135
+        ];
136
+        $acl->defaultUsernamePath = 'principals/users';
137
+        $this->server->addPlugin($acl);
138 138
 
139
-		// calendar plugins
140
-		$this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
141
-		$this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
142
-		$this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin());
143
-		if ($sendInvitations) {
144
-			$this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
145
-		}
146
-		$this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
147
-		$this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
148
-		$this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
149
-		$this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
150
-			\OC::$server->getConfig(),
151
-			\OC::$server->getURLGenerator()
152
-		));
139
+        // calendar plugins
140
+        $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
141
+        $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
142
+        $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin());
143
+        if ($sendInvitations) {
144
+            $this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
145
+        }
146
+        $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
147
+        $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
148
+        $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
149
+        $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
150
+            \OC::$server->getConfig(),
151
+            \OC::$server->getURLGenerator()
152
+        ));
153 153
 
154
-		// addressbook plugins
155
-		$this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
156
-		$this->server->addPlugin(new VCFExportPlugin());
157
-		$this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache'))));
154
+        // addressbook plugins
155
+        $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
156
+        $this->server->addPlugin(new VCFExportPlugin());
157
+        $this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache'))));
158 158
 
159
-		// system tags plugins
160
-		$this->server->addPlugin(new SystemTagPlugin(
161
-			\OC::$server->getSystemTagManager(),
162
-			\OC::$server->getGroupManager(),
163
-			\OC::$server->getUserSession()
164
-		));
159
+        // system tags plugins
160
+        $this->server->addPlugin(new SystemTagPlugin(
161
+            \OC::$server->getSystemTagManager(),
162
+            \OC::$server->getGroupManager(),
163
+            \OC::$server->getUserSession()
164
+        ));
165 165
 
166
-		// comments plugin
167
-		$this->server->addPlugin(new CommentsPlugin(
168
-			\OC::$server->getCommentsManager(),
169
-			\OC::$server->getUserSession()
170
-		));
166
+        // comments plugin
167
+        $this->server->addPlugin(new CommentsPlugin(
168
+            \OC::$server->getCommentsManager(),
169
+            \OC::$server->getUserSession()
170
+        ));
171 171
 
172
-		$this->server->addPlugin(new CopyEtagHeaderPlugin());
173
-		$this->server->addPlugin(new ChunkingPlugin());
172
+        $this->server->addPlugin(new CopyEtagHeaderPlugin());
173
+        $this->server->addPlugin(new ChunkingPlugin());
174 174
 
175
-		// allow setup of additional plugins
176
-		$dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event);
175
+        // allow setup of additional plugins
176
+        $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event);
177 177
 
178
-		// Some WebDAV clients do require Class 2 WebDAV support (locking), since
179
-		// we do not provide locking we emulate it using a fake locking plugin.
180
-		if($request->isUserAgent([
181
-			'/WebDAVFS/',
182
-			'/OneNote/',
183
-			'/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601
184
-		])) {
185
-			$this->server->addPlugin(new FakeLockerPlugin());
186
-		}
178
+        // Some WebDAV clients do require Class 2 WebDAV support (locking), since
179
+        // we do not provide locking we emulate it using a fake locking plugin.
180
+        if($request->isUserAgent([
181
+            '/WebDAVFS/',
182
+            '/OneNote/',
183
+            '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601
184
+        ])) {
185
+            $this->server->addPlugin(new FakeLockerPlugin());
186
+        }
187 187
 
188
-		if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
189
-			$this->server->addPlugin(new BrowserErrorPagePlugin());
190
-		}
188
+        if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
189
+            $this->server->addPlugin(new BrowserErrorPagePlugin());
190
+        }
191 191
 
192
-		// wait with registering these until auth is handled and the filesystem is setup
193
-		$this->server->on('beforeMethod', function () use ($root) {
194
-			// custom properties plugin must be the last one
195
-			$userSession = \OC::$server->getUserSession();
196
-			$user = $userSession->getUser();
197
-			if ($user !== null) {
198
-				$view = \OC\Files\Filesystem::getView();
199
-				$this->server->addPlugin(
200
-					new FilesPlugin(
201
-						$this->server->tree,
202
-						\OC::$server->getConfig(),
203
-						$this->request,
204
-						\OC::$server->getPreviewManager(),
205
-						false,
206
-						!\OC::$server->getConfig()->getSystemValue('debug', false)
207
-					)
208
-				);
192
+        // wait with registering these until auth is handled and the filesystem is setup
193
+        $this->server->on('beforeMethod', function () use ($root) {
194
+            // custom properties plugin must be the last one
195
+            $userSession = \OC::$server->getUserSession();
196
+            $user = $userSession->getUser();
197
+            if ($user !== null) {
198
+                $view = \OC\Files\Filesystem::getView();
199
+                $this->server->addPlugin(
200
+                    new FilesPlugin(
201
+                        $this->server->tree,
202
+                        \OC::$server->getConfig(),
203
+                        $this->request,
204
+                        \OC::$server->getPreviewManager(),
205
+                        false,
206
+                        !\OC::$server->getConfig()->getSystemValue('debug', false)
207
+                    )
208
+                );
209 209
 
210
-				$this->server->addPlugin(
211
-					new \Sabre\DAV\PropertyStorage\Plugin(
212
-						new CustomPropertiesBackend(
213
-							$this->server->tree,
214
-							\OC::$server->getDatabaseConnection(),
215
-							\OC::$server->getUserSession()->getUser()
216
-						)
217
-					)
218
-				);
219
-				if ($view !== null) {
220
-					$this->server->addPlugin(
221
-						new QuotaPlugin($view, false));
222
-				}
223
-				$this->server->addPlugin(
224
-					new TagsPlugin(
225
-						$this->server->tree, \OC::$server->getTagManager()
226
-					)
227
-				);
228
-				// TODO: switch to LazyUserFolder
229
-				$userFolder = \OC::$server->getUserFolder();
230
-				$this->server->addPlugin(new SharesPlugin(
231
-					$this->server->tree,
232
-					$userSession,
233
-					$userFolder,
234
-					\OC::$server->getShareManager()
235
-				));
236
-				$this->server->addPlugin(new CommentPropertiesPlugin(
237
-					\OC::$server->getCommentsManager(),
238
-					$userSession
239
-				));
240
-				$this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin());
241
-				if ($view !== null) {
242
-					$this->server->addPlugin(new FilesReportPlugin(
243
-						$this->server->tree,
244
-						$view,
245
-						\OC::$server->getSystemTagManager(),
246
-						\OC::$server->getSystemTagObjectMapper(),
247
-						\OC::$server->getTagManager(),
248
-						$userSession,
249
-						\OC::$server->getGroupManager(),
250
-						$userFolder
251
-					));
252
-					$this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend(
253
-						$this->server->tree,
254
-						$user,
255
-						\OC::$server->getRootFolder(),
256
-						\OC::$server->getShareManager(),
257
-						$view
258
-					)));
259
-				}
260
-				$this->server->addPlugin(new \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin(
261
-					\OC::$server->getConfig(),
262
-					\OC::$server->query(BirthdayService::class)
263
-				));
264
-			}
210
+                $this->server->addPlugin(
211
+                    new \Sabre\DAV\PropertyStorage\Plugin(
212
+                        new CustomPropertiesBackend(
213
+                            $this->server->tree,
214
+                            \OC::$server->getDatabaseConnection(),
215
+                            \OC::$server->getUserSession()->getUser()
216
+                        )
217
+                    )
218
+                );
219
+                if ($view !== null) {
220
+                    $this->server->addPlugin(
221
+                        new QuotaPlugin($view, false));
222
+                }
223
+                $this->server->addPlugin(
224
+                    new TagsPlugin(
225
+                        $this->server->tree, \OC::$server->getTagManager()
226
+                    )
227
+                );
228
+                // TODO: switch to LazyUserFolder
229
+                $userFolder = \OC::$server->getUserFolder();
230
+                $this->server->addPlugin(new SharesPlugin(
231
+                    $this->server->tree,
232
+                    $userSession,
233
+                    $userFolder,
234
+                    \OC::$server->getShareManager()
235
+                ));
236
+                $this->server->addPlugin(new CommentPropertiesPlugin(
237
+                    \OC::$server->getCommentsManager(),
238
+                    $userSession
239
+                ));
240
+                $this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin());
241
+                if ($view !== null) {
242
+                    $this->server->addPlugin(new FilesReportPlugin(
243
+                        $this->server->tree,
244
+                        $view,
245
+                        \OC::$server->getSystemTagManager(),
246
+                        \OC::$server->getSystemTagObjectMapper(),
247
+                        \OC::$server->getTagManager(),
248
+                        $userSession,
249
+                        \OC::$server->getGroupManager(),
250
+                        $userFolder
251
+                    ));
252
+                    $this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend(
253
+                        $this->server->tree,
254
+                        $user,
255
+                        \OC::$server->getRootFolder(),
256
+                        \OC::$server->getShareManager(),
257
+                        $view
258
+                    )));
259
+                }
260
+                $this->server->addPlugin(new \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin(
261
+                    \OC::$server->getConfig(),
262
+                    \OC::$server->query(BirthdayService::class)
263
+                ));
264
+            }
265 265
 
266
-			// register plugins from apps
267
-			$pluginManager = new PluginManager(
268
-				\OC::$server,
269
-				\OC::$server->getAppManager()
270
-			);
271
-			foreach ($pluginManager->getAppPlugins() as $appPlugin) {
272
-				$this->server->addPlugin($appPlugin);
273
-			}
274
-			foreach ($pluginManager->getAppCollections() as $appCollection) {
275
-				$root->addChild($appCollection);
276
-			}
277
-		});
278
-	}
266
+            // register plugins from apps
267
+            $pluginManager = new PluginManager(
268
+                \OC::$server,
269
+                \OC::$server->getAppManager()
270
+            );
271
+            foreach ($pluginManager->getAppPlugins() as $appPlugin) {
272
+                $this->server->addPlugin($appPlugin);
273
+            }
274
+            foreach ($pluginManager->getAppCollections() as $appCollection) {
275
+                $root->addChild($appCollection);
276
+            }
277
+        });
278
+    }
279 279
 
280
-	public function exec() {
281
-		$this->server->exec();
282
-	}
280
+    public function exec() {
281
+        $this->server->exec();
282
+    }
283 283
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		$authPlugin->addBackend($authBackend);
119 119
 
120 120
 		// debugging
121
-		if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
121
+		if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
122 122
 			$this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
123 123
 		} else {
124 124
 			$this->server->addPlugin(new DummyGetResponsePlugin());
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 
178 178
 		// Some WebDAV clients do require Class 2 WebDAV support (locking), since
179 179
 		// we do not provide locking we emulate it using a fake locking plugin.
180
-		if($request->isUserAgent([
180
+		if ($request->isUserAgent([
181 181
 			'/WebDAVFS/',
182 182
 			'/OneNote/',
183
-			'/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601
183
+			'/^Microsoft-WebDAV/', // Microsoft-WebDAV-MiniRedir/6.1.7601
184 184
 		])) {
185 185
 			$this->server->addPlugin(new FakeLockerPlugin());
186 186
 		}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		}
191 191
 
192 192
 		// wait with registering these until auth is handled and the filesystem is setup
193
-		$this->server->on('beforeMethod', function () use ($root) {
193
+		$this->server->on('beforeMethod', function() use ($root) {
194 194
 			// custom properties plugin must be the last one
195 195
 			$userSession = \OC::$server->getUserSession();
196 196
 			$user = $userSession->getUser();
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/ServerFactory.php 2 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -42,158 +42,158 @@
 block discarded – undo
42 42
 use Sabre\DAV\Auth\Plugin;
43 43
 
44 44
 class ServerFactory {
45
-	/** @var IConfig */
46
-	private $config;
47
-	/** @var ILogger */
48
-	private $logger;
49
-	/** @var IDBConnection */
50
-	private $databaseConnection;
51
-	/** @var IUserSession */
52
-	private $userSession;
53
-	/** @var IMountManager */
54
-	private $mountManager;
55
-	/** @var ITagManager */
56
-	private $tagManager;
57
-	/** @var IRequest */
58
-	private $request;
59
-	/** @var IPreview  */
60
-	private $previewManager;
45
+    /** @var IConfig */
46
+    private $config;
47
+    /** @var ILogger */
48
+    private $logger;
49
+    /** @var IDBConnection */
50
+    private $databaseConnection;
51
+    /** @var IUserSession */
52
+    private $userSession;
53
+    /** @var IMountManager */
54
+    private $mountManager;
55
+    /** @var ITagManager */
56
+    private $tagManager;
57
+    /** @var IRequest */
58
+    private $request;
59
+    /** @var IPreview  */
60
+    private $previewManager;
61 61
 
62
-	/**
63
-	 * @param IConfig $config
64
-	 * @param ILogger $logger
65
-	 * @param IDBConnection $databaseConnection
66
-	 * @param IUserSession $userSession
67
-	 * @param IMountManager $mountManager
68
-	 * @param ITagManager $tagManager
69
-	 * @param IRequest $request
70
-	 * @param IPreview $previewManager
71
-	 */
72
-	public function __construct(
73
-		IConfig $config,
74
-		ILogger $logger,
75
-		IDBConnection $databaseConnection,
76
-		IUserSession $userSession,
77
-		IMountManager $mountManager,
78
-		ITagManager $tagManager,
79
-		IRequest $request,
80
-		IPreview $previewManager
81
-	) {
82
-		$this->config = $config;
83
-		$this->logger = $logger;
84
-		$this->databaseConnection = $databaseConnection;
85
-		$this->userSession = $userSession;
86
-		$this->mountManager = $mountManager;
87
-		$this->tagManager = $tagManager;
88
-		$this->request = $request;
89
-		$this->previewManager = $previewManager;
90
-	}
62
+    /**
63
+     * @param IConfig $config
64
+     * @param ILogger $logger
65
+     * @param IDBConnection $databaseConnection
66
+     * @param IUserSession $userSession
67
+     * @param IMountManager $mountManager
68
+     * @param ITagManager $tagManager
69
+     * @param IRequest $request
70
+     * @param IPreview $previewManager
71
+     */
72
+    public function __construct(
73
+        IConfig $config,
74
+        ILogger $logger,
75
+        IDBConnection $databaseConnection,
76
+        IUserSession $userSession,
77
+        IMountManager $mountManager,
78
+        ITagManager $tagManager,
79
+        IRequest $request,
80
+        IPreview $previewManager
81
+    ) {
82
+        $this->config = $config;
83
+        $this->logger = $logger;
84
+        $this->databaseConnection = $databaseConnection;
85
+        $this->userSession = $userSession;
86
+        $this->mountManager = $mountManager;
87
+        $this->tagManager = $tagManager;
88
+        $this->request = $request;
89
+        $this->previewManager = $previewManager;
90
+    }
91 91
 
92
-	/**
93
-	 * @param string $baseUri
94
-	 * @param string $requestUri
95
-	 * @param Plugin $authPlugin
96
-	 * @param callable $viewCallBack callback that should return the view for the dav endpoint
97
-	 * @return Server
98
-	 */
99
-	public function createServer($baseUri,
100
-								 $requestUri,
101
-								 Plugin $authPlugin,
102
-								 callable $viewCallBack) {
103
-		// Fire up server
104
-		$objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree();
105
-		$server = new \OCA\DAV\Connector\Sabre\Server($objectTree);
106
-		// Set URL explicitly due to reverse-proxy situations
107
-		$server->httpRequest->setUrl($requestUri);
108
-		$server->setBaseUri($baseUri);
92
+    /**
93
+     * @param string $baseUri
94
+     * @param string $requestUri
95
+     * @param Plugin $authPlugin
96
+     * @param callable $viewCallBack callback that should return the view for the dav endpoint
97
+     * @return Server
98
+     */
99
+    public function createServer($baseUri,
100
+                                    $requestUri,
101
+                                    Plugin $authPlugin,
102
+                                    callable $viewCallBack) {
103
+        // Fire up server
104
+        $objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree();
105
+        $server = new \OCA\DAV\Connector\Sabre\Server($objectTree);
106
+        // Set URL explicitly due to reverse-proxy situations
107
+        $server->httpRequest->setUrl($requestUri);
108
+        $server->setBaseUri($baseUri);
109 109
 
110
-		// Load plugins
111
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config));
112
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin($this->config));
113
-		$server->addPlugin($authPlugin);
114
-		// FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
115
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin());
116
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger));
117
-		$server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
118
-		// Some WebDAV clients do require Class 2 WebDAV support (locking), since
119
-		// we do not provide locking we emulate it using a fake locking plugin.
120
-		if($this->request->isUserAgent([
121
-				'/WebDAVFS/',
122
-				'/OneNote/',
123
-				'/Microsoft-WebDAV-MiniRedir/',
124
-		])) {
125
-			$server->addPlugin(new \OCA\DAV\Connector\Sabre\FakeLockerPlugin());
126
-		}
110
+        // Load plugins
111
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config));
112
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin($this->config));
113
+        $server->addPlugin($authPlugin);
114
+        // FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
115
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin());
116
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger));
117
+        $server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
118
+        // Some WebDAV clients do require Class 2 WebDAV support (locking), since
119
+        // we do not provide locking we emulate it using a fake locking plugin.
120
+        if($this->request->isUserAgent([
121
+                '/WebDAVFS/',
122
+                '/OneNote/',
123
+                '/Microsoft-WebDAV-MiniRedir/',
124
+        ])) {
125
+            $server->addPlugin(new \OCA\DAV\Connector\Sabre\FakeLockerPlugin());
126
+        }
127 127
 
128
-		if (BrowserErrorPagePlugin::isBrowserRequest($this->request)) {
129
-			$server->addPlugin(new BrowserErrorPagePlugin());
130
-		}
128
+        if (BrowserErrorPagePlugin::isBrowserRequest($this->request)) {
129
+            $server->addPlugin(new BrowserErrorPagePlugin());
130
+        }
131 131
 
132
-		// wait with registering these until auth is handled and the filesystem is setup
133
-		$server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) {
134
-			// ensure the skeleton is copied
135
-			$userFolder = \OC::$server->getUserFolder();
132
+        // wait with registering these until auth is handled and the filesystem is setup
133
+        $server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) {
134
+            // ensure the skeleton is copied
135
+            $userFolder = \OC::$server->getUserFolder();
136 136
 			
137
-			/** @var \OC\Files\View $view */
138
-			$view = $viewCallBack($server);
139
-			if ($userFolder instanceof Folder && $userFolder->getPath() === $view->getRoot()) {
140
-				$rootInfo = $userFolder;
141
-			} else {
142
-				$rootInfo = $view->getFileInfo('');
143
-			}
137
+            /** @var \OC\Files\View $view */
138
+            $view = $viewCallBack($server);
139
+            if ($userFolder instanceof Folder && $userFolder->getPath() === $view->getRoot()) {
140
+                $rootInfo = $userFolder;
141
+            } else {
142
+                $rootInfo = $view->getFileInfo('');
143
+            }
144 144
 
145
-			// Create Nextcloud Dir
146
-			if ($rootInfo->getType() === 'dir') {
147
-				$root = new \OCA\DAV\Connector\Sabre\Directory($view, $rootInfo, $objectTree);
148
-			} else {
149
-				$root = new \OCA\DAV\Connector\Sabre\File($view, $rootInfo);
150
-			}
151
-			$objectTree->init($root, $view, $this->mountManager);
145
+            // Create Nextcloud Dir
146
+            if ($rootInfo->getType() === 'dir') {
147
+                $root = new \OCA\DAV\Connector\Sabre\Directory($view, $rootInfo, $objectTree);
148
+            } else {
149
+                $root = new \OCA\DAV\Connector\Sabre\File($view, $rootInfo);
150
+            }
151
+            $objectTree->init($root, $view, $this->mountManager);
152 152
 
153
-			$server->addPlugin(
154
-				new \OCA\DAV\Connector\Sabre\FilesPlugin(
155
-					$objectTree,
156
-					$this->config,
157
-					$this->request,
158
-					$this->previewManager,
159
-					false,
160
-					!$this->config->getSystemValue('debug', false)
161
-				)
162
-			);
163
-			$server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view, true));
153
+            $server->addPlugin(
154
+                new \OCA\DAV\Connector\Sabre\FilesPlugin(
155
+                    $objectTree,
156
+                    $this->config,
157
+                    $this->request,
158
+                    $this->previewManager,
159
+                    false,
160
+                    !$this->config->getSystemValue('debug', false)
161
+                )
162
+            );
163
+            $server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view, true));
164 164
 
165
-			if($this->userSession->isLoggedIn()) {
166
-				$server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager));
167
-				$server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
168
-					$objectTree,
169
-					$this->userSession,
170
-					$userFolder,
171
-					\OC::$server->getShareManager()
172
-				));
173
-				$server->addPlugin(new \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin(\OC::$server->getCommentsManager(), $this->userSession));
174
-				$server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesReportPlugin(
175
-					$objectTree,
176
-					$view,
177
-					\OC::$server->getSystemTagManager(),
178
-					\OC::$server->getSystemTagObjectMapper(),
179
-					\OC::$server->getTagManager(),
180
-					$this->userSession,
181
-					\OC::$server->getGroupManager(),
182
-					$userFolder
183
-				));
184
-				// custom properties plugin must be the last one
185
-				$server->addPlugin(
186
-					new \Sabre\DAV\PropertyStorage\Plugin(
187
-						new \OCA\DAV\Connector\Sabre\CustomPropertiesBackend(
188
-							$objectTree,
189
-							$this->databaseConnection,
190
-							$this->userSession->getUser()
191
-						)
192
-					)
193
-				);
194
-			}
195
-			$server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin());
196
-		}, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request
197
-		return $server;
198
-	}
165
+            if($this->userSession->isLoggedIn()) {
166
+                $server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager));
167
+                $server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
168
+                    $objectTree,
169
+                    $this->userSession,
170
+                    $userFolder,
171
+                    \OC::$server->getShareManager()
172
+                ));
173
+                $server->addPlugin(new \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin(\OC::$server->getCommentsManager(), $this->userSession));
174
+                $server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesReportPlugin(
175
+                    $objectTree,
176
+                    $view,
177
+                    \OC::$server->getSystemTagManager(),
178
+                    \OC::$server->getSystemTagObjectMapper(),
179
+                    \OC::$server->getTagManager(),
180
+                    $this->userSession,
181
+                    \OC::$server->getGroupManager(),
182
+                    $userFolder
183
+                ));
184
+                // custom properties plugin must be the last one
185
+                $server->addPlugin(
186
+                    new \Sabre\DAV\PropertyStorage\Plugin(
187
+                        new \OCA\DAV\Connector\Sabre\CustomPropertiesBackend(
188
+                            $objectTree,
189
+                            $this->databaseConnection,
190
+                            $this->userSession->getUser()
191
+                        )
192
+                    )
193
+                );
194
+            }
195
+            $server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin());
196
+        }, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request
197
+        return $server;
198
+    }
199 199
 }
Please login to merge, or discard this patch.
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
 				'/OneNote/',
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, true));
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.