Completed
Push — master ( 7cb603...01f369 )
by Lukas
13:17
created
lib/private/Config.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @return mixed the value or $default
86 86
 	 */
87 87
 	public function getValue($key, $default = null) {
88
-		$envValue = getenv(self::ENV_PREFIX . $key);
88
+		$envValue = getenv(self::ENV_PREFIX.$key);
89 89
 		if ($envValue !== false) {
90 90
 			return $envValue;
91 91
 		}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		foreach ($configFiles as $file) {
198 198
 			$fileExistsAndIsReadable = file_exists($file) && is_readable($file);
199 199
 			$filePointer = $fileExistsAndIsReadable ? fopen($file, 'r') : false;
200
-			if($file === $this->configFilePath &&
200
+			if ($file === $this->configFilePath &&
201 201
 				$filePointer === false) {
202 202
 				// Opening the main config might not be possible, e.g. if the wrong
203 203
 				// permissions are set (likely on a new installation)
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
 			}
206 206
 
207 207
 			// Try to acquire a file lock
208
-			if(!flock($filePointer, LOCK_SH)) {
208
+			if (!flock($filePointer, LOCK_SH)) {
209 209
 				throw new \Exception(sprintf('Could not acquire a shared lock on the config file %s', $file));
210 210
 			}
211 211
 
212 212
 			unset($CONFIG);
213 213
 			include $file;
214
-			if(isset($CONFIG) && is_array($CONFIG)) {
214
+			if (isset($CONFIG) && is_array($CONFIG)) {
215 215
 				$this->cache = array_merge($this->cache, $CONFIG);
216 216
 			}
217 217
 
@@ -236,30 +236,30 @@  discard block
 block discarded – undo
236 236
 		$content .= var_export($this->cache, true);
237 237
 		$content .= ";\n";
238 238
 
239
-		touch ($this->configFilePath);
239
+		touch($this->configFilePath);
240 240
 		$filePointer = fopen($this->configFilePath, 'r+');
241 241
 
242 242
 		// Prevent others not to read the config
243 243
 		chmod($this->configFilePath, 0640);
244 244
 
245 245
 		// File does not exist, this can happen when doing a fresh install
246
-		if(!is_resource ($filePointer)) {
246
+		if (!is_resource($filePointer)) {
247 247
 			// TODO fix this via DI once it is very clear that this doesn't cause side effects due to initialization order
248 248
 			// currently this breaks app routes but also could have other side effects especially during setup and exception handling
249 249
 			$url = \OC::$server->getURLGenerator()->linkToDocs('admin-dir_permissions');
250 250
 			throw new HintException(
251 251
 				"Can't write into config directory!",
252 252
 				'This can usually be fixed by '
253
-				.'<a href="' . $url . '" target="_blank" rel="noreferrer">giving the webserver write access to the config directory</a>.');
253
+				.'<a href="'.$url.'" target="_blank" rel="noreferrer">giving the webserver write access to the config directory</a>.');
254 254
 		}
255 255
 
256 256
 		// Try to acquire a file lock
257
-		if(!flock($filePointer, LOCK_EX)) {
257
+		if (!flock($filePointer, LOCK_EX)) {
258 258
 			throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath));
259 259
 		}
260 260
 
261 261
 		// Write the config and release the lock
262
-		ftruncate ($filePointer, 0);
262
+		ftruncate($filePointer, 0);
263 263
 		fwrite($filePointer, $content);
264 264
 		fflush($filePointer);
265 265
 		flock($filePointer, LOCK_UN);
Please login to merge, or discard this patch.