Passed
Push — master ( 7940a7...35a9c5 )
by Morris
53:21 queued 41:14
created
core/templates/layout.guest.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 									<?php p($theme->getName()); ?>
42 42
 								</h1>
43 43
 								<?php if(\OC::$server->getConfig()->getSystemValue('installed', false)
44
-									&& \OC::$server->getConfig()->getAppValue('theming', 'logoMime', false)): ?>
44
+                                    && \OC::$server->getConfig()->getAppValue('theming', 'logoMime', false)): ?>
45 45
 									<img src="<?php p($theme->getLogo()); ?>"/>
46 46
 								<?php endif; ?>
47 47
 							</div>
Please login to merge, or discard this patch.
lib/private/Config.php 1 patch
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -40,235 +40,235 @@
 block discarded – undo
40 40
  */
41 41
 class Config {
42 42
 
43
-	const ENV_PREFIX = 'NC_';
43
+    const ENV_PREFIX = 'NC_';
44 44
 
45
-	/** @var array Associative array ($key => $value) */
46
-	protected $cache = array();
47
-	/** @var string */
48
-	protected $configDir;
49
-	/** @var string */
50
-	protected $configFilePath;
51
-	/** @var string */
52
-	protected $configFileName;
45
+    /** @var array Associative array ($key => $value) */
46
+    protected $cache = array();
47
+    /** @var string */
48
+    protected $configDir;
49
+    /** @var string */
50
+    protected $configFilePath;
51
+    /** @var string */
52
+    protected $configFileName;
53 53
 
54
-	/**
55
-	 * @param string $configDir Path to the config dir, needs to end with '/'
56
-	 * @param string $fileName (Optional) Name of the config file. Defaults to config.php
57
-	 */
58
-	public function __construct($configDir, $fileName = 'config.php') {
59
-		$this->configDir = $configDir;
60
-		$this->configFilePath = $this->configDir.$fileName;
61
-		$this->configFileName = $fileName;
62
-		$this->readData();
63
-	}
54
+    /**
55
+     * @param string $configDir Path to the config dir, needs to end with '/'
56
+     * @param string $fileName (Optional) Name of the config file. Defaults to config.php
57
+     */
58
+    public function __construct($configDir, $fileName = 'config.php') {
59
+        $this->configDir = $configDir;
60
+        $this->configFilePath = $this->configDir.$fileName;
61
+        $this->configFileName = $fileName;
62
+        $this->readData();
63
+    }
64 64
 
65
-	/**
66
-	 * Lists all available config keys
67
-	 *
68
-	 * Please note that it does not return the values.
69
-	 *
70
-	 * @return array an array of key names
71
-	 */
72
-	public function getKeys() {
73
-		return array_keys($this->cache);
74
-	}
65
+    /**
66
+     * Lists all available config keys
67
+     *
68
+     * Please note that it does not return the values.
69
+     *
70
+     * @return array an array of key names
71
+     */
72
+    public function getKeys() {
73
+        return array_keys($this->cache);
74
+    }
75 75
 
76
-	/**
77
-	 * Returns a config value
78
-	 *
79
-	 * gets its value from an `NC_` prefixed environment variable
80
-	 * if it doesn't exist from config.php
81
-	 * if this doesn't exist either, it will return the given `$default`
82
-	 *
83
-	 * @param string $key key
84
-	 * @param mixed $default = null default value
85
-	 * @return mixed the value or $default
86
-	 */
87
-	public function getValue($key, $default = null) {
88
-		$envValue = getenv(self::ENV_PREFIX . $key);
89
-		if ($envValue !== false) {
90
-			return $envValue;
91
-		}
76
+    /**
77
+     * Returns a config value
78
+     *
79
+     * gets its value from an `NC_` prefixed environment variable
80
+     * if it doesn't exist from config.php
81
+     * if this doesn't exist either, it will return the given `$default`
82
+     *
83
+     * @param string $key key
84
+     * @param mixed $default = null default value
85
+     * @return mixed the value or $default
86
+     */
87
+    public function getValue($key, $default = null) {
88
+        $envValue = getenv(self::ENV_PREFIX . $key);
89
+        if ($envValue !== false) {
90
+            return $envValue;
91
+        }
92 92
 
93
-		if (isset($this->cache[$key])) {
94
-			return $this->cache[$key];
95
-		}
93
+        if (isset($this->cache[$key])) {
94
+            return $this->cache[$key];
95
+        }
96 96
 
97
-		return $default;
98
-	}
97
+        return $default;
98
+    }
99 99
 
100
-	/**
101
-	 * Sets and deletes values and writes the config.php
102
-	 *
103
-	 * @param array $configs Associative array with `key => value` pairs
104
-	 *                       If value is null, the config key will be deleted
105
-	 */
106
-	public function setValues(array $configs) {
107
-		$needsUpdate = false;
108
-		foreach ($configs as $key => $value) {
109
-			if ($value !== null) {
110
-				$needsUpdate |= $this->set($key, $value);
111
-			} else {
112
-				$needsUpdate |= $this->delete($key);
113
-			}
114
-		}
100
+    /**
101
+     * Sets and deletes values and writes the config.php
102
+     *
103
+     * @param array $configs Associative array with `key => value` pairs
104
+     *                       If value is null, the config key will be deleted
105
+     */
106
+    public function setValues(array $configs) {
107
+        $needsUpdate = false;
108
+        foreach ($configs as $key => $value) {
109
+            if ($value !== null) {
110
+                $needsUpdate |= $this->set($key, $value);
111
+            } else {
112
+                $needsUpdate |= $this->delete($key);
113
+            }
114
+        }
115 115
 
116
-		if ($needsUpdate) {
117
-			// Write changes
118
-			$this->writeData();
119
-		}
120
-	}
116
+        if ($needsUpdate) {
117
+            // Write changes
118
+            $this->writeData();
119
+        }
120
+    }
121 121
 
122
-	/**
123
-	 * Sets the value and writes it to config.php if required
124
-	 *
125
-	 * @param string $key key
126
-	 * @param mixed $value value
127
-	 */
128
-	public function setValue($key, $value) {
129
-		if ($this->set($key, $value)) {
130
-			// Write changes
131
-			$this->writeData();
132
-		}
133
-	}
122
+    /**
123
+     * Sets the value and writes it to config.php if required
124
+     *
125
+     * @param string $key key
126
+     * @param mixed $value value
127
+     */
128
+    public function setValue($key, $value) {
129
+        if ($this->set($key, $value)) {
130
+            // Write changes
131
+            $this->writeData();
132
+        }
133
+    }
134 134
 
135
-	/**
136
-	 * This function sets the value
137
-	 *
138
-	 * @param string $key key
139
-	 * @param mixed $value value
140
-	 * @return bool True if the file needs to be updated, false otherwise
141
-	 */
142
-	protected function set($key, $value) {
143
-		if (!isset($this->cache[$key]) || $this->cache[$key] !== $value) {
144
-			// Add change
145
-			$this->cache[$key] = $value;
146
-			return true;
147
-		}
135
+    /**
136
+     * This function sets the value
137
+     *
138
+     * @param string $key key
139
+     * @param mixed $value value
140
+     * @return bool True if the file needs to be updated, false otherwise
141
+     */
142
+    protected function set($key, $value) {
143
+        if (!isset($this->cache[$key]) || $this->cache[$key] !== $value) {
144
+            // Add change
145
+            $this->cache[$key] = $value;
146
+            return true;
147
+        }
148 148
 
149
-		return false;
150
-	}
149
+        return false;
150
+    }
151 151
 
152
-	/**
153
-	 * Removes a key from the config and removes it from config.php if required
154
-	 * @param string $key
155
-	 */
156
-	public function deleteKey($key) {
157
-		if ($this->delete($key)) {
158
-			// Write changes
159
-			$this->writeData();
160
-		}
161
-	}
152
+    /**
153
+     * Removes a key from the config and removes it from config.php if required
154
+     * @param string $key
155
+     */
156
+    public function deleteKey($key) {
157
+        if ($this->delete($key)) {
158
+            // Write changes
159
+            $this->writeData();
160
+        }
161
+    }
162 162
 
163
-	/**
164
-	 * This function removes a key from the config
165
-	 *
166
-	 * @param string $key
167
-	 * @return bool True if the file needs to be updated, false otherwise
168
-	 */
169
-	protected function delete($key) {
170
-		if (isset($this->cache[$key])) {
171
-			// Delete key from cache
172
-			unset($this->cache[$key]);
173
-			return true;
174
-		}
175
-		return false;
176
-	}
163
+    /**
164
+     * This function removes a key from the config
165
+     *
166
+     * @param string $key
167
+     * @return bool True if the file needs to be updated, false otherwise
168
+     */
169
+    protected function delete($key) {
170
+        if (isset($this->cache[$key])) {
171
+            // Delete key from cache
172
+            unset($this->cache[$key]);
173
+            return true;
174
+        }
175
+        return false;
176
+    }
177 177
 
178
-	/**
179
-	 * Loads the config file
180
-	 *
181
-	 * Reads the config file and saves it to the cache
182
-	 *
183
-	 * @throws \Exception If no lock could be acquired or the config file has not been found
184
-	 */
185
-	private function readData() {
186
-		// Default config should always get loaded
187
-		$configFiles = array($this->configFilePath);
178
+    /**
179
+     * Loads the config file
180
+     *
181
+     * Reads the config file and saves it to the cache
182
+     *
183
+     * @throws \Exception If no lock could be acquired or the config file has not been found
184
+     */
185
+    private function readData() {
186
+        // Default config should always get loaded
187
+        $configFiles = array($this->configFilePath);
188 188
 
189
-		// Add all files in the config dir ending with the same file name
190
-		$extra = glob($this->configDir.'*.'.$this->configFileName);
191
-		if (is_array($extra)) {
192
-			natsort($extra);
193
-			$configFiles = array_merge($configFiles, $extra);
194
-		}
189
+        // Add all files in the config dir ending with the same file name
190
+        $extra = glob($this->configDir.'*.'.$this->configFileName);
191
+        if (is_array($extra)) {
192
+            natsort($extra);
193
+            $configFiles = array_merge($configFiles, $extra);
194
+        }
195 195
 
196
-		// Include file and merge config
197
-		foreach ($configFiles as $file) {
198
-			$fileExistsAndIsReadable = file_exists($file) && is_readable($file);
199
-			$filePointer = $fileExistsAndIsReadable ? fopen($file, 'r') : false;
200
-			if($file === $this->configFilePath &&
201
-				$filePointer === false) {
202
-				// Opening the main config might not be possible, e.g. if the wrong
203
-				// permissions are set (likely on a new installation)
204
-				continue;
205
-			}
196
+        // Include file and merge config
197
+        foreach ($configFiles as $file) {
198
+            $fileExistsAndIsReadable = file_exists($file) && is_readable($file);
199
+            $filePointer = $fileExistsAndIsReadable ? fopen($file, 'r') : false;
200
+            if($file === $this->configFilePath &&
201
+                $filePointer === false) {
202
+                // Opening the main config might not be possible, e.g. if the wrong
203
+                // permissions are set (likely on a new installation)
204
+                continue;
205
+            }
206 206
 
207
-			// Try to acquire a file lock
208
-			if(!flock($filePointer, LOCK_SH)) {
209
-				throw new \Exception(sprintf('Could not acquire a shared lock on the config file %s', $file));
210
-			}
207
+            // Try to acquire a file lock
208
+            if(!flock($filePointer, LOCK_SH)) {
209
+                throw new \Exception(sprintf('Could not acquire a shared lock on the config file %s', $file));
210
+            }
211 211
 
212
-			unset($CONFIG);
213
-			include $file;
214
-			if(isset($CONFIG) && is_array($CONFIG)) {
215
-				$this->cache = array_merge($this->cache, $CONFIG);
216
-			}
212
+            unset($CONFIG);
213
+            include $file;
214
+            if(isset($CONFIG) && is_array($CONFIG)) {
215
+                $this->cache = array_merge($this->cache, $CONFIG);
216
+            }
217 217
 
218
-			// Close the file pointer and release the lock
219
-			flock($filePointer, LOCK_UN);
220
-			fclose($filePointer);
221
-		}
222
-	}
218
+            // Close the file pointer and release the lock
219
+            flock($filePointer, LOCK_UN);
220
+            fclose($filePointer);
221
+        }
222
+    }
223 223
 
224
-	/**
225
-	 * Writes the config file
226
-	 *
227
-	 * Saves the config to the config file.
228
-	 *
229
-	 * @throws HintException If the config file cannot be written to
230
-	 * @throws \Exception If no file lock can be acquired
231
-	 */
232
-	private function writeData() {
233
-		// Create a php file ...
234
-		$content = "<?php\n";
235
-		$content .= '$CONFIG = ';
236
-		$content .= var_export($this->cache, true);
237
-		$content .= ";\n";
224
+    /**
225
+     * Writes the config file
226
+     *
227
+     * Saves the config to the config file.
228
+     *
229
+     * @throws HintException If the config file cannot be written to
230
+     * @throws \Exception If no file lock can be acquired
231
+     */
232
+    private function writeData() {
233
+        // Create a php file ...
234
+        $content = "<?php\n";
235
+        $content .= '$CONFIG = ';
236
+        $content .= var_export($this->cache, true);
237
+        $content .= ";\n";
238 238
 
239
-		touch ($this->configFilePath);
240
-		$filePointer = fopen($this->configFilePath, 'r+');
239
+        touch ($this->configFilePath);
240
+        $filePointer = fopen($this->configFilePath, 'r+');
241 241
 
242
-		// Prevent others not to read the config
243
-		chmod($this->configFilePath, 0640);
242
+        // Prevent others not to read the config
243
+        chmod($this->configFilePath, 0640);
244 244
 
245
-		// File does not exist, this can happen when doing a fresh install
246
-		if(!is_resource ($filePointer)) {
247
-			// TODO fix this via DI once it is very clear that this doesn't cause side effects due to initialization order
248
-			// currently this breaks app routes but also could have other side effects especially during setup and exception handling
249
-			$url = \OC::$server->getURLGenerator()->linkToDocs('admin-dir_permissions');
250
-			throw new HintException(
251
-				"Can't write into config directory!",
252
-				'This can usually be fixed by giving the webserver write access to the config directory. See ' . $url);
253
-		}
245
+        // File does not exist, this can happen when doing a fresh install
246
+        if(!is_resource ($filePointer)) {
247
+            // TODO fix this via DI once it is very clear that this doesn't cause side effects due to initialization order
248
+            // currently this breaks app routes but also could have other side effects especially during setup and exception handling
249
+            $url = \OC::$server->getURLGenerator()->linkToDocs('admin-dir_permissions');
250
+            throw new HintException(
251
+                "Can't write into config directory!",
252
+                'This can usually be fixed by giving the webserver write access to the config directory. See ' . $url);
253
+        }
254 254
 
255
-		// Try to acquire a file lock
256
-		if(!flock($filePointer, LOCK_EX)) {
257
-			throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath));
258
-		}
255
+        // Try to acquire a file lock
256
+        if(!flock($filePointer, LOCK_EX)) {
257
+            throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath));
258
+        }
259 259
 
260
-		// Write the config and release the lock
261
-		ftruncate ($filePointer, 0);
262
-		fwrite($filePointer, $content);
263
-		fflush($filePointer);
264
-		flock($filePointer, LOCK_UN);
265
-		fclose($filePointer);
260
+        // Write the config and release the lock
261
+        ftruncate ($filePointer, 0);
262
+        fwrite($filePointer, $content);
263
+        fflush($filePointer);
264
+        flock($filePointer, LOCK_UN);
265
+        fclose($filePointer);
266 266
 
267
-		// Try invalidating the opcache just for the file we wrote...
268
-		if (!\OC_Util::deleteFromOpcodeCache($this->configFilePath)) {
269
-			// But if that doesn't work, clear the whole cache.
270
-			\OC_Util::clearOpcodeCache();
271
-		}
272
-	}
267
+        // Try invalidating the opcache just for the file we wrote...
268
+        if (!\OC_Util::deleteFromOpcodeCache($this->configFilePath)) {
269
+            // But if that doesn't work, clear the whole cache.
270
+            \OC_Util::clearOpcodeCache();
271
+        }
272
+    }
273 273
 }
274 274
 
Please login to merge, or discard this patch.
lib/private/App/CodeChecker/LanguageParseChecker.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -25,36 +25,36 @@
 block discarded – undo
25 25
 
26 26
 class LanguageParseChecker {
27 27
 
28
-	/**
29
-	 * @param string $appId
30
-	 * @return array
31
-	 */
32
-	public function analyse($appId) {
33
-		$appPath = \OC_App::getAppPath($appId);
34
-		if ($appPath === false) {
35
-			throw new \RuntimeException("No app with given id <$appId> known.");
36
-		}
37
-
38
-		if (!is_dir($appPath . '/l10n/')) {
39
-			return [];
40
-		}
41
-
42
-		$errors = [];
43
-		$directory = new \DirectoryIterator($appPath . '/l10n/');
44
-
45
-		foreach ($directory as $file) {
46
-			if ($file->getExtension() !== 'json') {
47
-				continue;
48
-			}
49
-
50
-			$content = file_get_contents($file->getPathname());
51
-			json_decode($content, true);
52
-
53
-			if (json_last_error() !== JSON_ERROR_NONE) {
54
-				$errors[] = 'Invalid language file found: l10n/' . $file->getFilename() . ': ' . json_last_error_msg();
55
-			}
56
-		}
57
-
58
-		return $errors;
59
-	}
28
+    /**
29
+     * @param string $appId
30
+     * @return array
31
+     */
32
+    public function analyse($appId) {
33
+        $appPath = \OC_App::getAppPath($appId);
34
+        if ($appPath === false) {
35
+            throw new \RuntimeException("No app with given id <$appId> known.");
36
+        }
37
+
38
+        if (!is_dir($appPath . '/l10n/')) {
39
+            return [];
40
+        }
41
+
42
+        $errors = [];
43
+        $directory = new \DirectoryIterator($appPath . '/l10n/');
44
+
45
+        foreach ($directory as $file) {
46
+            if ($file->getExtension() !== 'json') {
47
+                continue;
48
+            }
49
+
50
+            $content = file_get_contents($file->getPathname());
51
+            json_decode($content, true);
52
+
53
+            if (json_last_error() !== JSON_ERROR_NONE) {
54
+                $errors[] = 'Invalid language file found: l10n/' . $file->getFilename() . ': ' . json_last_error_msg();
55
+            }
56
+        }
57
+
58
+        return $errors;
59
+    }
60 60
 }
Please login to merge, or discard this patch.
apps/lookup_server_connector/appinfo/app.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@
 block discarded – undo
22 22
 $dispatcher = \OC::$server->getEventDispatcher();
23 23
 
24 24
 $dispatcher->addListener('OC\AccountManager::userUpdated', function(\Symfony\Component\EventDispatcher\GenericEvent $event) {
25
-	/** @var \OCP\IUser $user */
26
-	$user = $event->getSubject();
25
+    /** @var \OCP\IUser $user */
26
+    $user = $event->getSubject();
27 27
 
28
-	/** @var \OCA\LookupServerConnector\UpdateLookupServer $updateLookupServer */
29
-	$updateLookupServer = \OC::$server->query(\OCA\LookupServerConnector\UpdateLookupServer::class);
30
-	$updateLookupServer->userUpdated($user);
28
+    /** @var \OCA\LookupServerConnector\UpdateLookupServer $updateLookupServer */
29
+    $updateLookupServer = \OC::$server->query(\OCA\LookupServerConnector\UpdateLookupServer::class);
30
+    $updateLookupServer->userUpdated($user);
31 31
 });
Please login to merge, or discard this patch.
apps/files/ajax/download.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 $files_list = json_decode($files);
38 38
 // in case we get only a single file
39 39
 if (!is_array($files_list)) {
40
-	$files_list = array($files);
40
+    $files_list = array($files);
41 41
 }
42 42
 
43 43
 /**
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
  * alphanumeric characters
47 47
  */
48 48
 if(isset($_GET['downloadStartSecret'])
49
-	&& !isset($_GET['downloadStartSecret'][32])
50
-	&& preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) {
51
-	setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/');
49
+    && !isset($_GET['downloadStartSecret'][32])
50
+    && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) {
51
+    setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/');
52 52
 }
53 53
 
54 54
 $server_params = array( 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' );
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
  * Http range requests support
58 58
  */
59 59
 if (isset($_SERVER['HTTP_RANGE'])) {
60
-	$server_params['range'] = \OC::$server->getRequest()->getHeader('Range');
60
+    $server_params['range'] = \OC::$server->getRequest()->getHeader('Range');
61 61
 }
62 62
 
63 63
 OC_Files::get($dir, $files_list, $server_params);
Please login to merge, or discard this patch.
apps/files_sharing/lib/Migration/SetPasswordColumn.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -36,62 +36,62 @@
 block discarded – undo
36 36
  */
37 37
 class SetPasswordColumn implements IRepairStep {
38 38
 
39
-	/** @var IDBConnection */
40
-	private $connection;
41
-
42
-	/** @var  IConfig */
43
-	private $config;
44
-
45
-
46
-	public function __construct(IDBConnection $connection, IConfig $config) {
47
-		$this->connection = $connection;
48
-		$this->config = $config;
49
-	}
50
-
51
-	/**
52
-	 * Returns the step's name
53
-	 *
54
-	 * @return string
55
-	 * @since 9.1.0
56
-	 */
57
-	public function getName() {
58
-		return 'Copy the share password into the dedicated column';
59
-	}
60
-
61
-	/**
62
-	 * @param IOutput $output
63
-	 */
64
-	public function run(IOutput $output) {
65
-		if (!$this->shouldRun()) {
66
-			return;
67
-		}
68
-
69
-		$query = $this->connection->getQueryBuilder();
70
-		$query
71
-			->update('share')
72
-			->set('password', 'share_with')
73
-			->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK)))
74
-			->andWhere($query->expr()->isNotNull('share_with'));
75
-		$result = $query->execute();
76
-
77
-		if ($result === 0) {
78
-			// No link updated, no need to run the second query
79
-			return;
80
-		}
81
-
82
-		$clearQuery = $this->connection->getQueryBuilder();
83
-		$clearQuery
84
-			->update('share')
85
-			->set('share_with', $clearQuery->createNamedParameter(null))
86
-			->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK)));
87
-
88
-		$clearQuery->execute();
89
-
90
-	}
91
-
92
-	protected function shouldRun() {
93
-		$appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');
94
-		return version_compare($appVersion, '1.4.0', '<');
95
-	}
39
+    /** @var IDBConnection */
40
+    private $connection;
41
+
42
+    /** @var  IConfig */
43
+    private $config;
44
+
45
+
46
+    public function __construct(IDBConnection $connection, IConfig $config) {
47
+        $this->connection = $connection;
48
+        $this->config = $config;
49
+    }
50
+
51
+    /**
52
+     * Returns the step's name
53
+     *
54
+     * @return string
55
+     * @since 9.1.0
56
+     */
57
+    public function getName() {
58
+        return 'Copy the share password into the dedicated column';
59
+    }
60
+
61
+    /**
62
+     * @param IOutput $output
63
+     */
64
+    public function run(IOutput $output) {
65
+        if (!$this->shouldRun()) {
66
+            return;
67
+        }
68
+
69
+        $query = $this->connection->getQueryBuilder();
70
+        $query
71
+            ->update('share')
72
+            ->set('password', 'share_with')
73
+            ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK)))
74
+            ->andWhere($query->expr()->isNotNull('share_with'));
75
+        $result = $query->execute();
76
+
77
+        if ($result === 0) {
78
+            // No link updated, no need to run the second query
79
+            return;
80
+        }
81
+
82
+        $clearQuery = $this->connection->getQueryBuilder();
83
+        $clearQuery
84
+            ->update('share')
85
+            ->set('share_with', $clearQuery->createNamedParameter(null))
86
+            ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK)));
87
+
88
+        $clearQuery->execute();
89
+
90
+    }
91
+
92
+    protected function shouldRun() {
93
+        $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');
94
+        return version_compare($appVersion, '1.4.0', '<');
95
+    }
96 96
 
97 97
 }
Please login to merge, or discard this patch.
lib/private/App/AppStore/Fetcher/CategoryFetcher.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,26 +28,26 @@
 block discarded – undo
28 28
 use OCP\ILogger;
29 29
 
30 30
 class CategoryFetcher extends Fetcher {
31
-	/**
32
-	 * @param Factory $appDataFactory
33
-	 * @param IClientService $clientService
34
-	 * @param ITimeFactory $timeFactory
35
-	 * @param IConfig $config
36
-	 * @param ILogger $logger
37
-	 */
38
-	public function __construct(Factory $appDataFactory,
39
-								IClientService $clientService,
40
-								ITimeFactory $timeFactory,
41
-								IConfig $config,
42
-								ILogger $logger) {
43
-		parent::__construct(
44
-			$appDataFactory,
45
-			$clientService,
46
-			$timeFactory,
47
-			$config,
48
-			$logger
49
-		);
50
-		$this->fileName = 'categories.json';
51
-		$this->endpointUrl = 'https://apps.nextcloud.com/api/v1/categories.json';
52
-	}
31
+    /**
32
+     * @param Factory $appDataFactory
33
+     * @param IClientService $clientService
34
+     * @param ITimeFactory $timeFactory
35
+     * @param IConfig $config
36
+     * @param ILogger $logger
37
+     */
38
+    public function __construct(Factory $appDataFactory,
39
+                                IClientService $clientService,
40
+                                ITimeFactory $timeFactory,
41
+                                IConfig $config,
42
+                                ILogger $logger) {
43
+        parent::__construct(
44
+            $appDataFactory,
45
+            $clientService,
46
+            $timeFactory,
47
+            $config,
48
+            $logger
49
+        );
50
+        $this->fileName = 'categories.json';
51
+        $this->endpointUrl = 'https://apps.nextcloud.com/api/v1/categories.json';
52
+    }
53 53
 }
Please login to merge, or discard this patch.
apps/oauth2/lib/Db/Client.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@
 block discarded – undo
34 34
  * @method void setName(string $name)
35 35
  */
36 36
 class Client extends Entity {
37
-	/** @var string */
38
-	protected $name;
39
-	/** @var string */
40
-	protected $redirectUri;
41
-	/** @var string */
42
-	protected $clientIdentifier;
43
-	/** @var string */
44
-	protected $secret;
37
+    /** @var string */
38
+    protected $name;
39
+    /** @var string */
40
+    protected $redirectUri;
41
+    /** @var string */
42
+    protected $clientIdentifier;
43
+    /** @var string */
44
+    protected $secret;
45 45
 
46
-	public function __construct() {
47
-		$this->addType('id', 'int');
48
-		$this->addType('name', 'string');
49
-		$this->addType('redirect_uri', 'string');
50
-		$this->addType('client_identifier', 'string');
51
-		$this->addType('secret', 'string');
52
-	}
46
+    public function __construct() {
47
+        $this->addType('id', 'int');
48
+        $this->addType('name', 'string');
49
+        $this->addType('redirect_uri', 'string');
50
+        $this->addType('client_identifier', 'string');
51
+        $this->addType('secret', 'string');
52
+    }
53 53
 }
Please login to merge, or discard this patch.
apps/oauth2/lib/Db/AccessToken.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@
 block discarded – undo
34 34
  * @method void setHashedCode(string $token)
35 35
  */
36 36
 class AccessToken extends Entity {
37
-	/** @var int */
38
-	protected $tokenId;
39
-	/** @var int */
40
-	protected $clientId;
41
-	/** @var string */
42
-	protected $hashedCode;
43
-	/** @var string */
44
-	protected $encryptedToken;
37
+    /** @var int */
38
+    protected $tokenId;
39
+    /** @var int */
40
+    protected $clientId;
41
+    /** @var string */
42
+    protected $hashedCode;
43
+    /** @var string */
44
+    protected $encryptedToken;
45 45
 
46
-	public function __construct() {
47
-		$this->addType('id', 'int');
48
-		$this->addType('token_id', 'int');
49
-		$this->addType('client_id', 'int');
50
-		$this->addType('hashed_code', 'string');
51
-		$this->addType('encrypted_token', 'string');
52
-	}
46
+    public function __construct() {
47
+        $this->addType('id', 'int');
48
+        $this->addType('token_id', 'int');
49
+        $this->addType('client_id', 'int');
50
+        $this->addType('hashed_code', 'string');
51
+        $this->addType('encrypted_token', 'string');
52
+    }
53 53
 }
Please login to merge, or discard this patch.