Passed
Push — master ( da9ad9...c724eb )
by Roeland
13:33 queued 01:55
created
lib/public/Http/Client/IClient.php 1 patch
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -32,178 +32,178 @@
 block discarded – undo
32 32
  */
33 33
 interface IClient {
34 34
 
35
-	/**
36
-	 * Sends a GET request
37
-	 * @param string $uri
38
-	 * @param array $options Array such as
39
-	 *              'query' => [
40
-	 *                  'field' => 'abc',
41
-	 *                  'other_field' => '123',
42
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
43
-	 *              ],
44
-	 *              'headers' => [
45
-	 *                  'foo' => 'bar',
46
-	 *              ],
47
-	 *              'cookies' => ['
48
-	 *                  'foo' => 'bar',
49
-	 *              ],
50
-	 *              'allow_redirects' => [
51
-	 *                   'max'       => 10,  // allow at most 10 redirects.
52
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
53
-	 *                   'referer'   => true,     // add a Referer header
54
-	 *                   'protocols' => ['https'] // only allow https URLs
55
-	 *              ],
56
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
57
-	 *              'verify' => true, // bool or string to CA file
58
-	 *              'debug' => true,
59
-	 * @return IResponse
60
-	 * @throws \Exception If the request could not get completed
61
-	 * @since 8.1.0
62
-	 */
63
-	public function get(string $uri, array $options = []): IResponse;
35
+    /**
36
+     * Sends a GET request
37
+     * @param string $uri
38
+     * @param array $options Array such as
39
+     *              'query' => [
40
+     *                  'field' => 'abc',
41
+     *                  'other_field' => '123',
42
+     *                  'file_name' => fopen('/path/to/file', 'r'),
43
+     *              ],
44
+     *              'headers' => [
45
+     *                  'foo' => 'bar',
46
+     *              ],
47
+     *              'cookies' => ['
48
+     *                  'foo' => 'bar',
49
+     *              ],
50
+     *              'allow_redirects' => [
51
+     *                   'max'       => 10,  // allow at most 10 redirects.
52
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
53
+     *                   'referer'   => true,     // add a Referer header
54
+     *                   'protocols' => ['https'] // only allow https URLs
55
+     *              ],
56
+     *              'save_to' => '/path/to/file', // save to a file or a stream
57
+     *              'verify' => true, // bool or string to CA file
58
+     *              'debug' => true,
59
+     * @return IResponse
60
+     * @throws \Exception If the request could not get completed
61
+     * @since 8.1.0
62
+     */
63
+    public function get(string $uri, array $options = []): IResponse;
64 64
 
65
-	/**
66
-	 * Sends a HEAD request
67
-	 * @param string $uri
68
-	 * @param array $options Array such as
69
-	 *              'headers' => [
70
-	 *                  'foo' => 'bar',
71
-	 *              ],
72
-	 *              'cookies' => ['
73
-	 *                  'foo' => 'bar',
74
-	 *              ],
75
-	 *              'allow_redirects' => [
76
-	 *                   'max'       => 10,  // allow at most 10 redirects.
77
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
78
-	 *                   'referer'   => true,     // add a Referer header
79
-	 *                   'protocols' => ['https'] // only allow https URLs
80
-	 *              ],
81
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
82
-	 *              'verify' => true, // bool or string to CA file
83
-	 *              'debug' => true,
84
-	 * @return IResponse
85
-	 * @throws \Exception If the request could not get completed
86
-	 * @since 8.1.0
87
-	 */
88
-	public function head(string $uri, array $options = []): IResponse;
65
+    /**
66
+     * Sends a HEAD request
67
+     * @param string $uri
68
+     * @param array $options Array such as
69
+     *              'headers' => [
70
+     *                  'foo' => 'bar',
71
+     *              ],
72
+     *              'cookies' => ['
73
+     *                  'foo' => 'bar',
74
+     *              ],
75
+     *              'allow_redirects' => [
76
+     *                   'max'       => 10,  // allow at most 10 redirects.
77
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
78
+     *                   'referer'   => true,     // add a Referer header
79
+     *                   'protocols' => ['https'] // only allow https URLs
80
+     *              ],
81
+     *              'save_to' => '/path/to/file', // save to a file or a stream
82
+     *              'verify' => true, // bool or string to CA file
83
+     *              'debug' => true,
84
+     * @return IResponse
85
+     * @throws \Exception If the request could not get completed
86
+     * @since 8.1.0
87
+     */
88
+    public function head(string $uri, array $options = []): IResponse;
89 89
 
90
-	/**
91
-	 * Sends a POST request
92
-	 * @param string $uri
93
-	 * @param array $options Array such as
94
-	 *              'body' => [
95
-	 *                  'field' => 'abc',
96
-	 *                  'other_field' => '123',
97
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
98
-	 *              ],
99
-	 *              'headers' => [
100
-	 *                  'foo' => 'bar',
101
-	 *              ],
102
-	 *              'cookies' => ['
103
-	 *                  'foo' => 'bar',
104
-	 *              ],
105
-	 *              'allow_redirects' => [
106
-	 *                   'max'       => 10,  // allow at most 10 redirects.
107
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
108
-	 *                   'referer'   => true,     // add a Referer header
109
-	 *                   'protocols' => ['https'] // only allow https URLs
110
-	 *              ],
111
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
112
-	 *              'verify' => true, // bool or string to CA file
113
-	 *              'debug' => true,
114
-	 * @return IResponse
115
-	 * @throws \Exception If the request could not get completed
116
-	 * @since 8.1.0
117
-	 */
118
-	public function post(string $uri, array $options = []): IResponse;
90
+    /**
91
+     * Sends a POST request
92
+     * @param string $uri
93
+     * @param array $options Array such as
94
+     *              'body' => [
95
+     *                  'field' => 'abc',
96
+     *                  'other_field' => '123',
97
+     *                  'file_name' => fopen('/path/to/file', 'r'),
98
+     *              ],
99
+     *              'headers' => [
100
+     *                  'foo' => 'bar',
101
+     *              ],
102
+     *              'cookies' => ['
103
+     *                  'foo' => 'bar',
104
+     *              ],
105
+     *              'allow_redirects' => [
106
+     *                   'max'       => 10,  // allow at most 10 redirects.
107
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
108
+     *                   'referer'   => true,     // add a Referer header
109
+     *                   'protocols' => ['https'] // only allow https URLs
110
+     *              ],
111
+     *              'save_to' => '/path/to/file', // save to a file or a stream
112
+     *              'verify' => true, // bool or string to CA file
113
+     *              'debug' => true,
114
+     * @return IResponse
115
+     * @throws \Exception If the request could not get completed
116
+     * @since 8.1.0
117
+     */
118
+    public function post(string $uri, array $options = []): IResponse;
119 119
 
120
-	/**
121
-	 * Sends a PUT request
122
-	 * @param string $uri
123
-	 * @param array $options Array such as
124
-	 *              'body' => [
125
-	 *                  'field' => 'abc',
126
-	 *                  'other_field' => '123',
127
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
128
-	 *              ],
129
-	 *              'headers' => [
130
-	 *                  'foo' => 'bar',
131
-	 *              ],
132
-	 *              'cookies' => ['
133
-	 *                  'foo' => 'bar',
134
-	 *              ],
135
-	 *              'allow_redirects' => [
136
-	 *                   'max'       => 10,  // allow at most 10 redirects.
137
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
138
-	 *                   'referer'   => true,     // add a Referer header
139
-	 *                   'protocols' => ['https'] // only allow https URLs
140
-	 *              ],
141
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
142
-	 *              'verify' => true, // bool or string to CA file
143
-	 *              'debug' => true,
144
-	 * @return IResponse
145
-	 * @throws \Exception If the request could not get completed
146
-	 * @since 8.1.0
147
-	 */
148
-	public function put(string $uri, array $options = []): IResponse;
120
+    /**
121
+     * Sends a PUT request
122
+     * @param string $uri
123
+     * @param array $options Array such as
124
+     *              'body' => [
125
+     *                  'field' => 'abc',
126
+     *                  'other_field' => '123',
127
+     *                  'file_name' => fopen('/path/to/file', 'r'),
128
+     *              ],
129
+     *              'headers' => [
130
+     *                  'foo' => 'bar',
131
+     *              ],
132
+     *              'cookies' => ['
133
+     *                  'foo' => 'bar',
134
+     *              ],
135
+     *              'allow_redirects' => [
136
+     *                   'max'       => 10,  // allow at most 10 redirects.
137
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
138
+     *                   'referer'   => true,     // add a Referer header
139
+     *                   'protocols' => ['https'] // only allow https URLs
140
+     *              ],
141
+     *              'save_to' => '/path/to/file', // save to a file or a stream
142
+     *              'verify' => true, // bool or string to CA file
143
+     *              'debug' => true,
144
+     * @return IResponse
145
+     * @throws \Exception If the request could not get completed
146
+     * @since 8.1.0
147
+     */
148
+    public function put(string $uri, array $options = []): IResponse;
149 149
 
150
-	/**
151
-	 * Sends a DELETE request
152
-	 * @param string $uri
153
-	 * @param array $options Array such as
154
-	 *              'body' => [
155
-	 *                  'field' => 'abc',
156
-	 *                  'other_field' => '123',
157
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
158
-	 *              ],
159
-	 *              'headers' => [
160
-	 *                  'foo' => 'bar',
161
-	 *              ],
162
-	 *              'cookies' => ['
163
-	 *                  'foo' => 'bar',
164
-	 *              ],
165
-	 *              'allow_redirects' => [
166
-	 *                   'max'       => 10,  // allow at most 10 redirects.
167
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
168
-	 *                   'referer'   => true,     // add a Referer header
169
-	 *                   'protocols' => ['https'] // only allow https URLs
170
-	 *              ],
171
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
172
-	 *              'verify' => true, // bool or string to CA file
173
-	 *              'debug' => true,
174
-	 * @return IResponse
175
-	 * @throws \Exception If the request could not get completed
176
-	 * @since 8.1.0
177
-	 */
178
-	public function delete(string $uri, array $options = []): IResponse;
150
+    /**
151
+     * Sends a DELETE request
152
+     * @param string $uri
153
+     * @param array $options Array such as
154
+     *              'body' => [
155
+     *                  'field' => 'abc',
156
+     *                  'other_field' => '123',
157
+     *                  'file_name' => fopen('/path/to/file', 'r'),
158
+     *              ],
159
+     *              'headers' => [
160
+     *                  'foo' => 'bar',
161
+     *              ],
162
+     *              'cookies' => ['
163
+     *                  'foo' => 'bar',
164
+     *              ],
165
+     *              'allow_redirects' => [
166
+     *                   'max'       => 10,  // allow at most 10 redirects.
167
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
168
+     *                   'referer'   => true,     // add a Referer header
169
+     *                   'protocols' => ['https'] // only allow https URLs
170
+     *              ],
171
+     *              'save_to' => '/path/to/file', // save to a file or a stream
172
+     *              'verify' => true, // bool or string to CA file
173
+     *              'debug' => true,
174
+     * @return IResponse
175
+     * @throws \Exception If the request could not get completed
176
+     * @since 8.1.0
177
+     */
178
+    public function delete(string $uri, array $options = []): IResponse;
179 179
 
180
-	/**
181
-	 * Sends a options request
182
-	 * @param string $uri
183
-	 * @param array $options Array such as
184
-	 *              'body' => [
185
-	 *                  'field' => 'abc',
186
-	 *                  'other_field' => '123',
187
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
188
-	 *              ],
189
-	 *              'headers' => [
190
-	 *                  'foo' => 'bar',
191
-	 *              ],
192
-	 *              'cookies' => ['
193
-	 *                  'foo' => 'bar',
194
-	 *              ],
195
-	 *              'allow_redirects' => [
196
-	 *                   'max'       => 10,  // allow at most 10 redirects.
197
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
198
-	 *                   'referer'   => true,     // add a Referer header
199
-	 *                   'protocols' => ['https'] // only allow https URLs
200
-	 *              ],
201
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
202
-	 *              'verify' => true, // bool or string to CA file
203
-	 *              'debug' => true,
204
-	 * @return IResponse
205
-	 * @throws \Exception If the request could not get completed
206
-	 * @since 8.1.0
207
-	 */
208
-	public function options(string $uri, array $options = []): IResponse;
180
+    /**
181
+     * Sends a options request
182
+     * @param string $uri
183
+     * @param array $options Array such as
184
+     *              'body' => [
185
+     *                  'field' => 'abc',
186
+     *                  'other_field' => '123',
187
+     *                  'file_name' => fopen('/path/to/file', 'r'),
188
+     *              ],
189
+     *              'headers' => [
190
+     *                  'foo' => 'bar',
191
+     *              ],
192
+     *              'cookies' => ['
193
+     *                  'foo' => 'bar',
194
+     *              ],
195
+     *              'allow_redirects' => [
196
+     *                   'max'       => 10,  // allow at most 10 redirects.
197
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
198
+     *                   'referer'   => true,     // add a Referer header
199
+     *                   'protocols' => ['https'] // only allow https URLs
200
+     *              ],
201
+     *              'save_to' => '/path/to/file', // save to a file or a stream
202
+     *              'verify' => true, // bool or string to CA file
203
+     *              'debug' => true,
204
+     * @return IResponse
205
+     * @throws \Exception If the request could not get completed
206
+     * @since 8.1.0
207
+     */
208
+    public function options(string $uri, array $options = []): IResponse;
209 209
 }
Please login to merge, or discard this patch.
lib/public/Http/Client/IClientService.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
  * @since 8.1.0
32 32
  */
33 33
 interface IClientService {
34
-	/**
35
-	 * @return IClient
36
-	 * @since 8.1.0
37
-	 */
38
-	public function newClient(): IClient;
34
+    /**
35
+     * @return IClient
36
+     * @since 8.1.0
37
+     */
38
+    public function newClient(): IClient;
39 39
 }
Please login to merge, or discard this patch.
lib/public/Http/Client/IResponse.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -32,28 +32,28 @@
 block discarded – undo
32 32
  * @since 8.1.0
33 33
  */
34 34
 interface IResponse {
35
-	/**
36
-	 * @return string|resource
37
-	 * @since 8.1.0
38
-	 */
39
-	public function getBody();
35
+    /**
36
+     * @return string|resource
37
+     * @since 8.1.0
38
+     */
39
+    public function getBody();
40 40
 
41
-	/**
42
-	 * @return int
43
-	 * @since 8.1.0
44
-	 */
45
-	public function getStatusCode(): int;
41
+    /**
42
+     * @return int
43
+     * @since 8.1.0
44
+     */
45
+    public function getStatusCode(): int;
46 46
 
47
-	/**
48
-	 * @param string $key
49
-	 * @return string
50
-	 * @since 8.1.0
51
-	 */
52
-	public function getHeader(string $key): string;
47
+    /**
48
+     * @param string $key
49
+     * @return string
50
+     * @since 8.1.0
51
+     */
52
+    public function getHeader(string $key): string;
53 53
 
54
-	/**
55
-	 * @return array
56
-	 * @since 8.1.0
57
-	 */
58
-	public function getHeaders(): array;
54
+    /**
55
+     * @return array
56
+     * @since 8.1.0
57
+     */
58
+    public function getHeaders(): array;
59 59
 }
Please login to merge, or discard this patch.
lib/public/Security/IHasher.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -45,23 +45,23 @@
 block discarded – undo
45 45
  * @since 8.0.0
46 46
  */
47 47
 interface IHasher {
48
-	/**
49
-	 * Hashes a message using PHP's `password_hash` functionality.
50
-	 * Please note that the size of the returned string is not guaranteed
51
-	 * and can be up to 255 characters.
52
-	 *
53
-	 * @param string $message Message to generate hash from
54
-	 * @return string Hash of the message with appended version parameter
55
-	 * @since 8.0.0
56
-	 */
57
-	public function hash(string $message): string;
48
+    /**
49
+     * Hashes a message using PHP's `password_hash` functionality.
50
+     * Please note that the size of the returned string is not guaranteed
51
+     * and can be up to 255 characters.
52
+     *
53
+     * @param string $message Message to generate hash from
54
+     * @return string Hash of the message with appended version parameter
55
+     * @since 8.0.0
56
+     */
57
+    public function hash(string $message): string;
58 58
 
59
-	/**
60
-	 * @param string $message Message to verify
61
-	 * @param string $hash Assumed hash of the message
62
-	 * @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one.
63
-	 * @return bool Whether $hash is a valid hash of $message
64
-	 * @since 8.0.0
65
-	 */
66
-	public function verify(string $message, string $hash, &$newHash = null): bool ;
59
+    /**
60
+     * @param string $message Message to verify
61
+     * @param string $hash Assumed hash of the message
62
+     * @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one.
63
+     * @return bool Whether $hash is a valid hash of $message
64
+     * @since 8.0.0
65
+     */
66
+    public function verify(string $message, string $hash, &$newHash = null): bool ;
67 67
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,5 +63,5 @@
 block discarded – undo
63 63
 	 * @return bool Whether $hash is a valid hash of $message
64 64
 	 * @since 8.0.0
65 65
 	 */
66
-	public function verify(string $message, string $hash, &$newHash = null): bool ;
66
+	public function verify(string $message, string $hash, &$newHash = null): bool;
67 67
 }
Please login to merge, or discard this patch.
lib/private/Memcache/Factory.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return IMemcache
134 134
 	 */
135 135
 	public function createLocking(string $prefix = ''): IMemcache {
136
-		return new $this->lockingCacheClass($this->globalPrefix . '/' . $prefix);
136
+		return new $this->lockingCacheClass($this->globalPrefix.'/'.$prefix);
137 137
 	}
138 138
 
139 139
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return ICache
144 144
 	 */
145 145
 	public function createDistributed(string $prefix = ''): ICache {
146
-		return new $this->distributedCacheClass($this->globalPrefix . '/' . $prefix);
146
+		return new $this->distributedCacheClass($this->globalPrefix.'/'.$prefix);
147 147
 	}
148 148
 
149 149
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @return ICache
154 154
 	 */
155 155
 	public function createLocal(string $prefix = ''): ICache {
156
-		return new $this->localCacheClass($this->globalPrefix . '/' . $prefix);
156
+		return new $this->localCacheClass($this->globalPrefix.'/'.$prefix);
157 157
 	}
158 158
 
159 159
 	/**
Please login to merge, or discard this patch.
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -36,158 +36,158 @@
 block discarded – undo
36 36
 use OCP\IMemcache;
37 37
 
38 38
 class Factory implements ICacheFactory {
39
-	public const NULL_CACHE = NullCache::class;
40
-
41
-	/**
42
-	 * @var string $globalPrefix
43
-	 */
44
-	private $globalPrefix;
45
-
46
-	/**
47
-	 * @var ILogger $logger
48
-	 */
49
-	private $logger;
50
-
51
-	/**
52
-	 * @var string $localCacheClass
53
-	 */
54
-	private $localCacheClass;
55
-
56
-	/**
57
-	 * @var string $distributedCacheClass
58
-	 */
59
-	private $distributedCacheClass;
60
-
61
-	/**
62
-	 * @var string $lockingCacheClass
63
-	 */
64
-	private $lockingCacheClass;
65
-
66
-	/**
67
-	 * @param string $globalPrefix
68
-	 * @param ILogger $logger
69
-	 * @param string|null $localCacheClass
70
-	 * @param string|null $distributedCacheClass
71
-	 * @param string|null $lockingCacheClass
72
-	 */
73
-	public function __construct(string $globalPrefix, ILogger $logger,
74
-		$localCacheClass = null, $distributedCacheClass = null, $lockingCacheClass = null) {
75
-		$this->logger = $logger;
76
-		$this->globalPrefix = $globalPrefix;
77
-
78
-		if (!$localCacheClass) {
79
-			$localCacheClass = self::NULL_CACHE;
80
-		}
81
-		if (!$distributedCacheClass) {
82
-			$distributedCacheClass = $localCacheClass;
83
-		}
84
-
85
-		$missingCacheMessage = 'Memcache {class} not available for {use} cache';
86
-		$missingCacheHint = 'Is the matching PHP module installed and enabled?';
87
-		if (!class_exists($localCacheClass) || !$localCacheClass::isAvailable()) {
88
-			if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
89
-				// CLI should not hard-fail on broken memcache
90
-				$this->logger->info($missingCacheMessage, [
91
-					'class' => $localCacheClass,
92
-					'use' => 'local',
93
-					'app' => 'cli'
94
-				]);
95
-				$localCacheClass = self::NULL_CACHE;
96
-			} else {
97
-				throw new \OC\HintException(strtr($missingCacheMessage, [
98
-					'{class}' => $localCacheClass, '{use}' => 'local'
99
-				]), $missingCacheHint);
100
-			}
101
-		}
102
-		if (!class_exists($distributedCacheClass) || !$distributedCacheClass::isAvailable()) {
103
-			if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
104
-				// CLI should not hard-fail on broken memcache
105
-				$this->logger->info($missingCacheMessage, [
106
-					'class' => $distributedCacheClass,
107
-					'use' => 'distributed',
108
-					'app' => 'cli'
109
-				]);
110
-				$distributedCacheClass = self::NULL_CACHE;
111
-			} else {
112
-				throw new \OC\HintException(strtr($missingCacheMessage, [
113
-					'{class}' => $distributedCacheClass, '{use}' => 'distributed'
114
-				]), $missingCacheHint);
115
-			}
116
-		}
117
-		if (!($lockingCacheClass && class_exists($distributedCacheClass) && $lockingCacheClass::isAvailable())) {
118
-			// don't fallback since the fallback might not be suitable for storing lock
119
-			$lockingCacheClass = self::NULL_CACHE;
120
-		}
121
-
122
-		$this->localCacheClass = $localCacheClass;
123
-		$this->distributedCacheClass = $distributedCacheClass;
124
-		$this->lockingCacheClass = $lockingCacheClass;
125
-	}
126
-
127
-	/**
128
-	 * create a cache instance for storing locks
129
-	 *
130
-	 * @param string $prefix
131
-	 * @return IMemcache
132
-	 */
133
-	public function createLocking(string $prefix = ''): IMemcache {
134
-		return new $this->lockingCacheClass($this->globalPrefix . '/' . $prefix);
135
-	}
136
-
137
-	/**
138
-	 * create a distributed cache instance
139
-	 *
140
-	 * @param string $prefix
141
-	 * @return ICache
142
-	 */
143
-	public function createDistributed(string $prefix = ''): ICache {
144
-		return new $this->distributedCacheClass($this->globalPrefix . '/' . $prefix);
145
-	}
146
-
147
-	/**
148
-	 * create a local cache instance
149
-	 *
150
-	 * @param string $prefix
151
-	 * @return ICache
152
-	 */
153
-	public function createLocal(string $prefix = ''): ICache {
154
-		return new $this->localCacheClass($this->globalPrefix . '/' . $prefix);
155
-	}
156
-
157
-	/**
158
-	 * @see \OC\Memcache\Factory::createDistributed()
159
-	 * @param string $prefix
160
-	 * @return ICache
161
-	 * @deprecated 13.0.0 Use either createLocking, createDistributed or createLocal
162
-	 */
163
-	public function create(string $prefix = ''): ICache {
164
-		return $this->createDistributed($prefix);
165
-	}
166
-
167
-	/**
168
-	 * check memcache availability
169
-	 *
170
-	 * @return bool
171
-	 */
172
-	public function isAvailable(): bool {
173
-		return ($this->distributedCacheClass !== self::NULL_CACHE);
174
-	}
175
-
176
-	/**
177
-	 * @see \OC\Memcache\Factory::createLocal()
178
-	 * @param string $prefix
179
-	 * @return ICache
180
-	 */
181
-	public function createLowLatency(string $prefix = ''): ICache {
182
-		return $this->createLocal($prefix);
183
-	}
184
-
185
-	/**
186
-	 * Check if a local memory cache backend is available
187
-	 *
188
-	 * @return bool
189
-	 */
190
-	public function isLocalCacheAvailable(): bool {
191
-		return ($this->localCacheClass !== self::NULL_CACHE);
192
-	}
39
+    public const NULL_CACHE = NullCache::class;
40
+
41
+    /**
42
+     * @var string $globalPrefix
43
+     */
44
+    private $globalPrefix;
45
+
46
+    /**
47
+     * @var ILogger $logger
48
+     */
49
+    private $logger;
50
+
51
+    /**
52
+     * @var string $localCacheClass
53
+     */
54
+    private $localCacheClass;
55
+
56
+    /**
57
+     * @var string $distributedCacheClass
58
+     */
59
+    private $distributedCacheClass;
60
+
61
+    /**
62
+     * @var string $lockingCacheClass
63
+     */
64
+    private $lockingCacheClass;
65
+
66
+    /**
67
+     * @param string $globalPrefix
68
+     * @param ILogger $logger
69
+     * @param string|null $localCacheClass
70
+     * @param string|null $distributedCacheClass
71
+     * @param string|null $lockingCacheClass
72
+     */
73
+    public function __construct(string $globalPrefix, ILogger $logger,
74
+        $localCacheClass = null, $distributedCacheClass = null, $lockingCacheClass = null) {
75
+        $this->logger = $logger;
76
+        $this->globalPrefix = $globalPrefix;
77
+
78
+        if (!$localCacheClass) {
79
+            $localCacheClass = self::NULL_CACHE;
80
+        }
81
+        if (!$distributedCacheClass) {
82
+            $distributedCacheClass = $localCacheClass;
83
+        }
84
+
85
+        $missingCacheMessage = 'Memcache {class} not available for {use} cache';
86
+        $missingCacheHint = 'Is the matching PHP module installed and enabled?';
87
+        if (!class_exists($localCacheClass) || !$localCacheClass::isAvailable()) {
88
+            if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
89
+                // CLI should not hard-fail on broken memcache
90
+                $this->logger->info($missingCacheMessage, [
91
+                    'class' => $localCacheClass,
92
+                    'use' => 'local',
93
+                    'app' => 'cli'
94
+                ]);
95
+                $localCacheClass = self::NULL_CACHE;
96
+            } else {
97
+                throw new \OC\HintException(strtr($missingCacheMessage, [
98
+                    '{class}' => $localCacheClass, '{use}' => 'local'
99
+                ]), $missingCacheHint);
100
+            }
101
+        }
102
+        if (!class_exists($distributedCacheClass) || !$distributedCacheClass::isAvailable()) {
103
+            if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
104
+                // CLI should not hard-fail on broken memcache
105
+                $this->logger->info($missingCacheMessage, [
106
+                    'class' => $distributedCacheClass,
107
+                    'use' => 'distributed',
108
+                    'app' => 'cli'
109
+                ]);
110
+                $distributedCacheClass = self::NULL_CACHE;
111
+            } else {
112
+                throw new \OC\HintException(strtr($missingCacheMessage, [
113
+                    '{class}' => $distributedCacheClass, '{use}' => 'distributed'
114
+                ]), $missingCacheHint);
115
+            }
116
+        }
117
+        if (!($lockingCacheClass && class_exists($distributedCacheClass) && $lockingCacheClass::isAvailable())) {
118
+            // don't fallback since the fallback might not be suitable for storing lock
119
+            $lockingCacheClass = self::NULL_CACHE;
120
+        }
121
+
122
+        $this->localCacheClass = $localCacheClass;
123
+        $this->distributedCacheClass = $distributedCacheClass;
124
+        $this->lockingCacheClass = $lockingCacheClass;
125
+    }
126
+
127
+    /**
128
+     * create a cache instance for storing locks
129
+     *
130
+     * @param string $prefix
131
+     * @return IMemcache
132
+     */
133
+    public function createLocking(string $prefix = ''): IMemcache {
134
+        return new $this->lockingCacheClass($this->globalPrefix . '/' . $prefix);
135
+    }
136
+
137
+    /**
138
+     * create a distributed cache instance
139
+     *
140
+     * @param string $prefix
141
+     * @return ICache
142
+     */
143
+    public function createDistributed(string $prefix = ''): ICache {
144
+        return new $this->distributedCacheClass($this->globalPrefix . '/' . $prefix);
145
+    }
146
+
147
+    /**
148
+     * create a local cache instance
149
+     *
150
+     * @param string $prefix
151
+     * @return ICache
152
+     */
153
+    public function createLocal(string $prefix = ''): ICache {
154
+        return new $this->localCacheClass($this->globalPrefix . '/' . $prefix);
155
+    }
156
+
157
+    /**
158
+     * @see \OC\Memcache\Factory::createDistributed()
159
+     * @param string $prefix
160
+     * @return ICache
161
+     * @deprecated 13.0.0 Use either createLocking, createDistributed or createLocal
162
+     */
163
+    public function create(string $prefix = ''): ICache {
164
+        return $this->createDistributed($prefix);
165
+    }
166
+
167
+    /**
168
+     * check memcache availability
169
+     *
170
+     * @return bool
171
+     */
172
+    public function isAvailable(): bool {
173
+        return ($this->distributedCacheClass !== self::NULL_CACHE);
174
+    }
175
+
176
+    /**
177
+     * @see \OC\Memcache\Factory::createLocal()
178
+     * @param string $prefix
179
+     * @return ICache
180
+     */
181
+    public function createLowLatency(string $prefix = ''): ICache {
182
+        return $this->createLocal($prefix);
183
+    }
184
+
185
+    /**
186
+     * Check if a local memory cache backend is available
187
+     *
188
+     * @return bool
189
+     */
190
+    public function isLocalCacheAvailable(): bool {
191
+        return ($this->localCacheClass !== self::NULL_CACHE);
192
+    }
193 193
 }
Please login to merge, or discard this patch.
lib/private/Lock/NoopLockingProvider.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -33,38 +33,38 @@
 block discarded – undo
33 33
  */
34 34
 class NoopLockingProvider implements ILockingProvider {
35 35
 
36
-	/**
37
-	 * {@inheritdoc}
38
-	 */
39
-	public function isLocked(string $path, int $type): bool {
40
-		return false;
41
-	}
36
+    /**
37
+     * {@inheritdoc}
38
+     */
39
+    public function isLocked(string $path, int $type): bool {
40
+        return false;
41
+    }
42 42
 
43
-	/**
44
-	 * {@inheritdoc}
45
-	 */
46
-	public function acquireLock(string $path, int $type) {
47
-		// do nothing
48
-	}
43
+    /**
44
+     * {@inheritdoc}
45
+     */
46
+    public function acquireLock(string $path, int $type) {
47
+        // do nothing
48
+    }
49 49
 
50
-	/**
51
-	 * {@inheritdoc}
52
-	 */
53
-	public function releaseLock(string $path, int $type) {
54
-		// do nothing
55
-	}
50
+    /**
51
+     * {@inheritdoc}
52
+     */
53
+    public function releaseLock(string $path, int $type) {
54
+        // do nothing
55
+    }
56 56
 
57
-	/**1
57
+    /**1
58 58
 	 * {@inheritdoc}
59 59
 	 */
60
-	public function releaseAll() {
61
-		// do nothing
62
-	}
60
+    public function releaseAll() {
61
+        // do nothing
62
+    }
63 63
 
64
-	/**
65
-	 * {@inheritdoc}
66
-	 */
67
-	public function changeLock(string $path, int $targetType) {
68
-		// do nothing
69
-	}
64
+    /**
65
+     * {@inheritdoc}
66
+     */
67
+    public function changeLock(string $path, int $targetType) {
68
+        // do nothing
69
+    }
70 70
 }
Please login to merge, or discard this patch.
core/Migrations/Version13000Date20170814074715.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -29,50 +29,50 @@
 block discarded – undo
29 29
 
30 30
 class Version13000Date20170814074715 extends SimpleMigrationStep {
31 31
 
32
-	/**
33
-	 * @param IOutput $output
34
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
35
-	 * @param array $options
36
-	 * @since 13.0.0
37
-	 */
38
-	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
39
-	}
32
+    /**
33
+     * @param IOutput $output
34
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
35
+     * @param array $options
36
+     * @since 13.0.0
37
+     */
38
+    public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
39
+    }
40 40
 
41
-	/**
42
-	 * @param IOutput $output
43
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
44
-	 * @param array $options
45
-	 * @return null|ISchemaWrapper
46
-	 * @since 13.0.0
47
-	 */
48
-	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
49
-		/** @var ISchemaWrapper $schema */
50
-		$schema = $schemaClosure();
41
+    /**
42
+     * @param IOutput $output
43
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
44
+     * @param array $options
45
+     * @return null|ISchemaWrapper
46
+     * @since 13.0.0
47
+     */
48
+    public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
49
+        /** @var ISchemaWrapper $schema */
50
+        $schema = $schemaClosure();
51 51
 
52 52
 
53
-		if (!$schema->hasTable('accounts')) {
54
-			$table = $schema->createTable('accounts');
55
-			$table->addColumn('uid', 'string', [
56
-				'notnull' => true,
57
-				'length' => 64,
58
-				'default' => '',
59
-			]);
60
-			$table->addColumn('data', 'text', [
61
-				'notnull' => true,
62
-				'default' => '',
63
-			]);
64
-			$table->setPrimaryKey(['uid']);
65
-		}
53
+        if (!$schema->hasTable('accounts')) {
54
+            $table = $schema->createTable('accounts');
55
+            $table->addColumn('uid', 'string', [
56
+                'notnull' => true,
57
+                'length' => 64,
58
+                'default' => '',
59
+            ]);
60
+            $table->addColumn('data', 'text', [
61
+                'notnull' => true,
62
+                'default' => '',
63
+            ]);
64
+            $table->setPrimaryKey(['uid']);
65
+        }
66 66
 
67
-		return $schema;
68
-	}
67
+        return $schema;
68
+    }
69 69
 
70
-	/**
71
-	 * @param IOutput $output
72
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
73
-	 * @param array $options
74
-	 * @since 13.0.0
75
-	 */
76
-	public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
77
-	}
70
+    /**
71
+     * @param IOutput $output
72
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
73
+     * @param array $options
74
+     * @since 13.0.0
75
+     */
76
+    public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
77
+    }
78 78
 }
Please login to merge, or discard this patch.
core/Migrations/Version13000Date20170919121250.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -32,93 +32,93 @@
 block discarded – undo
32 32
  */
33 33
 class Version13000Date20170919121250 extends SimpleMigrationStep {
34 34
 
35
-	/**
36
-	 * @param IOutput $output
37
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38
-	 * @param array $options
39
-	 * @since 13.0.0
40
-	 */
41
-	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
42
-	}
43
-
44
-	/**
45
-	 * @param IOutput $output
46
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
47
-	 * @param array $options
48
-	 * @return null|ISchemaWrapper
49
-	 * @since 13.0.0
50
-	 */
51
-	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
52
-		/** @var ISchemaWrapper $schema */
53
-		$schema = $schemaClosure();
54
-
55
-		$table = $schema->getTable('jobs');
56
-		$column = $table->getColumn('id');
57
-		$column->setUnsigned(true);
58
-
59
-		$table = $schema->getTable('authtoken');
60
-		$column = $table->getColumn('id');
61
-		$column->setUnsigned(true);
62
-		$column = $table->getColumn('type');
63
-		$column->setUnsigned(true);
64
-		$column = $table->getColumn('remember');
65
-		$column->setUnsigned(true);
66
-		$column = $table->getColumn('last_activity');
67
-		$column->setUnsigned(true);
68
-		$column = $table->getColumn('last_check');
69
-		$column->setUnsigned(true);
70
-
71
-		$table = $schema->getTable('bruteforce_attempts');
72
-		$column = $table->getColumn('id');
73
-		$column->setUnsigned(true);
74
-		$column = $table->getColumn('occurred');
75
-		$column->setUnsigned(true);
76
-
77
-		$table = $schema->getTable('comments');
78
-		$column = $table->getColumn('id');
79
-		$column->setUnsigned(true);
80
-		$column = $table->getColumn('parent_id');
81
-		$column->setUnsigned(true);
82
-		$column = $table->getColumn('topmost_parent_id');
83
-		$column->setUnsigned(true);
84
-		$column = $table->getColumn('children_count');
85
-		$column->setUnsigned(true);
86
-
87
-		$table = $schema->getTable('file_locks');
88
-		$column = $table->getColumn('id');
89
-		$column->setUnsigned(true);
90
-
91
-		$table = $schema->getTable('systemtag');
92
-		$column = $table->getColumn('id');
93
-		$column->setUnsigned(true);
94
-
95
-		$table = $schema->getTable('systemtag_object_mapping');
96
-		$column = $table->getColumn('systemtagid');
97
-		$column->setUnsigned(true);
98
-
99
-		$table = $schema->getTable('systemtag_group');
100
-		$column = $table->getColumn('systemtagid');
101
-		$column->setUnsigned(true);
102
-
103
-		$table = $schema->getTable('vcategory');
104
-		$column = $table->getColumn('id');
105
-		$column->setUnsigned(true);
106
-
107
-		$table = $schema->getTable('vcategory_to_object');
108
-		$column = $table->getColumn('objid');
109
-		$column->setUnsigned(true);
110
-		$column = $table->getColumn('categoryid');
111
-		$column->setUnsigned(true);
112
-
113
-		return $schema;
114
-	}
115
-
116
-	/**
117
-	 * @param IOutput $output
118
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
119
-	 * @param array $options
120
-	 * @since 13.0.0
121
-	 */
122
-	public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
123
-	}
35
+    /**
36
+     * @param IOutput $output
37
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38
+     * @param array $options
39
+     * @since 13.0.0
40
+     */
41
+    public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
42
+    }
43
+
44
+    /**
45
+     * @param IOutput $output
46
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
47
+     * @param array $options
48
+     * @return null|ISchemaWrapper
49
+     * @since 13.0.0
50
+     */
51
+    public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
52
+        /** @var ISchemaWrapper $schema */
53
+        $schema = $schemaClosure();
54
+
55
+        $table = $schema->getTable('jobs');
56
+        $column = $table->getColumn('id');
57
+        $column->setUnsigned(true);
58
+
59
+        $table = $schema->getTable('authtoken');
60
+        $column = $table->getColumn('id');
61
+        $column->setUnsigned(true);
62
+        $column = $table->getColumn('type');
63
+        $column->setUnsigned(true);
64
+        $column = $table->getColumn('remember');
65
+        $column->setUnsigned(true);
66
+        $column = $table->getColumn('last_activity');
67
+        $column->setUnsigned(true);
68
+        $column = $table->getColumn('last_check');
69
+        $column->setUnsigned(true);
70
+
71
+        $table = $schema->getTable('bruteforce_attempts');
72
+        $column = $table->getColumn('id');
73
+        $column->setUnsigned(true);
74
+        $column = $table->getColumn('occurred');
75
+        $column->setUnsigned(true);
76
+
77
+        $table = $schema->getTable('comments');
78
+        $column = $table->getColumn('id');
79
+        $column->setUnsigned(true);
80
+        $column = $table->getColumn('parent_id');
81
+        $column->setUnsigned(true);
82
+        $column = $table->getColumn('topmost_parent_id');
83
+        $column->setUnsigned(true);
84
+        $column = $table->getColumn('children_count');
85
+        $column->setUnsigned(true);
86
+
87
+        $table = $schema->getTable('file_locks');
88
+        $column = $table->getColumn('id');
89
+        $column->setUnsigned(true);
90
+
91
+        $table = $schema->getTable('systemtag');
92
+        $column = $table->getColumn('id');
93
+        $column->setUnsigned(true);
94
+
95
+        $table = $schema->getTable('systemtag_object_mapping');
96
+        $column = $table->getColumn('systemtagid');
97
+        $column->setUnsigned(true);
98
+
99
+        $table = $schema->getTable('systemtag_group');
100
+        $column = $table->getColumn('systemtagid');
101
+        $column->setUnsigned(true);
102
+
103
+        $table = $schema->getTable('vcategory');
104
+        $column = $table->getColumn('id');
105
+        $column->setUnsigned(true);
106
+
107
+        $table = $schema->getTable('vcategory_to_object');
108
+        $column = $table->getColumn('objid');
109
+        $column->setUnsigned(true);
110
+        $column = $table->getColumn('categoryid');
111
+        $column->setUnsigned(true);
112
+
113
+        return $schema;
114
+    }
115
+
116
+    /**
117
+     * @param IOutput $output
118
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
119
+     * @param array $options
120
+     * @since 13.0.0
121
+     */
122
+    public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
123
+    }
124 124
 }
Please login to merge, or discard this patch.
apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -31,75 +31,75 @@
 block discarded – undo
31 31
 
32 32
 class Version1002Date20170607113030 extends SimpleMigrationStep {
33 33
 
34
-	/** @var IDBConnection */
35
-	protected $connection;
34
+    /** @var IDBConnection */
35
+    protected $connection;
36 36
 
37
-	/**
38
-	 * @param IDBConnection $connection
39
-	 */
40
-	public function __construct(IDBConnection $connection) {
41
-		$this->connection = $connection;
42
-	}
37
+    /**
38
+     * @param IDBConnection $connection
39
+     */
40
+    public function __construct(IDBConnection $connection) {
41
+        $this->connection = $connection;
42
+    }
43 43
 
44
-	/**
45
-	 * @param IOutput $output
46
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
47
-	 * @param array $options
48
-	 * @since 13.0.0
49
-	 */
50
-	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
51
-		/** @var ISchemaWrapper $schema */
52
-		$schema = $schemaClosure();
44
+    /**
45
+     * @param IOutput $output
46
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
47
+     * @param array $options
48
+     * @since 13.0.0
49
+     */
50
+    public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
51
+        /** @var ISchemaWrapper $schema */
52
+        $schema = $schemaClosure();
53 53
 
54
-		if (!$schema->hasTable('twofactor_backup_codes')) {
55
-			// Legacy table does not exist
56
-			return;
57
-		}
54
+        if (!$schema->hasTable('twofactor_backup_codes')) {
55
+            // Legacy table does not exist
56
+            return;
57
+        }
58 58
 
59
-		$insert = $this->connection->getQueryBuilder();
60
-		$insert->insert('twofactor_backupcodes')
61
-			->values([
62
-				// Inserting with id might fail: 'id' => $insert->createParameter('id'),
63
-				'user_id' => $insert->createParameter('user_id'),
64
-				'code' => $insert->createParameter('code'),
65
-				'used' => $insert->createParameter('used'),
66
-			]);
59
+        $insert = $this->connection->getQueryBuilder();
60
+        $insert->insert('twofactor_backupcodes')
61
+            ->values([
62
+                // Inserting with id might fail: 'id' => $insert->createParameter('id'),
63
+                'user_id' => $insert->createParameter('user_id'),
64
+                'code' => $insert->createParameter('code'),
65
+                'used' => $insert->createParameter('used'),
66
+            ]);
67 67
 
68
-		$query = $this->connection->getQueryBuilder();
69
-		$query->select('*')
70
-			->from('twofactor_backup_codes')
71
-			->orderBy('id', 'ASC');
72
-		$result = $query->execute();
68
+        $query = $this->connection->getQueryBuilder();
69
+        $query->select('*')
70
+            ->from('twofactor_backup_codes')
71
+            ->orderBy('id', 'ASC');
72
+        $result = $query->execute();
73 73
 
74
-		$output->startProgress();
75
-		while ($row = $result->fetch()) {
76
-			$output->advance();
74
+        $output->startProgress();
75
+        while ($row = $result->fetch()) {
76
+            $output->advance();
77 77
 
78
-			$insert
79
-				// Inserting with id might fail: ->setParameter('id', $row['id'], IQueryBuilder::PARAM_INT)
80
-				->setParameter('user_id', $row['user_id'], IQueryBuilder::PARAM_STR)
81
-				->setParameter('code', $row['code'], IQueryBuilder::PARAM_STR)
82
-				->setParameter('used', $row['used'], IQueryBuilder::PARAM_INT)
83
-				->execute();
84
-		}
85
-		$output->finishProgress();
86
-	}
78
+            $insert
79
+                // Inserting with id might fail: ->setParameter('id', $row['id'], IQueryBuilder::PARAM_INT)
80
+                ->setParameter('user_id', $row['user_id'], IQueryBuilder::PARAM_STR)
81
+                ->setParameter('code', $row['code'], IQueryBuilder::PARAM_STR)
82
+                ->setParameter('used', $row['used'], IQueryBuilder::PARAM_INT)
83
+                ->execute();
84
+        }
85
+        $output->finishProgress();
86
+    }
87 87
 
88
-	/**
89
-	 * @param IOutput $output
90
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
91
-	 * @param array $options
92
-	 * @return null|ISchemaWrapper
93
-	 * @since 13.0.0
94
-	 */
95
-	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
96
-		/** @var ISchemaWrapper $schema */
97
-		$schema = $schemaClosure();
88
+    /**
89
+     * @param IOutput $output
90
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
91
+     * @param array $options
92
+     * @return null|ISchemaWrapper
93
+     * @since 13.0.0
94
+     */
95
+    public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
96
+        /** @var ISchemaWrapper $schema */
97
+        $schema = $schemaClosure();
98 98
 
99
-		if ($schema->hasTable('twofactor_backup_codes')) {
100
-			$schema->dropTable('twofactor_backup_codes');
101
-			return $schema;
102
-		}
103
-		return null;
104
-	}
99
+        if ($schema->hasTable('twofactor_backup_codes')) {
100
+            $schema->dropTable('twofactor_backup_codes');
101
+            return $schema;
102
+        }
103
+        return null;
104
+    }
105 105
 }
Please login to merge, or discard this patch.