Passed
Push — master ( 0f9b88...fa914f )
by Roeland
14:25 queued 12s
created
apps/files_external/lib/Controller/GlobalStoragesController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
 		} catch (NotFoundException $e) {
198 198
 			return new DataResponse(
199 199
 				[
200
-					'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id])
200
+					'message' => (string) $this->l10n->t('Storage with ID "%d" not found', [$id])
201 201
 				],
202 202
 				Http::STATUS_NOT_FOUND
203 203
 			);
Please login to merge, or discard this patch.
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -40,148 +40,148 @@
 block discarded – undo
40 40
  * Global storages controller
41 41
  */
42 42
 class GlobalStoragesController extends StoragesController {
43
-	/**
44
-	 * Creates a new global storages controller.
45
-	 *
46
-	 * @param string $AppName application name
47
-	 * @param IRequest $request request object
48
-	 * @param IL10N $l10n l10n service
49
-	 * @param GlobalStoragesService $globalStoragesService storage service
50
-	 * @param ILogger $logger
51
-	 */
52
-	public function __construct(
53
-		$AppName,
54
-		IRequest $request,
55
-		IL10N $l10n,
56
-		GlobalStoragesService $globalStoragesService,
57
-		ILogger $logger
58
-	) {
59
-		parent::__construct(
60
-			$AppName,
61
-			$request,
62
-			$l10n,
63
-			$globalStoragesService,
64
-			$logger
65
-		);
66
-	}
43
+    /**
44
+     * Creates a new global storages controller.
45
+     *
46
+     * @param string $AppName application name
47
+     * @param IRequest $request request object
48
+     * @param IL10N $l10n l10n service
49
+     * @param GlobalStoragesService $globalStoragesService storage service
50
+     * @param ILogger $logger
51
+     */
52
+    public function __construct(
53
+        $AppName,
54
+        IRequest $request,
55
+        IL10N $l10n,
56
+        GlobalStoragesService $globalStoragesService,
57
+        ILogger $logger
58
+    ) {
59
+        parent::__construct(
60
+            $AppName,
61
+            $request,
62
+            $l10n,
63
+            $globalStoragesService,
64
+            $logger
65
+        );
66
+    }
67 67
 
68
-	/**
69
-	 * Create an external storage entry.
70
-	 *
71
-	 * @param string $mountPoint storage mount point
72
-	 * @param string $backend backend identifier
73
-	 * @param string $authMechanism authentication mechanism identifier
74
-	 * @param array $backendOptions backend-specific options
75
-	 * @param array $mountOptions mount-specific options
76
-	 * @param array $applicableUsers users for which to mount the storage
77
-	 * @param array $applicableGroups groups for which to mount the storage
78
-	 * @param int $priority priority
79
-	 *
80
-	 * @return DataResponse
81
-	 */
82
-	public function create(
83
-		$mountPoint,
84
-		$backend,
85
-		$authMechanism,
86
-		$backendOptions,
87
-		$mountOptions,
88
-		$applicableUsers,
89
-		$applicableGroups,
90
-		$priority
91
-	) {
92
-		$newStorage = $this->createStorage(
93
-			$mountPoint,
94
-			$backend,
95
-			$authMechanism,
96
-			$backendOptions,
97
-			$mountOptions,
98
-			$applicableUsers,
99
-			$applicableGroups,
100
-			$priority
101
-		);
102
-		if ($newStorage instanceof DataResponse) {
103
-			return $newStorage;
104
-		}
68
+    /**
69
+     * Create an external storage entry.
70
+     *
71
+     * @param string $mountPoint storage mount point
72
+     * @param string $backend backend identifier
73
+     * @param string $authMechanism authentication mechanism identifier
74
+     * @param array $backendOptions backend-specific options
75
+     * @param array $mountOptions mount-specific options
76
+     * @param array $applicableUsers users for which to mount the storage
77
+     * @param array $applicableGroups groups for which to mount the storage
78
+     * @param int $priority priority
79
+     *
80
+     * @return DataResponse
81
+     */
82
+    public function create(
83
+        $mountPoint,
84
+        $backend,
85
+        $authMechanism,
86
+        $backendOptions,
87
+        $mountOptions,
88
+        $applicableUsers,
89
+        $applicableGroups,
90
+        $priority
91
+    ) {
92
+        $newStorage = $this->createStorage(
93
+            $mountPoint,
94
+            $backend,
95
+            $authMechanism,
96
+            $backendOptions,
97
+            $mountOptions,
98
+            $applicableUsers,
99
+            $applicableGroups,
100
+            $priority
101
+        );
102
+        if ($newStorage instanceof DataResponse) {
103
+            return $newStorage;
104
+        }
105 105
 
106
-		$response = $this->validate($newStorage);
107
-		if (!empty($response)) {
108
-			return $response;
109
-		}
106
+        $response = $this->validate($newStorage);
107
+        if (!empty($response)) {
108
+            return $response;
109
+        }
110 110
 
111
-		$newStorage = $this->service->addStorage($newStorage);
111
+        $newStorage = $this->service->addStorage($newStorage);
112 112
 
113
-		$this->updateStorageStatus($newStorage);
113
+        $this->updateStorageStatus($newStorage);
114 114
 
115
-		return new DataResponse(
116
-			$this->formatStorageForUI($newStorage),
117
-			Http::STATUS_CREATED
118
-		);
119
-	}
115
+        return new DataResponse(
116
+            $this->formatStorageForUI($newStorage),
117
+            Http::STATUS_CREATED
118
+        );
119
+    }
120 120
 
121
-	/**
122
-	 * Update an external storage entry.
123
-	 *
124
-	 * @param int $id storage id
125
-	 * @param string $mountPoint storage mount point
126
-	 * @param string $backend backend identifier
127
-	 * @param string $authMechanism authentication mechansim identifier
128
-	 * @param array $backendOptions backend-specific options
129
-	 * @param array $mountOptions mount-specific options
130
-	 * @param array $applicableUsers users for which to mount the storage
131
-	 * @param array $applicableGroups groups for which to mount the storage
132
-	 * @param int $priority priority
133
-	 * @param bool $testOnly whether to storage should only test the connection or do more things
134
-	 *
135
-	 * @return DataResponse
136
-	 */
137
-	public function update(
138
-		$id,
139
-		$mountPoint,
140
-		$backend,
141
-		$authMechanism,
142
-		$backendOptions,
143
-		$mountOptions,
144
-		$applicableUsers,
145
-		$applicableGroups,
146
-		$priority,
147
-		$testOnly = true
148
-	) {
149
-		$storage = $this->createStorage(
150
-			$mountPoint,
151
-			$backend,
152
-			$authMechanism,
153
-			$backendOptions,
154
-			$mountOptions,
155
-			$applicableUsers,
156
-			$applicableGroups,
157
-			$priority
158
-		);
159
-		if ($storage instanceof DataResponse) {
160
-			return $storage;
161
-		}
162
-		$storage->setId($id);
121
+    /**
122
+     * Update an external storage entry.
123
+     *
124
+     * @param int $id storage id
125
+     * @param string $mountPoint storage mount point
126
+     * @param string $backend backend identifier
127
+     * @param string $authMechanism authentication mechansim identifier
128
+     * @param array $backendOptions backend-specific options
129
+     * @param array $mountOptions mount-specific options
130
+     * @param array $applicableUsers users for which to mount the storage
131
+     * @param array $applicableGroups groups for which to mount the storage
132
+     * @param int $priority priority
133
+     * @param bool $testOnly whether to storage should only test the connection or do more things
134
+     *
135
+     * @return DataResponse
136
+     */
137
+    public function update(
138
+        $id,
139
+        $mountPoint,
140
+        $backend,
141
+        $authMechanism,
142
+        $backendOptions,
143
+        $mountOptions,
144
+        $applicableUsers,
145
+        $applicableGroups,
146
+        $priority,
147
+        $testOnly = true
148
+    ) {
149
+        $storage = $this->createStorage(
150
+            $mountPoint,
151
+            $backend,
152
+            $authMechanism,
153
+            $backendOptions,
154
+            $mountOptions,
155
+            $applicableUsers,
156
+            $applicableGroups,
157
+            $priority
158
+        );
159
+        if ($storage instanceof DataResponse) {
160
+            return $storage;
161
+        }
162
+        $storage->setId($id);
163 163
 
164
-		$response = $this->validate($storage);
165
-		if (!empty($response)) {
166
-			return $response;
167
-		}
164
+        $response = $this->validate($storage);
165
+        if (!empty($response)) {
166
+            return $response;
167
+        }
168 168
 
169
-		try {
170
-			$storage = $this->service->updateStorage($storage);
171
-		} catch (NotFoundException $e) {
172
-			return new DataResponse(
173
-				[
174
-					'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id])
175
-				],
176
-				Http::STATUS_NOT_FOUND
177
-			);
178
-		}
169
+        try {
170
+            $storage = $this->service->updateStorage($storage);
171
+        } catch (NotFoundException $e) {
172
+            return new DataResponse(
173
+                [
174
+                    'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id])
175
+                ],
176
+                Http::STATUS_NOT_FOUND
177
+            );
178
+        }
179 179
 
180
-		$this->updateStorageStatus($storage, $testOnly);
180
+        $this->updateStorageStatus($storage, $testOnly);
181 181
 
182
-		return new DataResponse(
183
-			$this->formatStorageForUI($storage),
184
-			Http::STATUS_OK
185
-		);
186
-	}
182
+        return new DataResponse(
183
+            $this->formatStorageForUI($storage),
184
+            Http::STATUS_OK
185
+        );
186
+    }
187 187
 }
Please login to merge, or discard this patch.
lib/private/App/AppStore/Bundles/EducationBundle.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 	 * {@inheritDoc}
28 28
 	 */
29 29
 	public function getName() {
30
-		return (string)$this->l10n->t('Education Edition');
30
+		return (string) $this->l10n->t('Education Edition');
31 31
 	}
32 32
 
33 33
 	/**
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -25,27 +25,27 @@
 block discarded – undo
25 25
 
26 26
 class EducationBundle extends Bundle {
27 27
 
28
-	/**
29
-	 * {@inheritDoc}
30
-	 */
31
-	public function getName() {
32
-		return (string)$this->l10n->t('Education Edition');
33
-	}
28
+    /**
29
+     * {@inheritDoc}
30
+     */
31
+    public function getName() {
32
+        return (string)$this->l10n->t('Education Edition');
33
+    }
34 34
 
35
-	/**
36
-	 * {@inheritDoc}
37
-	 */
38
-	public function getAppIdentifiers() {
39
-		return [
40
-			'zenodo',
41
-			'dashboard',
42
-			'circles',
43
-			'groupfolders',
44
-			'announcementcenter',
45
-			'quota_warning',
46
-			'orcid',
47
-			'user_saml',
48
-		];
49
-	}
35
+    /**
36
+     * {@inheritDoc}
37
+     */
38
+    public function getAppIdentifiers() {
39
+        return [
40
+            'zenodo',
41
+            'dashboard',
42
+            'circles',
43
+            'groupfolders',
44
+            'announcementcenter',
45
+            'quota_warning',
46
+            'orcid',
47
+            'user_saml',
48
+        ];
49
+    }
50 50
 
51 51
 }
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 use OC\DB\QueryBuilder\QueryFunction;
25 25
 
26 26
 class PgSqlFunctionBuilder extends FunctionBuilder {
27
-	public function concat($x, $y) {
28
-		return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')');
29
-	}
27
+    public function concat($x, $y) {
28
+        return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')');
29
+    }
30 30
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
25 25
 
26 26
 class PgSqlFunctionBuilder extends FunctionBuilder {
27 27
 	public function concat($x, $y) {
28
-		return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')');
28
+		return new QueryFunction('('.$this->helper->quoteColumnName($x).' || '.$this->helper->quoteColumnName($y).')');
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Activity/Settings/RemoteShare.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,72 +27,72 @@
 block discarded – undo
27 27
 
28 28
 class RemoteShare implements ISetting {
29 29
 
30
-	/** @var IL10N */
31
-	protected $l;
30
+    /** @var IL10N */
31
+    protected $l;
32 32
 
33
-	/**
34
-	 * @param IL10N $l
35
-	 */
36
-	public function __construct(IL10N $l) {
37
-		$this->l = $l;
38
-	}
33
+    /**
34
+     * @param IL10N $l
35
+     */
36
+    public function __construct(IL10N $l) {
37
+        $this->l = $l;
38
+    }
39 39
 
40
-	/**
41
-	 * @return string Lowercase a-z and underscore only identifier
42
-	 * @since 11.0.0
43
-	 */
44
-	public function getIdentifier() {
45
-		return 'remote_share';
46
-	}
40
+    /**
41
+     * @return string Lowercase a-z and underscore only identifier
42
+     * @since 11.0.0
43
+     */
44
+    public function getIdentifier() {
45
+        return 'remote_share';
46
+    }
47 47
 
48
-	/**
49
-	 * @return string A translated string
50
-	 * @since 11.0.0
51
-	 */
52
-	public function getName() {
53
-		return $this->l->t('A file or folder was shared from <strong>another server</strong>');
54
-	}
48
+    /**
49
+     * @return string A translated string
50
+     * @since 11.0.0
51
+     */
52
+    public function getName() {
53
+        return $this->l->t('A file or folder was shared from <strong>another server</strong>');
54
+    }
55 55
 
56
-	/**
57
-	 * @return int whether the filter should be rather on the top or bottom of
58
-	 * the admin section. The filters are arranged in ascending order of the
59
-	 * priority values. It is required to return a value between 0 and 100.
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 11;
64
-	}
56
+    /**
57
+     * @return int whether the filter should be rather on the top or bottom of
58
+     * the admin section. The filters are arranged in ascending order of the
59
+     * priority values. It is required to return a value between 0 and 100.
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 11;
64
+    }
65 65
 
66
-	/**
67
-	 * @return bool True when the option can be changed for the stream
68
-	 * @since 11.0.0
69
-	 */
70
-	public function canChangeStream() {
71
-		return true;
72
-	}
66
+    /**
67
+     * @return bool True when the option can be changed for the stream
68
+     * @since 11.0.0
69
+     */
70
+    public function canChangeStream() {
71
+        return true;
72
+    }
73 73
 
74
-	/**
75
-	 * @return bool True when the option can be changed for the stream
76
-	 * @since 11.0.0
77
-	 */
78
-	public function isDefaultEnabledStream() {
79
-		return true;
80
-	}
74
+    /**
75
+     * @return bool True when the option can be changed for the stream
76
+     * @since 11.0.0
77
+     */
78
+    public function isDefaultEnabledStream() {
79
+        return true;
80
+    }
81 81
 
82
-	/**
83
-	 * @return bool True when the option can be changed for the mail
84
-	 * @since 11.0.0
85
-	 */
86
-	public function canChangeMail() {
87
-		return true;
88
-	}
82
+    /**
83
+     * @return bool True when the option can be changed for the mail
84
+     * @since 11.0.0
85
+     */
86
+    public function canChangeMail() {
87
+        return true;
88
+    }
89 89
 
90
-	/**
91
-	 * @return bool True when the option can be changed for the stream
92
-	 * @since 11.0.0
93
-	 */
94
-	public function isDefaultEnabledMail() {
95
-		return false;
96
-	}
90
+    /**
91
+     * @return bool True when the option can be changed for the stream
92
+     * @since 11.0.0
93
+     */
94
+    public function isDefaultEnabledMail() {
95
+        return false;
96
+    }
97 97
 }
98 98
 
Please login to merge, or discard this patch.
apps/files_sharing/lib/Activity/Settings/Shared.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,72 +27,72 @@
 block discarded – undo
27 27
 
28 28
 class Shared implements ISetting {
29 29
 
30
-	/** @var IL10N */
31
-	protected $l;
30
+    /** @var IL10N */
31
+    protected $l;
32 32
 
33
-	/**
34
-	 * @param IL10N $l
35
-	 */
36
-	public function __construct(IL10N $l) {
37
-		$this->l = $l;
38
-	}
33
+    /**
34
+     * @param IL10N $l
35
+     */
36
+    public function __construct(IL10N $l) {
37
+        $this->l = $l;
38
+    }
39 39
 
40
-	/**
41
-	 * @return string Lowercase a-z and underscore only identifier
42
-	 * @since 11.0.0
43
-	 */
44
-	public function getIdentifier() {
45
-		return 'shared';
46
-	}
40
+    /**
41
+     * @return string Lowercase a-z and underscore only identifier
42
+     * @since 11.0.0
43
+     */
44
+    public function getIdentifier() {
45
+        return 'shared';
46
+    }
47 47
 
48
-	/**
49
-	 * @return string A translated string
50
-	 * @since 11.0.0
51
-	 */
52
-	public function getName() {
53
-		return $this->l->t('A file or folder has been <strong>shared</strong>');
54
-	}
48
+    /**
49
+     * @return string A translated string
50
+     * @since 11.0.0
51
+     */
52
+    public function getName() {
53
+        return $this->l->t('A file or folder has been <strong>shared</strong>');
54
+    }
55 55
 
56
-	/**
57
-	 * @return int whether the filter should be rather on the top or bottom of
58
-	 * the admin section. The filters are arranged in ascending order of the
59
-	 * priority values. It is required to return a value between 0 and 100.
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 10;
64
-	}
56
+    /**
57
+     * @return int whether the filter should be rather on the top or bottom of
58
+     * the admin section. The filters are arranged in ascending order of the
59
+     * priority values. It is required to return a value between 0 and 100.
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 10;
64
+    }
65 65
 
66
-	/**
67
-	 * @return bool True when the option can be changed for the stream
68
-	 * @since 11.0.0
69
-	 */
70
-	public function canChangeStream() {
71
-		return true;
72
-	}
66
+    /**
67
+     * @return bool True when the option can be changed for the stream
68
+     * @since 11.0.0
69
+     */
70
+    public function canChangeStream() {
71
+        return true;
72
+    }
73 73
 
74
-	/**
75
-	 * @return bool True when the option can be changed for the stream
76
-	 * @since 11.0.0
77
-	 */
78
-	public function isDefaultEnabledStream() {
79
-		return true;
80
-	}
74
+    /**
75
+     * @return bool True when the option can be changed for the stream
76
+     * @since 11.0.0
77
+     */
78
+    public function isDefaultEnabledStream() {
79
+        return true;
80
+    }
81 81
 
82
-	/**
83
-	 * @return bool True when the option can be changed for the mail
84
-	 * @since 11.0.0
85
-	 */
86
-	public function canChangeMail() {
87
-		return true;
88
-	}
82
+    /**
83
+     * @return bool True when the option can be changed for the mail
84
+     * @since 11.0.0
85
+     */
86
+    public function canChangeMail() {
87
+        return true;
88
+    }
89 89
 
90
-	/**
91
-	 * @return bool True when the option can be changed for the stream
92
-	 * @since 11.0.0
93
-	 */
94
-	public function isDefaultEnabledMail() {
95
-		return false;
96
-	}
90
+    /**
91
+     * @return bool True when the option can be changed for the stream
92
+     * @since 11.0.0
93
+     */
94
+    public function isDefaultEnabledMail() {
95
+        return false;
96
+    }
97 97
 }
98 98
 
Please login to merge, or discard this patch.
lib/private/Files/ObjectStore/S3.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,18 +24,18 @@
 block discarded – undo
24 24
 use OCP\Files\ObjectStore\IObjectStore;
25 25
 
26 26
 class S3 implements IObjectStore {
27
-	use S3ConnectionTrait;
28
-	use S3ObjectTrait;
27
+    use S3ConnectionTrait;
28
+    use S3ObjectTrait;
29 29
 
30
-	public function __construct($parameters) {
31
-		$this->parseParams($parameters);
32
-	}
30
+    public function __construct($parameters) {
31
+        $this->parseParams($parameters);
32
+    }
33 33
 
34
-	/**
35
-	 * @return string the container or bucket name where objects are stored
36
-	 * @since 7.0.0
37
-	 */
38
-	public function getStorageId() {
39
-		return $this->id;
40
-	}
34
+    /**
35
+     * @return string the container or bucket name where objects are stored
36
+     * @since 7.0.0
37
+     */
38
+    public function getStorageId() {
39
+        return $this->id;
40
+    }
41 41
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,43 +11,43 @@
 block discarded – undo
11 11
 use OCP\Share\IManager;
12 12
 
13 13
 class OCSShareAPIMiddleware extends Middleware {
14
-	/** @var IManager */
15
-	private $shareManager;
16
-	/** @var IL10N */
17
-	private $l;
14
+    /** @var IManager */
15
+    private $shareManager;
16
+    /** @var IL10N */
17
+    private $l;
18 18
 
19
-	public function __construct(IManager $shareManager,
20
-								IL10N $l) {
21
-		$this->shareManager = $shareManager;
22
-		$this->l = $l;
23
-	}
19
+    public function __construct(IManager $shareManager,
20
+                                IL10N $l) {
21
+        $this->shareManager = $shareManager;
22
+        $this->l = $l;
23
+    }
24 24
 
25
-	/**
26
-	 * @param Controller $controller
27
-	 * @param string $methodName
28
-	 *
29
-	 * @throws OCSNotFoundException
30
-	 */
31
-	public function beforeController($controller, $methodName) {
32
-		if ($controller instanceof ShareAPIController) {
33
-			if (!$this->shareManager->shareApiEnabled()) {
34
-				throw new OCSNotFoundException($this->l->t('Share API is disabled'));
35
-			}
36
-		}
37
-	}
25
+    /**
26
+     * @param Controller $controller
27
+     * @param string $methodName
28
+     *
29
+     * @throws OCSNotFoundException
30
+     */
31
+    public function beforeController($controller, $methodName) {
32
+        if ($controller instanceof ShareAPIController) {
33
+            if (!$this->shareManager->shareApiEnabled()) {
34
+                throw new OCSNotFoundException($this->l->t('Share API is disabled'));
35
+            }
36
+        }
37
+    }
38 38
 
39
-	/**
40
-	 * @param Controller $controller
41
-	 * @param string $methodName
42
-	 * @param Response $response
43
-	 * @return Response
44
-	 */
45
-	public function afterController($controller, $methodName, Response $response) {
46
-		if ($controller instanceof ShareAPIController) {
47
-			/** @var ShareAPIController $controller */
48
-			$controller->cleanup();
49
-		}
39
+    /**
40
+     * @param Controller $controller
41
+     * @param string $methodName
42
+     * @param Response $response
43
+     * @return Response
44
+     */
45
+    public function afterController($controller, $methodName, Response $response) {
46
+        if ($controller instanceof ShareAPIController) {
47
+            /** @var ShareAPIController $controller */
48
+            $controller->cleanup();
49
+        }
50 50
 
51
-		return $response;
52
-	}
51
+        return $response;
52
+    }
53 53
 }
Please login to merge, or discard this patch.
apps/federation/lib/DbHandler.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 		$result = $query->execute();
88 88
 
89 89
 		if ($result) {
90
-			return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable);
90
+			return (int) $this->connection->lastInsertId('*PREFIX*'.$this->dbTable);
91 91
 		}
92 92
 
93
-		$message = 'Internal failure, Could not add trusted server: ' . $url;
93
+		$message = 'Internal failure, Could not add trusted server: '.$url;
94 94
 		$message_t = $this->IL10N->t('Could not add server');
95 95
 		throw new HintException($message, $message_t);
96 96
 	}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		$result = $query->execute()->fetchAll();
125 125
 
126 126
 		if (empty($result)) {
127
-			throw new \Exception('No Server found with ID: ' . $id);
127
+			throw new \Exception('No Server found with ID: '.$id);
128 128
 		}
129 129
 
130 130
 		return $result[0];
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		$statement->closeCursor();
202 202
 
203 203
 		if (!isset($result['token'])) {
204
-			throw new \Exception('No token found for: ' . $url);
204
+			throw new \Exception('No token found for: '.$url);
205 205
 		}
206 206
 
207 207
 		return $result['token'];
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		$statement = $query->execute();
279 279
 		$result = $statement->fetch();
280 280
 		$statement->closeCursor();
281
-		return (int)$result['status'];
281
+		return (int) $result['status'];
282 282
 	}
283 283
 
284 284
 	/**
Please login to merge, or discard this patch.
Indentation   +289 added lines, -289 removed lines patch added patch discarded remove patch
@@ -41,294 +41,294 @@
 block discarded – undo
41 41
  */
42 42
 class DbHandler {
43 43
 
44
-	/** @var  IDBConnection */
45
-	private $connection;
46
-
47
-	/** @var  IL10N */
48
-	private $IL10N;
49
-
50
-	/** @var string  */
51
-	private $dbTable = 'trusted_servers';
52
-
53
-	/**
54
-	 * @param IDBConnection $connection
55
-	 * @param IL10N $il10n
56
-	 */
57
-	public function __construct(
58
-		IDBConnection $connection,
59
-		IL10N $il10n
60
-	) {
61
-		$this->connection = $connection;
62
-		$this->IL10N = $il10n;
63
-	}
64
-
65
-	/**
66
-	 * add server to the list of trusted servers
67
-	 *
68
-	 * @param string $url
69
-	 * @return int
70
-	 * @throws HintException
71
-	 */
72
-	public function addServer($url) {
73
-		$hash = $this->hash($url);
74
-		$url = rtrim($url, '/');
75
-		$query = $this->connection->getQueryBuilder();
76
-		$query->insert($this->dbTable)
77
-			->values(
78
-				[
79
-					'url' =>  $query->createParameter('url'),
80
-					'url_hash' => $query->createParameter('url_hash'),
81
-				]
82
-			)
83
-			->setParameter('url', $url)
84
-			->setParameter('url_hash', $hash);
85
-
86
-		$result = $query->execute();
87
-
88
-		if ($result) {
89
-			return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable);
90
-		}
91
-
92
-		$message = 'Internal failure, Could not add trusted server: ' . $url;
93
-		$message_t = $this->IL10N->t('Could not add server');
94
-		throw new HintException($message, $message_t);
95
-	}
96
-
97
-	/**
98
-	 * remove server from the list of trusted servers
99
-	 *
100
-	 * @param int $id
101
-	 */
102
-	public function removeServer($id) {
103
-		$query = $this->connection->getQueryBuilder();
104
-		$query->delete($this->dbTable)
105
-			->where($query->expr()->eq('id', $query->createParameter('id')))
106
-			->setParameter('id', $id);
107
-		$query->execute();
108
-	}
109
-
110
-	/**
111
-	 * get trusted server with given ID
112
-	 *
113
-	 * @param int $id
114
-	 * @return array
115
-	 * @throws \Exception
116
-	 */
117
-	public function getServerById($id) {
118
-		$query = $this->connection->getQueryBuilder();
119
-		$query->select('*')->from($this->dbTable)
120
-			->where($query->expr()->eq('id', $query->createParameter('id')))
121
-			->setParameter('id', $id);
122
-		$query->execute();
123
-		$result = $query->execute()->fetchAll();
124
-
125
-		if (empty($result)) {
126
-			throw new \Exception('No Server found with ID: ' . $id);
127
-		}
128
-
129
-		return $result[0];
130
-	}
131
-
132
-	/**
133
-	 * get all trusted servers
134
-	 *
135
-	 * @return array
136
-	 */
137
-	public function getAllServer() {
138
-		$query = $this->connection->getQueryBuilder();
139
-		$query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token'])
140
-			->from($this->dbTable);
141
-		$statement = $query->execute();
142
-		$result = $statement->fetchAll();
143
-		$statement->closeCursor();
144
-		return $result;
145
-	}
146
-
147
-	/**
148
-	 * check if server already exists in the database table
149
-	 *
150
-	 * @param string $url
151
-	 * @return bool
152
-	 */
153
-	public function serverExists($url) {
154
-		$hash = $this->hash($url);
155
-		$query = $this->connection->getQueryBuilder();
156
-		$query->select('url')
157
-			->from($this->dbTable)
158
-			->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
159
-			->setParameter('url_hash', $hash);
160
-		$statement = $query->execute();
161
-		$result = $statement->fetchAll();
162
-		$statement->closeCursor();
163
-
164
-		return !empty($result);
165
-	}
166
-
167
-	/**
168
-	 * write token to database. Token is used to exchange the secret
169
-	 *
170
-	 * @param string $url
171
-	 * @param string $token
172
-	 */
173
-	public function addToken($url, $token) {
174
-		$hash = $this->hash($url);
175
-		$query = $this->connection->getQueryBuilder();
176
-		$query->update($this->dbTable)
177
-			->set('token', $query->createParameter('token'))
178
-			->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
179
-			->setParameter('url_hash', $hash)
180
-			->setParameter('token', $token);
181
-		$query->execute();
182
-	}
183
-
184
-	/**
185
-	 * get token stored in database
186
-	 *
187
-	 * @param string $url
188
-	 * @return string
189
-	 * @throws \Exception
190
-	 */
191
-	public function getToken($url) {
192
-		$hash = $this->hash($url);
193
-		$query = $this->connection->getQueryBuilder();
194
-		$query->select('token')->from($this->dbTable)
195
-			->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
196
-			->setParameter('url_hash', $hash);
197
-
198
-		$statement = $query->execute();
199
-		$result = $statement->fetch();
200
-		$statement->closeCursor();
201
-
202
-		if (!isset($result['token'])) {
203
-			throw new \Exception('No token found for: ' . $url);
204
-		}
205
-
206
-		return $result['token'];
207
-	}
208
-
209
-	/**
210
-	 * add shared Secret to database
211
-	 *
212
-	 * @param string $url
213
-	 * @param string $sharedSecret
214
-	 */
215
-	public function addSharedSecret($url, $sharedSecret) {
216
-		$hash = $this->hash($url);
217
-		$query = $this->connection->getQueryBuilder();
218
-		$query->update($this->dbTable)
219
-			->set('shared_secret', $query->createParameter('sharedSecret'))
220
-			->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
221
-			->setParameter('url_hash', $hash)
222
-			->setParameter('sharedSecret', $sharedSecret);
223
-		$query->execute();
224
-	}
225
-
226
-	/**
227
-	 * get shared secret from database
228
-	 *
229
-	 * @param string $url
230
-	 * @return string
231
-	 */
232
-	public function getSharedSecret($url) {
233
-		$hash = $this->hash($url);
234
-		$query = $this->connection->getQueryBuilder();
235
-		$query->select('shared_secret')->from($this->dbTable)
236
-			->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
237
-			->setParameter('url_hash', $hash);
238
-
239
-		$statement = $query->execute();
240
-		$result = $statement->fetch();
241
-		$statement->closeCursor();
242
-		return $result['shared_secret'];
243
-	}
244
-
245
-	/**
246
-	 * set server status
247
-	 *
248
-	 * @param string $url
249
-	 * @param int $status
250
-	 * @param string|null $token
251
-	 */
252
-	public function setServerStatus($url, $status, $token = null) {
253
-		$hash = $this->hash($url);
254
-		$query = $this->connection->getQueryBuilder();
255
-		$query->update($this->dbTable)
256
-				->set('status', $query->createNamedParameter($status))
257
-				->where($query->expr()->eq('url_hash', $query->createNamedParameter($hash)));
258
-		if (!is_null($token)) {
259
-			$query->set('sync_token', $query->createNamedParameter($token));
260
-		}
261
-		$query->execute();
262
-	}
263
-
264
-	/**
265
-	 * get server status
266
-	 *
267
-	 * @param string $url
268
-	 * @return int
269
-	 */
270
-	public function getServerStatus($url) {
271
-		$hash = $this->hash($url);
272
-		$query = $this->connection->getQueryBuilder();
273
-		$query->select('status')->from($this->dbTable)
274
-				->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
275
-				->setParameter('url_hash', $hash);
276
-
277
-		$statement = $query->execute();
278
-		$result = $statement->fetch();
279
-		$statement->closeCursor();
280
-		return (int)$result['status'];
281
-	}
282
-
283
-	/**
284
-	 * create hash from URL
285
-	 *
286
-	 * @param string $url
287
-	 * @return string
288
-	 */
289
-	protected function hash($url) {
290
-		$normalized = $this->normalizeUrl($url);
291
-		return sha1($normalized);
292
-	}
293
-
294
-	/**
295
-	 * normalize URL, used to create the sha1 hash
296
-	 *
297
-	 * @param string $url
298
-	 * @return string
299
-	 */
300
-	protected function normalizeUrl($url) {
301
-		$normalized = $url;
302
-
303
-		if (strpos($url, 'https://') === 0) {
304
-			$normalized = substr($url, strlen('https://'));
305
-		} elseif (strpos($url, 'http://') === 0) {
306
-			$normalized = substr($url, strlen('http://'));
307
-		}
308
-
309
-		$normalized = Filesystem::normalizePath($normalized);
310
-		$normalized = trim($normalized, '/');
311
-
312
-		return $normalized;
313
-	}
314
-
315
-	/**
316
-	 * @param $username
317
-	 * @param $password
318
-	 * @return bool
319
-	 */
320
-	public function auth($username, $password) {
321
-		if ($username !== 'system') {
322
-			return false;
323
-		}
324
-		$query = $this->connection->getQueryBuilder();
325
-		$query->select('url')->from($this->dbTable)
326
-				->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password)));
327
-
328
-		$statement = $query->execute();
329
-		$result = $statement->fetch();
330
-		$statement->closeCursor();
331
-		return !empty($result);
332
-	}
44
+    /** @var  IDBConnection */
45
+    private $connection;
46
+
47
+    /** @var  IL10N */
48
+    private $IL10N;
49
+
50
+    /** @var string  */
51
+    private $dbTable = 'trusted_servers';
52
+
53
+    /**
54
+     * @param IDBConnection $connection
55
+     * @param IL10N $il10n
56
+     */
57
+    public function __construct(
58
+        IDBConnection $connection,
59
+        IL10N $il10n
60
+    ) {
61
+        $this->connection = $connection;
62
+        $this->IL10N = $il10n;
63
+    }
64
+
65
+    /**
66
+     * add server to the list of trusted servers
67
+     *
68
+     * @param string $url
69
+     * @return int
70
+     * @throws HintException
71
+     */
72
+    public function addServer($url) {
73
+        $hash = $this->hash($url);
74
+        $url = rtrim($url, '/');
75
+        $query = $this->connection->getQueryBuilder();
76
+        $query->insert($this->dbTable)
77
+            ->values(
78
+                [
79
+                    'url' =>  $query->createParameter('url'),
80
+                    'url_hash' => $query->createParameter('url_hash'),
81
+                ]
82
+            )
83
+            ->setParameter('url', $url)
84
+            ->setParameter('url_hash', $hash);
85
+
86
+        $result = $query->execute();
87
+
88
+        if ($result) {
89
+            return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable);
90
+        }
91
+
92
+        $message = 'Internal failure, Could not add trusted server: ' . $url;
93
+        $message_t = $this->IL10N->t('Could not add server');
94
+        throw new HintException($message, $message_t);
95
+    }
96
+
97
+    /**
98
+     * remove server from the list of trusted servers
99
+     *
100
+     * @param int $id
101
+     */
102
+    public function removeServer($id) {
103
+        $query = $this->connection->getQueryBuilder();
104
+        $query->delete($this->dbTable)
105
+            ->where($query->expr()->eq('id', $query->createParameter('id')))
106
+            ->setParameter('id', $id);
107
+        $query->execute();
108
+    }
109
+
110
+    /**
111
+     * get trusted server with given ID
112
+     *
113
+     * @param int $id
114
+     * @return array
115
+     * @throws \Exception
116
+     */
117
+    public function getServerById($id) {
118
+        $query = $this->connection->getQueryBuilder();
119
+        $query->select('*')->from($this->dbTable)
120
+            ->where($query->expr()->eq('id', $query->createParameter('id')))
121
+            ->setParameter('id', $id);
122
+        $query->execute();
123
+        $result = $query->execute()->fetchAll();
124
+
125
+        if (empty($result)) {
126
+            throw new \Exception('No Server found with ID: ' . $id);
127
+        }
128
+
129
+        return $result[0];
130
+    }
131
+
132
+    /**
133
+     * get all trusted servers
134
+     *
135
+     * @return array
136
+     */
137
+    public function getAllServer() {
138
+        $query = $this->connection->getQueryBuilder();
139
+        $query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token'])
140
+            ->from($this->dbTable);
141
+        $statement = $query->execute();
142
+        $result = $statement->fetchAll();
143
+        $statement->closeCursor();
144
+        return $result;
145
+    }
146
+
147
+    /**
148
+     * check if server already exists in the database table
149
+     *
150
+     * @param string $url
151
+     * @return bool
152
+     */
153
+    public function serverExists($url) {
154
+        $hash = $this->hash($url);
155
+        $query = $this->connection->getQueryBuilder();
156
+        $query->select('url')
157
+            ->from($this->dbTable)
158
+            ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
159
+            ->setParameter('url_hash', $hash);
160
+        $statement = $query->execute();
161
+        $result = $statement->fetchAll();
162
+        $statement->closeCursor();
163
+
164
+        return !empty($result);
165
+    }
166
+
167
+    /**
168
+     * write token to database. Token is used to exchange the secret
169
+     *
170
+     * @param string $url
171
+     * @param string $token
172
+     */
173
+    public function addToken($url, $token) {
174
+        $hash = $this->hash($url);
175
+        $query = $this->connection->getQueryBuilder();
176
+        $query->update($this->dbTable)
177
+            ->set('token', $query->createParameter('token'))
178
+            ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
179
+            ->setParameter('url_hash', $hash)
180
+            ->setParameter('token', $token);
181
+        $query->execute();
182
+    }
183
+
184
+    /**
185
+     * get token stored in database
186
+     *
187
+     * @param string $url
188
+     * @return string
189
+     * @throws \Exception
190
+     */
191
+    public function getToken($url) {
192
+        $hash = $this->hash($url);
193
+        $query = $this->connection->getQueryBuilder();
194
+        $query->select('token')->from($this->dbTable)
195
+            ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
196
+            ->setParameter('url_hash', $hash);
197
+
198
+        $statement = $query->execute();
199
+        $result = $statement->fetch();
200
+        $statement->closeCursor();
201
+
202
+        if (!isset($result['token'])) {
203
+            throw new \Exception('No token found for: ' . $url);
204
+        }
205
+
206
+        return $result['token'];
207
+    }
208
+
209
+    /**
210
+     * add shared Secret to database
211
+     *
212
+     * @param string $url
213
+     * @param string $sharedSecret
214
+     */
215
+    public function addSharedSecret($url, $sharedSecret) {
216
+        $hash = $this->hash($url);
217
+        $query = $this->connection->getQueryBuilder();
218
+        $query->update($this->dbTable)
219
+            ->set('shared_secret', $query->createParameter('sharedSecret'))
220
+            ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
221
+            ->setParameter('url_hash', $hash)
222
+            ->setParameter('sharedSecret', $sharedSecret);
223
+        $query->execute();
224
+    }
225
+
226
+    /**
227
+     * get shared secret from database
228
+     *
229
+     * @param string $url
230
+     * @return string
231
+     */
232
+    public function getSharedSecret($url) {
233
+        $hash = $this->hash($url);
234
+        $query = $this->connection->getQueryBuilder();
235
+        $query->select('shared_secret')->from($this->dbTable)
236
+            ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
237
+            ->setParameter('url_hash', $hash);
238
+
239
+        $statement = $query->execute();
240
+        $result = $statement->fetch();
241
+        $statement->closeCursor();
242
+        return $result['shared_secret'];
243
+    }
244
+
245
+    /**
246
+     * set server status
247
+     *
248
+     * @param string $url
249
+     * @param int $status
250
+     * @param string|null $token
251
+     */
252
+    public function setServerStatus($url, $status, $token = null) {
253
+        $hash = $this->hash($url);
254
+        $query = $this->connection->getQueryBuilder();
255
+        $query->update($this->dbTable)
256
+                ->set('status', $query->createNamedParameter($status))
257
+                ->where($query->expr()->eq('url_hash', $query->createNamedParameter($hash)));
258
+        if (!is_null($token)) {
259
+            $query->set('sync_token', $query->createNamedParameter($token));
260
+        }
261
+        $query->execute();
262
+    }
263
+
264
+    /**
265
+     * get server status
266
+     *
267
+     * @param string $url
268
+     * @return int
269
+     */
270
+    public function getServerStatus($url) {
271
+        $hash = $this->hash($url);
272
+        $query = $this->connection->getQueryBuilder();
273
+        $query->select('status')->from($this->dbTable)
274
+                ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
275
+                ->setParameter('url_hash', $hash);
276
+
277
+        $statement = $query->execute();
278
+        $result = $statement->fetch();
279
+        $statement->closeCursor();
280
+        return (int)$result['status'];
281
+    }
282
+
283
+    /**
284
+     * create hash from URL
285
+     *
286
+     * @param string $url
287
+     * @return string
288
+     */
289
+    protected function hash($url) {
290
+        $normalized = $this->normalizeUrl($url);
291
+        return sha1($normalized);
292
+    }
293
+
294
+    /**
295
+     * normalize URL, used to create the sha1 hash
296
+     *
297
+     * @param string $url
298
+     * @return string
299
+     */
300
+    protected function normalizeUrl($url) {
301
+        $normalized = $url;
302
+
303
+        if (strpos($url, 'https://') === 0) {
304
+            $normalized = substr($url, strlen('https://'));
305
+        } elseif (strpos($url, 'http://') === 0) {
306
+            $normalized = substr($url, strlen('http://'));
307
+        }
308
+
309
+        $normalized = Filesystem::normalizePath($normalized);
310
+        $normalized = trim($normalized, '/');
311
+
312
+        return $normalized;
313
+    }
314
+
315
+    /**
316
+     * @param $username
317
+     * @param $password
318
+     * @return bool
319
+     */
320
+    public function auth($username, $password) {
321
+        if ($username !== 'system') {
322
+            return false;
323
+        }
324
+        $query = $this->connection->getQueryBuilder();
325
+        $query->select('url')->from($this->dbTable)
326
+                ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password)));
327
+
328
+        $statement = $query->execute();
329
+        $result = $statement->fetch();
330
+        $statement->closeCursor();
331
+        return !empty($result);
332
+    }
333 333
 
334 334
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Migration/UUIDFixUser.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
 use OCP\IConfig;
31 31
 
32 32
 class UUIDFixUser extends UUIDFix {
33
-	public function __construct(UserMapping $mapper, LDAP $ldap, IConfig $config, Helper $helper) {
34
-		$this->mapper = $mapper;
35
-		$groupPluginManager = \OC::$server->query('LDAPGroupPluginManager');
36
-		$this->proxy = new Group_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $groupPluginManager);
37
-	}
33
+    public function __construct(UserMapping $mapper, LDAP $ldap, IConfig $config, Helper $helper) {
34
+        $this->mapper = $mapper;
35
+        $groupPluginManager = \OC::$server->query('LDAPGroupPluginManager');
36
+        $this->proxy = new Group_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $groupPluginManager);
37
+    }
38 38
 }
Please login to merge, or discard this patch.