Passed
Push — master ( 078203...c81798 )
by Joas
14:40 queued 14s
created
apps/files_external/lib/Lib/Backend/InvalidBackend.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -34,33 +34,33 @@
 block discarded – undo
34 34
  */
35 35
 class InvalidBackend extends Backend {
36 36
 
37
-	/** @var string Invalid backend id */
38
-	private $invalidId;
37
+    /** @var string Invalid backend id */
38
+    private $invalidId;
39 39
 
40
-	/**
41
-	 * Constructs a new InvalidBackend with the id of the invalid backend
42
-	 * for display purposes
43
-	 *
44
-	 * @param string $invalidId id of the backend that did not exist
45
-	 */
46
-	public function __construct($invalidId) {
47
-		$this->invalidId = $invalidId;
48
-		$this
49
-			->setIdentifier($invalidId)
50
-			->setStorageClass('\OC\Files\Storage\FailedStorage')
51
-			->setText('Unknown storage backend ' . $invalidId);
52
-	}
40
+    /**
41
+     * Constructs a new InvalidBackend with the id of the invalid backend
42
+     * for display purposes
43
+     *
44
+     * @param string $invalidId id of the backend that did not exist
45
+     */
46
+    public function __construct($invalidId) {
47
+        $this->invalidId = $invalidId;
48
+        $this
49
+            ->setIdentifier($invalidId)
50
+            ->setStorageClass('\OC\Files\Storage\FailedStorage')
51
+            ->setText('Unknown storage backend ' . $invalidId);
52
+    }
53 53
 
54
-	/**
55
-	 * Returns the invalid backend id
56
-	 *
57
-	 * @return string invalid backend id
58
-	 */
59
-	public function getInvalidId() {
60
-		return $this->invalidId;
61
-	}
54
+    /**
55
+     * Returns the invalid backend id
56
+     *
57
+     * @return string invalid backend id
58
+     */
59
+    public function getInvalidId() {
60
+        return $this->invalidId;
61
+    }
62 62
 
63
-	public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
64
-		$storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR));
65
-	}
63
+    public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
64
+        $storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR));
65
+    }
66 66
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Storage/OwnCloud.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -39,45 +39,45 @@
 block discarded – undo
39 39
  *
40 40
  */
41 41
 class OwnCloud extends \OC\Files\Storage\DAV implements IDisableEncryptionStorage {
42
-	public const OC_URL_SUFFIX = 'remote.php/webdav';
42
+    public const OC_URL_SUFFIX = 'remote.php/webdav';
43 43
 
44
-	public function __construct($params) {
45
-		// extract context path from host if specified
46
-		// (owncloud install path on host)
47
-		$host = $params['host'];
48
-		// strip protocol
49
-		if (substr($host, 0, 8) === "https://") {
50
-			$host = substr($host, 8);
51
-			$params['secure'] = true;
52
-		} elseif (substr($host, 0, 7) === "http://") {
53
-			$host = substr($host, 7);
54
-			$params['secure'] = false;
55
-		}
56
-		$contextPath = '';
57
-		$hostSlashPos = strpos($host, '/');
58
-		if ($hostSlashPos !== false) {
59
-			$contextPath = substr($host, $hostSlashPos);
60
-			$host = substr($host, 0, $hostSlashPos);
61
-		}
44
+    public function __construct($params) {
45
+        // extract context path from host if specified
46
+        // (owncloud install path on host)
47
+        $host = $params['host'];
48
+        // strip protocol
49
+        if (substr($host, 0, 8) === "https://") {
50
+            $host = substr($host, 8);
51
+            $params['secure'] = true;
52
+        } elseif (substr($host, 0, 7) === "http://") {
53
+            $host = substr($host, 7);
54
+            $params['secure'] = false;
55
+        }
56
+        $contextPath = '';
57
+        $hostSlashPos = strpos($host, '/');
58
+        if ($hostSlashPos !== false) {
59
+            $contextPath = substr($host, $hostSlashPos);
60
+            $host = substr($host, 0, $hostSlashPos);
61
+        }
62 62
 
63
-		if (substr($contextPath, -1) !== '/') {
64
-			$contextPath .= '/';
65
-		}
63
+        if (substr($contextPath, -1) !== '/') {
64
+            $contextPath .= '/';
65
+        }
66 66
 
67
-		if (isset($params['root'])) {
68
-			$root = '/' . ltrim($params['root'], '/');
69
-		} else {
70
-			$root = '/';
71
-		}
67
+        if (isset($params['root'])) {
68
+            $root = '/' . ltrim($params['root'], '/');
69
+        } else {
70
+            $root = '/';
71
+        }
72 72
 
73
-		$params['host'] = $host;
74
-		$params['root'] = $contextPath . self::OC_URL_SUFFIX . $root;
75
-		$params['authType'] = Client::AUTH_BASIC;
73
+        $params['host'] = $host;
74
+        $params['root'] = $contextPath . self::OC_URL_SUFFIX . $root;
75
+        $params['authType'] = Client::AUTH_BASIC;
76 76
 
77
-		parent::__construct($params);
78
-	}
77
+        parent::__construct($params);
78
+    }
79 79
 
80
-	public function needsPartFile() {
81
-		return false;
82
-	}
80
+    public function needsPartFile() {
81
+        return false;
82
+    }
83 83
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Service/BackendService.php 1 patch
Indentation   +326 added lines, -326 removed lines patch added patch discarded remove patch
@@ -40,330 +40,330 @@
 block discarded – undo
40 40
  */
41 41
 class BackendService {
42 42
 
43
-	/** Visibility constants for VisibilityTrait */
44
-	public const VISIBILITY_NONE = 0;
45
-	public const VISIBILITY_PERSONAL = 1;
46
-	public const VISIBILITY_ADMIN = 2;
47
-	//const VISIBILITY_ALIENS = 4;
48
-
49
-	public const VISIBILITY_DEFAULT = 3; // PERSONAL | ADMIN
50
-
51
-	/** Priority constants for PriorityTrait */
52
-	public const PRIORITY_DEFAULT = 100;
53
-
54
-	/** @var IConfig */
55
-	protected $config;
56
-
57
-	/** @var bool */
58
-	private $userMountingAllowed = true;
59
-
60
-	/** @var string[] */
61
-	private $userMountingBackends = [];
62
-
63
-	/** @var Backend[] */
64
-	private $backends = [];
65
-
66
-	/** @var IBackendProvider[] */
67
-	private $backendProviders = [];
68
-
69
-	/** @var AuthMechanism[] */
70
-	private $authMechanisms = [];
71
-
72
-	/** @var IAuthMechanismProvider[] */
73
-	private $authMechanismProviders = [];
74
-
75
-	/** @var callable[] */
76
-	private $configHandlerLoaders = [];
77
-
78
-	private $configHandlers = [];
79
-
80
-	/**
81
-	 * @param IConfig $config
82
-	 */
83
-	public function __construct(
84
-		IConfig $config
85
-	) {
86
-		$this->config = $config;
87
-
88
-		// Load config values
89
-		if ($this->config->getAppValue('files_external', 'allow_user_mounting', 'yes') !== 'yes') {
90
-			$this->userMountingAllowed = false;
91
-		}
92
-		$this->userMountingBackends = explode(',',
93
-			$this->config->getAppValue('files_external', 'user_mounting_backends', '')
94
-		);
95
-
96
-		// if no backend is in the list an empty string is in the array and user mounting is disabled
97
-		if ($this->userMountingBackends === ['']) {
98
-			$this->userMountingAllowed = false;
99
-		}
100
-	}
101
-
102
-	/**
103
-	 * Register a backend provider
104
-	 *
105
-	 * @since 9.1.0
106
-	 * @param IBackendProvider $provider
107
-	 */
108
-	public function registerBackendProvider(IBackendProvider $provider) {
109
-		$this->backendProviders[] = $provider;
110
-	}
111
-
112
-	private function callForRegistrations() {
113
-		static $eventSent = false;
114
-		if (!$eventSent) {
115
-			\OC::$server->getEventDispatcher()->dispatch(
116
-				'OCA\\Files_External::loadAdditionalBackends',
117
-				new GenericEvent()
118
-			);
119
-			$eventSent = true;
120
-		}
121
-	}
122
-
123
-	private function loadBackendProviders() {
124
-		$this->callForRegistrations();
125
-		foreach ($this->backendProviders as $provider) {
126
-			$this->registerBackends($provider->getBackends());
127
-		}
128
-		$this->backendProviders = [];
129
-	}
130
-
131
-	/**
132
-	 * Register an auth mechanism provider
133
-	 *
134
-	 * @since 9.1.0
135
-	 * @param IAuthMechanismProvider $provider
136
-	 */
137
-	public function registerAuthMechanismProvider(IAuthMechanismProvider $provider) {
138
-		$this->authMechanismProviders[] = $provider;
139
-	}
140
-
141
-	private function loadAuthMechanismProviders() {
142
-		$this->callForRegistrations();
143
-		foreach ($this->authMechanismProviders as $provider) {
144
-			$this->registerAuthMechanisms($provider->getAuthMechanisms());
145
-		}
146
-		$this->authMechanismProviders = [];
147
-	}
148
-
149
-	/**
150
-	 * Register a backend
151
-	 *
152
-	 * @deprecated 9.1.0 use registerBackendProvider()
153
-	 * @param Backend $backend
154
-	 */
155
-	public function registerBackend(Backend $backend) {
156
-		if (!$this->isAllowedUserBackend($backend)) {
157
-			$backend->removeVisibility(BackendService::VISIBILITY_PERSONAL);
158
-		}
159
-		foreach ($backend->getIdentifierAliases() as $alias) {
160
-			$this->backends[$alias] = $backend;
161
-		}
162
-	}
163
-
164
-	/**
165
-	 * @deprecated 9.1.0 use registerBackendProvider()
166
-	 * @param Backend[] $backends
167
-	 */
168
-	public function registerBackends(array $backends) {
169
-		foreach ($backends as $backend) {
170
-			$this->registerBackend($backend);
171
-		}
172
-	}
173
-	/**
174
-	 * Register an authentication mechanism
175
-	 *
176
-	 * @deprecated 9.1.0 use registerAuthMechanismProvider()
177
-	 * @param AuthMechanism $authMech
178
-	 */
179
-	public function registerAuthMechanism(AuthMechanism $authMech) {
180
-		if (!$this->isAllowedAuthMechanism($authMech)) {
181
-			$authMech->removeVisibility(BackendService::VISIBILITY_PERSONAL);
182
-		}
183
-		foreach ($authMech->getIdentifierAliases() as $alias) {
184
-			$this->authMechanisms[$alias] = $authMech;
185
-		}
186
-	}
187
-
188
-	/**
189
-	 * @deprecated 9.1.0 use registerAuthMechanismProvider()
190
-	 * @param AuthMechanism[] $mechanisms
191
-	 */
192
-	public function registerAuthMechanisms(array $mechanisms) {
193
-		foreach ($mechanisms as $mechanism) {
194
-			$this->registerAuthMechanism($mechanism);
195
-		}
196
-	}
197
-
198
-	/**
199
-	 * Get all backends
200
-	 *
201
-	 * @return Backend[]
202
-	 */
203
-	public function getBackends() {
204
-		$this->loadBackendProviders();
205
-		// only return real identifiers, no aliases
206
-		$backends = [];
207
-		foreach ($this->backends as $backend) {
208
-			$backends[$backend->getIdentifier()] = $backend;
209
-		}
210
-		return $backends;
211
-	}
212
-
213
-	/**
214
-	 * Get all available backends
215
-	 *
216
-	 * @return Backend[]
217
-	 */
218
-	public function getAvailableBackends() {
219
-		return array_filter($this->getBackends(), function ($backend) {
220
-			return !$backend->checkDependencies();
221
-		});
222
-	}
223
-
224
-	/**
225
-	 * @param string $identifier
226
-	 * @return Backend|null
227
-	 */
228
-	public function getBackend($identifier) {
229
-		$this->loadBackendProviders();
230
-		if (isset($this->backends[$identifier])) {
231
-			return $this->backends[$identifier];
232
-		}
233
-		return null;
234
-	}
235
-
236
-	/**
237
-	 * Get all authentication mechanisms
238
-	 *
239
-	 * @return AuthMechanism[]
240
-	 */
241
-	public function getAuthMechanisms() {
242
-		$this->loadAuthMechanismProviders();
243
-		// only return real identifiers, no aliases
244
-		$mechanisms = [];
245
-		foreach ($this->authMechanisms as $mechanism) {
246
-			$mechanisms[$mechanism->getIdentifier()] = $mechanism;
247
-		}
248
-		return $mechanisms;
249
-	}
250
-
251
-	/**
252
-	 * Get all authentication mechanisms for schemes
253
-	 *
254
-	 * @param string[] $schemes
255
-	 * @return AuthMechanism[]
256
-	 */
257
-	public function getAuthMechanismsByScheme(array $schemes) {
258
-		return array_filter($this->getAuthMechanisms(), function ($authMech) use ($schemes) {
259
-			return in_array($authMech->getScheme(), $schemes, true);
260
-		});
261
-	}
262
-
263
-	/**
264
-	 * @param string $identifier
265
-	 * @return AuthMechanism|null
266
-	 */
267
-	public function getAuthMechanism($identifier) {
268
-		$this->loadAuthMechanismProviders();
269
-		if (isset($this->authMechanisms[$identifier])) {
270
-			return $this->authMechanisms[$identifier];
271
-		}
272
-		return null;
273
-	}
274
-
275
-	/**
276
-	 * @return bool
277
-	 */
278
-	public function isUserMountingAllowed() {
279
-		return $this->userMountingAllowed;
280
-	}
281
-
282
-	/**
283
-	 * Check a backend if a user is allowed to mount it
284
-	 *
285
-	 * @param Backend $backend
286
-	 * @return bool
287
-	 */
288
-	protected function isAllowedUserBackend(Backend $backend) {
289
-		if ($this->userMountingAllowed &&
290
-			array_intersect($backend->getIdentifierAliases(), $this->userMountingBackends)
291
-		) {
292
-			return true;
293
-		}
294
-		return false;
295
-	}
296
-
297
-	/**
298
-	 * Check an authentication mechanism if a user is allowed to use it
299
-	 *
300
-	 * @param AuthMechanism $authMechanism
301
-	 * @return bool
302
-	 */
303
-	protected function isAllowedAuthMechanism(AuthMechanism $authMechanism) {
304
-		return true; // not implemented
305
-	}
306
-
307
-	/**
308
-	 * registers a configuration handler
309
-	 *
310
-	 * The function of the provided $placeholder is mostly to act a sorting
311
-	 * criteria, so longer placeholders are replaced first. This avoids
312
-	 * "$user" overwriting parts of "$userMail" and "$userLang", for example.
313
-	 * The provided value should not contain the $ prefix, only a-z0-9 are
314
-	 * allowed. Upper case letters are lower cased, the replacement is case-
315
-	 * insensitive.
316
-	 *
317
-	 * The configHandlerLoader should just instantiate the handler on demand.
318
-	 * For now all handlers are instantiated when a mount is loaded, independent
319
-	 * of whether the placeholder is present or not. This may change in future.
320
-	 *
321
-	 * @since 16.0.0
322
-	 */
323
-	public function registerConfigHandler(string $placeholder, callable $configHandlerLoader) {
324
-		$placeholder = trim(strtolower($placeholder));
325
-		if (!(bool)\preg_match('/^[a-z0-9]*$/', $placeholder)) {
326
-			throw new \RuntimeException(sprintf(
327
-				'Invalid placeholder %s, only [a-z0-9] are allowed', $placeholder
328
-			));
329
-		}
330
-		if ($placeholder === '') {
331
-			throw new \RuntimeException('Invalid empty placeholder');
332
-		}
333
-		if (isset($this->configHandlerLoaders[$placeholder]) || isset($this->configHandlers[$placeholder])) {
334
-			throw new \RuntimeException(sprintf('A handler is already registered for %s', $placeholder));
335
-		}
336
-		$this->configHandlerLoaders[$placeholder] = $configHandlerLoader;
337
-	}
338
-
339
-	protected function loadConfigHandlers():void {
340
-		$this->callForRegistrations();
341
-		$newLoaded = false;
342
-		foreach ($this->configHandlerLoaders as $placeholder => $loader) {
343
-			$handler = $loader();
344
-			if (!$handler instanceof IConfigHandler) {
345
-				throw new \RuntimeException(sprintf(
346
-					'Handler for %s is not an instance of IConfigHandler', $placeholder
347
-				));
348
-			}
349
-			$this->configHandlers[$placeholder] = $handler;
350
-			$newLoaded = true;
351
-		}
352
-		$this->configHandlerLoaders = [];
353
-		if ($newLoaded) {
354
-			// ensure those with longest placeholders come first,
355
-			// to avoid substring matches
356
-			uksort($this->configHandlers, function ($phA, $phB) {
357
-				return strlen($phB) <=> strlen($phA);
358
-			});
359
-		}
360
-	}
361
-
362
-	/**
363
-	 * @since 16.0.0
364
-	 */
365
-	public function getConfigHandlers() {
366
-		$this->loadConfigHandlers();
367
-		return $this->configHandlers;
368
-	}
43
+    /** Visibility constants for VisibilityTrait */
44
+    public const VISIBILITY_NONE = 0;
45
+    public const VISIBILITY_PERSONAL = 1;
46
+    public const VISIBILITY_ADMIN = 2;
47
+    //const VISIBILITY_ALIENS = 4;
48
+
49
+    public const VISIBILITY_DEFAULT = 3; // PERSONAL | ADMIN
50
+
51
+    /** Priority constants for PriorityTrait */
52
+    public const PRIORITY_DEFAULT = 100;
53
+
54
+    /** @var IConfig */
55
+    protected $config;
56
+
57
+    /** @var bool */
58
+    private $userMountingAllowed = true;
59
+
60
+    /** @var string[] */
61
+    private $userMountingBackends = [];
62
+
63
+    /** @var Backend[] */
64
+    private $backends = [];
65
+
66
+    /** @var IBackendProvider[] */
67
+    private $backendProviders = [];
68
+
69
+    /** @var AuthMechanism[] */
70
+    private $authMechanisms = [];
71
+
72
+    /** @var IAuthMechanismProvider[] */
73
+    private $authMechanismProviders = [];
74
+
75
+    /** @var callable[] */
76
+    private $configHandlerLoaders = [];
77
+
78
+    private $configHandlers = [];
79
+
80
+    /**
81
+     * @param IConfig $config
82
+     */
83
+    public function __construct(
84
+        IConfig $config
85
+    ) {
86
+        $this->config = $config;
87
+
88
+        // Load config values
89
+        if ($this->config->getAppValue('files_external', 'allow_user_mounting', 'yes') !== 'yes') {
90
+            $this->userMountingAllowed = false;
91
+        }
92
+        $this->userMountingBackends = explode(',',
93
+            $this->config->getAppValue('files_external', 'user_mounting_backends', '')
94
+        );
95
+
96
+        // if no backend is in the list an empty string is in the array and user mounting is disabled
97
+        if ($this->userMountingBackends === ['']) {
98
+            $this->userMountingAllowed = false;
99
+        }
100
+    }
101
+
102
+    /**
103
+     * Register a backend provider
104
+     *
105
+     * @since 9.1.0
106
+     * @param IBackendProvider $provider
107
+     */
108
+    public function registerBackendProvider(IBackendProvider $provider) {
109
+        $this->backendProviders[] = $provider;
110
+    }
111
+
112
+    private function callForRegistrations() {
113
+        static $eventSent = false;
114
+        if (!$eventSent) {
115
+            \OC::$server->getEventDispatcher()->dispatch(
116
+                'OCA\\Files_External::loadAdditionalBackends',
117
+                new GenericEvent()
118
+            );
119
+            $eventSent = true;
120
+        }
121
+    }
122
+
123
+    private function loadBackendProviders() {
124
+        $this->callForRegistrations();
125
+        foreach ($this->backendProviders as $provider) {
126
+            $this->registerBackends($provider->getBackends());
127
+        }
128
+        $this->backendProviders = [];
129
+    }
130
+
131
+    /**
132
+     * Register an auth mechanism provider
133
+     *
134
+     * @since 9.1.0
135
+     * @param IAuthMechanismProvider $provider
136
+     */
137
+    public function registerAuthMechanismProvider(IAuthMechanismProvider $provider) {
138
+        $this->authMechanismProviders[] = $provider;
139
+    }
140
+
141
+    private function loadAuthMechanismProviders() {
142
+        $this->callForRegistrations();
143
+        foreach ($this->authMechanismProviders as $provider) {
144
+            $this->registerAuthMechanisms($provider->getAuthMechanisms());
145
+        }
146
+        $this->authMechanismProviders = [];
147
+    }
148
+
149
+    /**
150
+     * Register a backend
151
+     *
152
+     * @deprecated 9.1.0 use registerBackendProvider()
153
+     * @param Backend $backend
154
+     */
155
+    public function registerBackend(Backend $backend) {
156
+        if (!$this->isAllowedUserBackend($backend)) {
157
+            $backend->removeVisibility(BackendService::VISIBILITY_PERSONAL);
158
+        }
159
+        foreach ($backend->getIdentifierAliases() as $alias) {
160
+            $this->backends[$alias] = $backend;
161
+        }
162
+    }
163
+
164
+    /**
165
+     * @deprecated 9.1.0 use registerBackendProvider()
166
+     * @param Backend[] $backends
167
+     */
168
+    public function registerBackends(array $backends) {
169
+        foreach ($backends as $backend) {
170
+            $this->registerBackend($backend);
171
+        }
172
+    }
173
+    /**
174
+     * Register an authentication mechanism
175
+     *
176
+     * @deprecated 9.1.0 use registerAuthMechanismProvider()
177
+     * @param AuthMechanism $authMech
178
+     */
179
+    public function registerAuthMechanism(AuthMechanism $authMech) {
180
+        if (!$this->isAllowedAuthMechanism($authMech)) {
181
+            $authMech->removeVisibility(BackendService::VISIBILITY_PERSONAL);
182
+        }
183
+        foreach ($authMech->getIdentifierAliases() as $alias) {
184
+            $this->authMechanisms[$alias] = $authMech;
185
+        }
186
+    }
187
+
188
+    /**
189
+     * @deprecated 9.1.0 use registerAuthMechanismProvider()
190
+     * @param AuthMechanism[] $mechanisms
191
+     */
192
+    public function registerAuthMechanisms(array $mechanisms) {
193
+        foreach ($mechanisms as $mechanism) {
194
+            $this->registerAuthMechanism($mechanism);
195
+        }
196
+    }
197
+
198
+    /**
199
+     * Get all backends
200
+     *
201
+     * @return Backend[]
202
+     */
203
+    public function getBackends() {
204
+        $this->loadBackendProviders();
205
+        // only return real identifiers, no aliases
206
+        $backends = [];
207
+        foreach ($this->backends as $backend) {
208
+            $backends[$backend->getIdentifier()] = $backend;
209
+        }
210
+        return $backends;
211
+    }
212
+
213
+    /**
214
+     * Get all available backends
215
+     *
216
+     * @return Backend[]
217
+     */
218
+    public function getAvailableBackends() {
219
+        return array_filter($this->getBackends(), function ($backend) {
220
+            return !$backend->checkDependencies();
221
+        });
222
+    }
223
+
224
+    /**
225
+     * @param string $identifier
226
+     * @return Backend|null
227
+     */
228
+    public function getBackend($identifier) {
229
+        $this->loadBackendProviders();
230
+        if (isset($this->backends[$identifier])) {
231
+            return $this->backends[$identifier];
232
+        }
233
+        return null;
234
+    }
235
+
236
+    /**
237
+     * Get all authentication mechanisms
238
+     *
239
+     * @return AuthMechanism[]
240
+     */
241
+    public function getAuthMechanisms() {
242
+        $this->loadAuthMechanismProviders();
243
+        // only return real identifiers, no aliases
244
+        $mechanisms = [];
245
+        foreach ($this->authMechanisms as $mechanism) {
246
+            $mechanisms[$mechanism->getIdentifier()] = $mechanism;
247
+        }
248
+        return $mechanisms;
249
+    }
250
+
251
+    /**
252
+     * Get all authentication mechanisms for schemes
253
+     *
254
+     * @param string[] $schemes
255
+     * @return AuthMechanism[]
256
+     */
257
+    public function getAuthMechanismsByScheme(array $schemes) {
258
+        return array_filter($this->getAuthMechanisms(), function ($authMech) use ($schemes) {
259
+            return in_array($authMech->getScheme(), $schemes, true);
260
+        });
261
+    }
262
+
263
+    /**
264
+     * @param string $identifier
265
+     * @return AuthMechanism|null
266
+     */
267
+    public function getAuthMechanism($identifier) {
268
+        $this->loadAuthMechanismProviders();
269
+        if (isset($this->authMechanisms[$identifier])) {
270
+            return $this->authMechanisms[$identifier];
271
+        }
272
+        return null;
273
+    }
274
+
275
+    /**
276
+     * @return bool
277
+     */
278
+    public function isUserMountingAllowed() {
279
+        return $this->userMountingAllowed;
280
+    }
281
+
282
+    /**
283
+     * Check a backend if a user is allowed to mount it
284
+     *
285
+     * @param Backend $backend
286
+     * @return bool
287
+     */
288
+    protected function isAllowedUserBackend(Backend $backend) {
289
+        if ($this->userMountingAllowed &&
290
+            array_intersect($backend->getIdentifierAliases(), $this->userMountingBackends)
291
+        ) {
292
+            return true;
293
+        }
294
+        return false;
295
+    }
296
+
297
+    /**
298
+     * Check an authentication mechanism if a user is allowed to use it
299
+     *
300
+     * @param AuthMechanism $authMechanism
301
+     * @return bool
302
+     */
303
+    protected function isAllowedAuthMechanism(AuthMechanism $authMechanism) {
304
+        return true; // not implemented
305
+    }
306
+
307
+    /**
308
+     * registers a configuration handler
309
+     *
310
+     * The function of the provided $placeholder is mostly to act a sorting
311
+     * criteria, so longer placeholders are replaced first. This avoids
312
+     * "$user" overwriting parts of "$userMail" and "$userLang", for example.
313
+     * The provided value should not contain the $ prefix, only a-z0-9 are
314
+     * allowed. Upper case letters are lower cased, the replacement is case-
315
+     * insensitive.
316
+     *
317
+     * The configHandlerLoader should just instantiate the handler on demand.
318
+     * For now all handlers are instantiated when a mount is loaded, independent
319
+     * of whether the placeholder is present or not. This may change in future.
320
+     *
321
+     * @since 16.0.0
322
+     */
323
+    public function registerConfigHandler(string $placeholder, callable $configHandlerLoader) {
324
+        $placeholder = trim(strtolower($placeholder));
325
+        if (!(bool)\preg_match('/^[a-z0-9]*$/', $placeholder)) {
326
+            throw new \RuntimeException(sprintf(
327
+                'Invalid placeholder %s, only [a-z0-9] are allowed', $placeholder
328
+            ));
329
+        }
330
+        if ($placeholder === '') {
331
+            throw new \RuntimeException('Invalid empty placeholder');
332
+        }
333
+        if (isset($this->configHandlerLoaders[$placeholder]) || isset($this->configHandlers[$placeholder])) {
334
+            throw new \RuntimeException(sprintf('A handler is already registered for %s', $placeholder));
335
+        }
336
+        $this->configHandlerLoaders[$placeholder] = $configHandlerLoader;
337
+    }
338
+
339
+    protected function loadConfigHandlers():void {
340
+        $this->callForRegistrations();
341
+        $newLoaded = false;
342
+        foreach ($this->configHandlerLoaders as $placeholder => $loader) {
343
+            $handler = $loader();
344
+            if (!$handler instanceof IConfigHandler) {
345
+                throw new \RuntimeException(sprintf(
346
+                    'Handler for %s is not an instance of IConfigHandler', $placeholder
347
+                ));
348
+            }
349
+            $this->configHandlers[$placeholder] = $handler;
350
+            $newLoaded = true;
351
+        }
352
+        $this->configHandlerLoaders = [];
353
+        if ($newLoaded) {
354
+            // ensure those with longest placeholders come first,
355
+            // to avoid substring matches
356
+            uksort($this->configHandlers, function ($phA, $phB) {
357
+                return strlen($phB) <=> strlen($phA);
358
+            });
359
+        }
360
+    }
361
+
362
+    /**
363
+     * @since 16.0.0
364
+     */
365
+    public function getConfigHandlers() {
366
+        $this->loadConfigHandlers();
367
+        return $this->configHandlers;
368
+    }
369 369
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/PropfindPlugin.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -35,79 +35,79 @@
 block discarded – undo
35 35
 use Sabre\DAV\ServerPlugin;
36 36
 
37 37
 class PropfindPlugin extends ServerPlugin {
38
-	public const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
39
-	public const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location';
40
-	public const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time';
41
-	public const TRASHBIN_TITLE = '{http://nextcloud.org/ns}trashbin-title';
38
+    public const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
39
+    public const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location';
40
+    public const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time';
41
+    public const TRASHBIN_TITLE = '{http://nextcloud.org/ns}trashbin-title';
42 42
 
43
-	/** @var Server */
44
-	private $server;
43
+    /** @var Server */
44
+    private $server;
45 45
 
46
-	/** @var IPreview */
47
-	private $previewManager;
46
+    /** @var IPreview */
47
+    private $previewManager;
48 48
 
49
-	public function __construct(
50
-		IPreview $previewManager
51
-	) {
52
-		$this->previewManager = $previewManager;
53
-	}
49
+    public function __construct(
50
+        IPreview $previewManager
51
+    ) {
52
+        $this->previewManager = $previewManager;
53
+    }
54 54
 
55
-	public function initialize(Server $server) {
56
-		$this->server = $server;
55
+    public function initialize(Server $server) {
56
+        $this->server = $server;
57 57
 
58
-		$this->server->on('propFind', [$this, 'propFind']);
59
-	}
58
+        $this->server->on('propFind', [$this, 'propFind']);
59
+    }
60 60
 
61 61
 
62
-	public function propFind(PropFind $propFind, INode $node) {
63
-		if (!($node instanceof ITrash)) {
64
-			return;
65
-		}
62
+    public function propFind(PropFind $propFind, INode $node) {
63
+        if (!($node instanceof ITrash)) {
64
+            return;
65
+        }
66 66
 
67
-		$propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) {
68
-			return $node->getFilename();
69
-		});
67
+        $propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) {
68
+            return $node->getFilename();
69
+        });
70 70
 
71
-		$propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) {
72
-			return $node->getOriginalLocation();
73
-		});
71
+        $propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) {
72
+            return $node->getOriginalLocation();
73
+        });
74 74
 
75
-		$propFind->handle(self::TRASHBIN_TITLE, function () use ($node) {
76
-			return $node->getTitle();
77
-		});
75
+        $propFind->handle(self::TRASHBIN_TITLE, function () use ($node) {
76
+            return $node->getTitle();
77
+        });
78 78
 
79
-		$propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) {
80
-			return $node->getDeletionTime();
81
-		});
79
+        $propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) {
80
+            return $node->getDeletionTime();
81
+        });
82 82
 
83
-		$propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) {
84
-			return $node->getSize();
85
-		});
83
+        $propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) {
84
+            return $node->getSize();
85
+        });
86 86
 
87
-		$propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) {
88
-			return $node->getFileId();
89
-		});
87
+        $propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) {
88
+            return $node->getFileId();
89
+        });
90 90
 
91
-		$propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () {
92
-			return 'GD'; // read + delete
93
-		});
91
+        $propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () {
92
+            return 'GD'; // read + delete
93
+        });
94 94
 
95
-		$propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) {
96
-			// add fake etag, it is only needed to identify the preview image
97
-			return $node->getLastModified();
98
-		});
95
+        $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) {
96
+            // add fake etag, it is only needed to identify the preview image
97
+            return $node->getLastModified();
98
+        });
99 99
 
100
-		$propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) {
101
-			// add fake etag, it is only needed to identify the preview image
102
-			return $node->getFileId();
103
-		});
100
+        $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) {
101
+            // add fake etag, it is only needed to identify the preview image
102
+            return $node->getFileId();
103
+        });
104 104
 
105
-		$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
106
-			return $this->previewManager->isAvailable($node->getFileInfo());
107
-		});
105
+        $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
106
+            return $this->previewManager->isAvailable($node->getFileInfo());
107
+        });
108 108
 
109
-		$propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () {
110
-			return '';
111
-		});
112
-	}
109
+        $propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () {
110
+            return '';
111
+        });
112
+    }
113 113
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/AbstractTrashFile.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@
 block discarded – undo
30 30
 use Sabre\DAV\IFile;
31 31
 
32 32
 abstract class AbstractTrashFile extends AbstractTrash implements IFile, ITrash {
33
-	public function put($data) {
34
-		throw new Forbidden();
35
-	}
33
+    public function put($data) {
34
+        throw new Forbidden();
35
+    }
36 36
 
37
-	public function setName($name) {
38
-		throw new Forbidden();
39
-	}
37
+    public function setName($name) {
38
+        throw new Forbidden();
39
+    }
40 40
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Controller/ExternalSharesController.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -40,115 +40,115 @@
 block discarded – undo
40 40
  */
41 41
 class ExternalSharesController extends Controller {
42 42
 
43
-	/** @var \OCA\Files_Sharing\External\Manager */
44
-	private $externalManager;
45
-	/** @var IClientService */
46
-	private $clientService;
43
+    /** @var \OCA\Files_Sharing\External\Manager */
44
+    private $externalManager;
45
+    /** @var IClientService */
46
+    private $clientService;
47 47
 
48
-	/**
49
-	 * @param string $appName
50
-	 * @param IRequest $request
51
-	 * @param \OCA\Files_Sharing\External\Manager $externalManager
52
-	 * @param IClientService $clientService
53
-	 */
54
-	public function __construct($appName,
55
-								IRequest $request,
56
-								\OCA\Files_Sharing\External\Manager $externalManager,
57
-								IClientService $clientService) {
58
-		parent::__construct($appName, $request);
59
-		$this->externalManager = $externalManager;
60
-		$this->clientService = $clientService;
61
-	}
48
+    /**
49
+     * @param string $appName
50
+     * @param IRequest $request
51
+     * @param \OCA\Files_Sharing\External\Manager $externalManager
52
+     * @param IClientService $clientService
53
+     */
54
+    public function __construct($appName,
55
+                                IRequest $request,
56
+                                \OCA\Files_Sharing\External\Manager $externalManager,
57
+                                IClientService $clientService) {
58
+        parent::__construct($appName, $request);
59
+        $this->externalManager = $externalManager;
60
+        $this->clientService = $clientService;
61
+    }
62 62
 
63
-	/**
64
-	 * @NoAdminRequired
65
-	 * @NoOutgoingFederatedSharingRequired
66
-	 *
67
-	 * @return JSONResponse
68
-	 */
69
-	public function index() {
70
-		return new JSONResponse($this->externalManager->getOpenShares());
71
-	}
63
+    /**
64
+     * @NoAdminRequired
65
+     * @NoOutgoingFederatedSharingRequired
66
+     *
67
+     * @return JSONResponse
68
+     */
69
+    public function index() {
70
+        return new JSONResponse($this->externalManager->getOpenShares());
71
+    }
72 72
 
73
-	/**
74
-	 * @NoAdminRequired
75
-	 * @NoOutgoingFederatedSharingRequired
76
-	 *
77
-	 * @param int $id
78
-	 * @return JSONResponse
79
-	 */
80
-	public function create($id) {
81
-		$this->externalManager->acceptShare($id);
82
-		return new JSONResponse();
83
-	}
73
+    /**
74
+     * @NoAdminRequired
75
+     * @NoOutgoingFederatedSharingRequired
76
+     *
77
+     * @param int $id
78
+     * @return JSONResponse
79
+     */
80
+    public function create($id) {
81
+        $this->externalManager->acceptShare($id);
82
+        return new JSONResponse();
83
+    }
84 84
 
85
-	/**
86
-	 * @NoAdminRequired
87
-	 * @NoOutgoingFederatedSharingRequired
88
-	 *
89
-	 * @param integer $id
90
-	 * @return JSONResponse
91
-	 */
92
-	public function destroy($id) {
93
-		$this->externalManager->declineShare($id);
94
-		return new JSONResponse();
95
-	}
85
+    /**
86
+     * @NoAdminRequired
87
+     * @NoOutgoingFederatedSharingRequired
88
+     *
89
+     * @param integer $id
90
+     * @return JSONResponse
91
+     */
92
+    public function destroy($id) {
93
+        $this->externalManager->declineShare($id);
94
+        return new JSONResponse();
95
+    }
96 96
 
97
-	/**
98
-	 * Test whether the specified remote is accessible
99
-	 *
100
-	 * @param string $remote
101
-	 * @param bool $checkVersion
102
-	 * @return bool
103
-	 */
104
-	protected function testUrl($remote, $checkVersion = false) {
105
-		try {
106
-			$client = $this->clientService->newClient();
107
-			$response = json_decode($client->get(
108
-				$remote,
109
-				[
110
-					'timeout' => 3,
111
-					'connect_timeout' => 3,
112
-				]
113
-			)->getBody());
97
+    /**
98
+     * Test whether the specified remote is accessible
99
+     *
100
+     * @param string $remote
101
+     * @param bool $checkVersion
102
+     * @return bool
103
+     */
104
+    protected function testUrl($remote, $checkVersion = false) {
105
+        try {
106
+            $client = $this->clientService->newClient();
107
+            $response = json_decode($client->get(
108
+                $remote,
109
+                [
110
+                    'timeout' => 3,
111
+                    'connect_timeout' => 3,
112
+                ]
113
+            )->getBody());
114 114
 
115
-			if ($checkVersion) {
116
-				return !empty($response->version) && version_compare($response->version, '7.0.0', '>=');
117
-			} else {
118
-				return is_object($response);
119
-			}
120
-		} catch (\Exception $e) {
121
-			return false;
122
-		}
123
-	}
115
+            if ($checkVersion) {
116
+                return !empty($response->version) && version_compare($response->version, '7.0.0', '>=');
117
+            } else {
118
+                return is_object($response);
119
+            }
120
+        } catch (\Exception $e) {
121
+            return false;
122
+        }
123
+    }
124 124
 
125
-	/**
126
-	 * @PublicPage
127
-	 * @NoOutgoingFederatedSharingRequired
128
-	 * @NoIncomingFederatedSharingRequired
129
-	 *
130
-	 * @param string $remote
131
-	 * @return DataResponse
132
-	 */
133
-	public function testRemote($remote) {
134
-		if (strpos($remote, '#') !== false || strpos($remote, '?') !== false || strpos($remote, ';') !== false) {
135
-			return new DataResponse(false);
136
-		}
125
+    /**
126
+     * @PublicPage
127
+     * @NoOutgoingFederatedSharingRequired
128
+     * @NoIncomingFederatedSharingRequired
129
+     *
130
+     * @param string $remote
131
+     * @return DataResponse
132
+     */
133
+    public function testRemote($remote) {
134
+        if (strpos($remote, '#') !== false || strpos($remote, '?') !== false || strpos($remote, ';') !== false) {
135
+            return new DataResponse(false);
136
+        }
137 137
 
138
-		if (
139
-			$this->testUrl('https://' . $remote . '/ocs-provider/') ||
140
-			$this->testUrl('https://' . $remote . '/ocs-provider/index.php') ||
141
-			$this->testUrl('https://' . $remote . '/status.php', true)
142
-		) {
143
-			return new DataResponse('https');
144
-		} elseif (
145
-			$this->testUrl('http://' . $remote . '/ocs-provider/') ||
146
-			$this->testUrl('http://' . $remote . '/ocs-provider/index.php') ||
147
-			$this->testUrl('http://' . $remote . '/status.php', true)
148
-		) {
149
-			return new DataResponse('http');
150
-		} else {
151
-			return new DataResponse(false);
152
-		}
153
-	}
138
+        if (
139
+            $this->testUrl('https://' . $remote . '/ocs-provider/') ||
140
+            $this->testUrl('https://' . $remote . '/ocs-provider/index.php') ||
141
+            $this->testUrl('https://' . $remote . '/status.php', true)
142
+        ) {
143
+            return new DataResponse('https');
144
+        } elseif (
145
+            $this->testUrl('http://' . $remote . '/ocs-provider/') ||
146
+            $this->testUrl('http://' . $remote . '/ocs-provider/index.php') ||
147
+            $this->testUrl('http://' . $remote . '/status.php', true)
148
+        ) {
149
+            return new DataResponse('http');
150
+        } else {
151
+            return new DataResponse(false);
152
+        }
153
+    }
154 154
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/Swift.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,29 +33,29 @@
 block discarded – undo
33 33
 use OCP\IL10N;
34 34
 
35 35
 class Swift extends Backend {
36
-	use LegacyDependencyCheckPolyfill;
36
+    use LegacyDependencyCheckPolyfill;
37 37
 
38
-	public function __construct(IL10N $l, OpenStackV2 $openstackAuth, Rackspace $rackspaceAuth) {
39
-		$this
40
-			->setIdentifier('swift')
41
-			->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat
42
-			->setStorageClass('\OCA\Files_External\Lib\Storage\Swift')
43
-			->setText($l->t('OpenStack Object Storage'))
44
-			->addParameters([
45
-				(new DefinitionParameter('service_name', $l->t('Service name')))
46
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
47
-				new DefinitionParameter('region', $l->t('Region')),
48
-				new DefinitionParameter('bucket', $l->t('Bucket')),
49
-				(new DefinitionParameter('timeout', $l->t('Request timeout (seconds)')))
50
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
51
-			])
52
-			->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK)
53
-			->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) {
54
-				if (isset($params['options']['key']) && $params['options']['key']) {
55
-					return $rackspaceAuth;
56
-				}
57
-				return $openstackAuth;
58
-			})
59
-		;
60
-	}
38
+    public function __construct(IL10N $l, OpenStackV2 $openstackAuth, Rackspace $rackspaceAuth) {
39
+        $this
40
+            ->setIdentifier('swift')
41
+            ->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat
42
+            ->setStorageClass('\OCA\Files_External\Lib\Storage\Swift')
43
+            ->setText($l->t('OpenStack Object Storage'))
44
+            ->addParameters([
45
+                (new DefinitionParameter('service_name', $l->t('Service name')))
46
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
47
+                new DefinitionParameter('region', $l->t('Region')),
48
+                new DefinitionParameter('bucket', $l->t('Bucket')),
49
+                (new DefinitionParameter('timeout', $l->t('Request timeout (seconds)')))
50
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
51
+            ])
52
+            ->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK)
53
+            ->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) {
54
+                if (isset($params['options']['key']) && $params['options']['key']) {
55
+                    return $rackspaceAuth;
56
+                }
57
+                return $openstackAuth;
58
+            })
59
+        ;
60
+    }
61 61
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -36,19 +36,19 @@
 block discarded – undo
36 36
  * OpenStack Keystone authentication
37 37
  */
38 38
 class OpenStackV3 extends AuthMechanism {
39
-	public function __construct(IL10N $l) {
40
-		$this
41
-			->setIdentifier('openstack::openstackv3')
42
-			->setScheme(self::SCHEME_OPENSTACK)
43
-			->setText($l->t('OpenStack v3'))
44
-			->addParameters([
45
-				new DefinitionParameter('user', $l->t('Username')),
46
-				new DefinitionParameter('domain', $l->t('Domain')),
47
-				(new DefinitionParameter('password', $l->t('Password')))
48
-					->setType(DefinitionParameter::VALUE_PASSWORD),
49
-				new DefinitionParameter('tenant', $l->t('Tenant name')),
50
-				new DefinitionParameter('url', $l->t('Identity endpoint URL'))
51
-			])
52
-		;
53
-	}
39
+    public function __construct(IL10N $l) {
40
+        $this
41
+            ->setIdentifier('openstack::openstackv3')
42
+            ->setScheme(self::SCHEME_OPENSTACK)
43
+            ->setText($l->t('OpenStack v3'))
44
+            ->addParameters([
45
+                new DefinitionParameter('user', $l->t('Username')),
46
+                new DefinitionParameter('domain', $l->t('Domain')),
47
+                (new DefinitionParameter('password', $l->t('Password')))
48
+                    ->setType(DefinitionParameter::VALUE_PASSWORD),
49
+                new DefinitionParameter('tenant', $l->t('Tenant name')),
50
+                new DefinitionParameter('url', $l->t('Identity endpoint URL'))
51
+            ])
52
+        ;
53
+    }
54 54
 }
Please login to merge, or discard this patch.
apps/files_versions/appinfo/routes.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@
 block discarded – undo
30 30
 /** @var Application $application */
31 31
 $application = \OC::$server->query(Application::class);
32 32
 $application->registerRoutes($this, [
33
-	'routes' => [
34
-		[
35
-			'name' => 'Preview#getPreview',
36
-			'url' => '/preview',
37
-			'verb' => 'GET',
38
-		],
39
-	],
33
+    'routes' => [
34
+        [
35
+            'name' => 'Preview#getPreview',
36
+            'url' => '/preview',
37
+            'verb' => 'GET',
38
+        ],
39
+    ],
40 40
 ]);
41 41
 
42 42
 /** @var $this \OCP\Route\IRouter */
43 43
 $this->create('files_versions_download', 'apps/files_versions/download.php')
44
-	->actionInclude('files_versions/download.php');
44
+    ->actionInclude('files_versions/download.php');
45 45
 $this->create('files_versions_ajax_getVersions', 'apps/files_versions/ajax/getVersions.php')
46
-	->actionInclude('files_versions/ajax/getVersions.php');
46
+    ->actionInclude('files_versions/ajax/getVersions.php');
47 47
 $this->create('files_versions_ajax_rollbackVersion', 'apps/files_versions/ajax/rollbackVersion.php')
48
-	->actionInclude('files_versions/ajax/rollbackVersion.php');
48
+    ->actionInclude('files_versions/ajax/rollbackVersion.php');
Please login to merge, or discard this patch.