Completed
Pull Request — master (#4617)
by Julius
14:00
created
lib/private/Files/Storage/CommonTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 namespace OC\Files\Storage;
34 34
 
35
-class CommonTest extends \OC\Files\Storage\Common{
35
+class CommonTest extends \OC\Files\Storage\Common {
36 36
 	/**
37 37
 	 * underlying local storage used for missing functions
38 38
 	 * @var \OC\Files\Storage\Local
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	private $storage;
41 41
 
42 42
 	public function __construct($params) {
43
-		$this->storage=new \OC\Files\Storage\Local($params);
43
+		$this->storage = new \OC\Files\Storage\Local($params);
44 44
 	}
45 45
 
46
-	public function getId(){
46
+	public function getId() {
47 47
 		return 'test::'.$this->storage->getId();
48 48
 	}
49 49
 	public function mkdir($path) {
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	public function free_space($path) {
80 80
 		return $this->storage->free_space($path);
81 81
 	}
82
-	public function touch($path, $mtime=null) {
82
+	public function touch($path, $mtime = null) {
83 83
 		return $this->storage->touch($path, $mtime);
84 84
 	}
85 85
 }
Please login to merge, or discard this patch.
lib/private/Files/Cache/Scanner.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		}
314 314
 		if ($lock) {
315 315
 			if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
316
-				$this->storage->acquireLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
316
+				$this->storage->acquireLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
317 317
 				$this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
318 318
 			}
319 319
 		}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 		if ($lock) {
326 326
 			if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
327 327
 				$this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
328
-				$this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
328
+				$this->storage->releaseLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
329 329
 			}
330 330
 		}
331 331
 		return $data;
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 		$exceptionOccurred = false;
415 415
 		$childQueue = [];
416 416
 		foreach ($newChildren as $file) {
417
-			$child = ($path) ? $path . '/' . $file : $file;
417
+			$child = ($path) ? $path.'/'.$file : $file;
418 418
 			try {
419 419
 				$existingData = isset($existingChildren[$file]) ? $existingChildren[$file] : null;
420 420
 				$data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock);
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 				// might happen if inserting duplicate while a scanning
435 435
 				// process is running in parallel
436 436
 				// log and ignore
437
-				\OCP\Util::writeLog('core', 'Exception while scanning file "' . $child . '": ' . $ex->getMessage(), \OCP\Util::DEBUG);
437
+				\OCP\Util::writeLog('core', 'Exception while scanning file "'.$child.'": '.$ex->getMessage(), \OCP\Util::DEBUG);
438 438
 				$exceptionOccurred = true;
439 439
 			} catch (\OCP\Lock\LockedException $e) {
440 440
 				if ($this->useTransactions) {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		}
446 446
 		$removedChildren = \array_diff(array_keys($existingChildren), $newChildren);
447 447
 		foreach ($removedChildren as $childName) {
448
-			$child = ($path) ? $path . '/' . $childName : $childName;
448
+			$child = ($path) ? $path.'/'.$childName : $childName;
449 449
 			$this->removeFromCache($child);
450 450
 		}
451 451
 		if ($this->useTransactions) {
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	public function backgroundScan() {
487 487
 		if (!$this->cache->inCache('')) {
488
-			$this->runBackgroundScanJob(function () {
488
+			$this->runBackgroundScanJob(function() {
489 489
 				$this->scan('', self::SCAN_RECURSIVE, self::REUSE_ETAG);
490 490
 			}, '');
491 491
 		} else {
492 492
 			$lastPath = null;
493 493
 			while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
494
-				$this->runBackgroundScanJob(function () use ($path) {
494
+				$this->runBackgroundScanJob(function() use ($path) {
495 495
 					$this->scan($path, self::SCAN_RECURSIVE_INCOMPLETE, self::REUSE_ETAG | self::REUSE_SIZE);
496 496
 				}, $path);
497 497
 				// FIXME: this won't proceed with the next item, needs revamping of getIncomplete()
Please login to merge, or discard this patch.
lib/private/Files/Cache/Wrapper/CacheJail.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		if ($path === '') {
52 52
 			return $this->root;
53 53
 		} else {
54
-			return $this->root . '/' . ltrim($path, '/');
54
+			return $this->root.'/'.ltrim($path, '/');
55 55
 		}
56 56
 	}
57 57
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$rootLength = strlen($this->root) + 1;
67 67
 		if ($path === $this->root) {
68 68
 			return '';
69
-		} else if (substr($path, 0, $rootLength) === $this->root . '/') {
69
+		} else if (substr($path, 0, $rootLength) === $this->root.'/') {
70 70
 			return substr($path, $rootLength);
71 71
 		} else {
72 72
 			return null;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 	protected function filterCacheEntry($entry) {
88 88
 		$rootLength = strlen($this->root) + 1;
89
-		return ($entry['path'] === $this->root) or (substr($entry['path'], 0, $rootLength) === $this->root . '/');
89
+		return ($entry['path'] === $this->root) or (substr($entry['path'], 0, $rootLength) === $this->root.'/');
90 90
 	}
91 91
 
92 92
 	/**
Please login to merge, or discard this patch.
lib/private/Files/Cache/Storage.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 		$this->storageId = self::adjustStorageId($this->storageId);
70 70
 
71 71
 		if ($row = self::getStorageById($this->storageId)) {
72
-			$this->numericId = (int)$row['numeric_id'];
72
+			$this->numericId = (int) $row['numeric_id'];
73 73
 		} else {
74 74
 			$connection = \OC::$server->getDatabaseConnection();
75 75
 			$available = $isAvailable ? 1 : 0;
76 76
 			if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $available])) {
77
-				$this->numericId = (int)$connection->lastInsertId('*PREFIX*storages');
77
+				$this->numericId = (int) $connection->lastInsertId('*PREFIX*storages');
78 78
 			} else {
79 79
 				if ($row = self::getStorageById($this->storageId)) {
80
-					$this->numericId = (int)$row['numeric_id'];
80
+					$this->numericId = (int) $row['numeric_id'];
81 81
 				} else {
82 82
 					throw new \RuntimeException('Storage could neither be inserted nor be selected from the database');
83 83
 				}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		$storageId = self::adjustStorageId($storageId);
143 143
 
144 144
 		if ($row = self::getStorageById($storageId)) {
145
-			return (int)$row['numeric_id'];
145
+			return (int) $row['numeric_id'];
146 146
 		} else {
147 147
 			return null;
148 148
 		}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	public function getAvailability() {
155 155
 		if ($row = self::getStorageById($this->storageId)) {
156 156
 			return [
157
-				'available' => ((int)$row['available'] === 1),
157
+				'available' => ((int) $row['available'] === 1),
158 158
 				'last_checked' => $row['last_checked']
159 159
 			];
160 160
 		} else {
Please login to merge, or discard this patch.
lib/private/Files/Cache/CacheEntry.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 	}
59 59
 
60 60
 	public function getId() {
61
-		return (int)$this->data['fileid'];
61
+		return (int) $this->data['fileid'];
62 62
 	}
63 63
 
64 64
 	public function getStorageId() {
Please login to merge, or discard this patch.
lib/private/Files/Cache/Propagator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @param int $sizeDifference number of bytes the file has grown
61 61
 	 */
62 62
 	public function propagateChange($internalPath, $time, $sizeDifference = 0) {
63
-		$storageId = (int)$this->storage->getStorageCache()->getNumericId();
63
+		$storageId = (int) $this->storage->getStorageCache()->getNumericId();
64 64
 
65 65
 		$parents = $this->getParents($internalPath);
66 66
 
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		$etag = uniqid(); // since we give all folders the same etag we don't ask the storage for the etag
76 76
 
77 77
 		$builder = $this->connection->getQueryBuilder();
78
-		$hashParams = array_map(function ($hash) use ($builder) {
78
+		$hashParams = array_map(function($hash) use ($builder) {
79 79
 			return $builder->expr()->literal($hash);
80 80
 		}, $parentHashes);
81 81
 
82 82
 		$builder->update('filecache')
83
-			->set('mtime', $builder->createFunction('GREATEST(`mtime`, ' . $builder->createNamedParameter((int)$time, IQueryBuilder::PARAM_INT) . ')'))
83
+			->set('mtime', $builder->createFunction('GREATEST(`mtime`, '.$builder->createNamedParameter((int) $time, IQueryBuilder::PARAM_INT).')'))
84 84
 			->set('etag', $builder->createNamedParameter($etag, IQueryBuilder::PARAM_STR))
85 85
 			->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
86 86
 			->andWhere($builder->expr()->in('path_hash', $hashParams));
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			// we need to do size separably so we can ignore entries with uncalculated size
92 92
 			$builder = $this->connection->getQueryBuilder();
93 93
 			$builder->update('filecache')
94
-				->set('size', $builder->createFunction('`size` + ' . $builder->createNamedParameter($sizeDifference)))
94
+				->set('size', $builder->createFunction('`size` + '.$builder->createNamedParameter($sizeDifference)))
95 95
 				->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
96 96
 				->andWhere($builder->expr()->in('path_hash', $hashParams))
97 97
 				->andWhere($builder->expr()->gt('size', $builder->expr()->literal(-1, IQueryBuilder::PARAM_INT)));
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		$parents = [];
107 107
 		foreach ($parts as $part) {
108 108
 			$parents[] = $parent;
109
-			$parent = trim($parent . '/' . $part, '/');
109
+			$parent = trim($parent.'/'.$part, '/');
110 110
 		}
111 111
 		return $parents;
112 112
 	}
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 		$this->connection->beginTransaction();
151 151
 
152 152
 		$query = $this->connection->getQueryBuilder();
153
-		$storageId = (int)$this->storage->getStorageCache()->getNumericId();
153
+		$storageId = (int) $this->storage->getStorageCache()->getNumericId();
154 154
 
155 155
 		$query->update('filecache')
156
-			->set('mtime', $query->createFunction('GREATEST(`mtime`, ' . $query->createParameter('time') . ')'))
156
+			->set('mtime', $query->createFunction('GREATEST(`mtime`, '.$query->createParameter('time').')'))
157 157
 			->set('etag', $query->expr()->literal(uniqid()))
158 158
 			->where($query->expr()->eq('storage', $query->expr()->literal($storageId, IQueryBuilder::PARAM_INT)))
159 159
 			->andWhere($query->expr()->eq('path_hash', $query->createParameter('hash')));
160 160
 
161 161
 		$sizeQuery = $this->connection->getQueryBuilder();
162 162
 		$sizeQuery->update('filecache')
163
-			->set('size', $sizeQuery->createFunction('`size` + ' . $sizeQuery->createParameter('size')))
163
+			->set('size', $sizeQuery->createFunction('`size` + '.$sizeQuery->createParameter('size')))
164 164
 			->where($query->expr()->eq('storage', $query->expr()->literal($storageId, IQueryBuilder::PARAM_INT)))
165 165
 			->andWhere($query->expr()->eq('path_hash', $query->createParameter('hash')))
166 166
 			->andWhere($sizeQuery->expr()->gt('size', $sizeQuery->expr()->literal(-1, IQueryBuilder::PARAM_INT)));
Please login to merge, or discard this patch.
lib/private/Files/Cache/HomeCache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@
 block discarded – undo
51 51
 		}
52 52
 		if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
53 53
 			$id = $entry['fileid'];
54
-			$sql = 'SELECT SUM(`size`) AS f1 ' .
55
-			   'FROM `*PREFIX*filecache` ' .
54
+			$sql = 'SELECT SUM(`size`) AS f1 '.
55
+			   'FROM `*PREFIX*filecache` '.
56 56
 				'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0';
57 57
 			$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
58 58
 			if ($row = $result->fetchRow()) {
Please login to merge, or discard this patch.
lib/private/Files/Cache/MoveFromCacheTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 		if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) {
68 68
 			$folderContent = $sourceCache->getFolderContentsById($sourceEntry->getId());
69 69
 			foreach ($folderContent as $subEntry) {
70
-				$subTargetPath = $targetPath . '/' . $subEntry->getName();
70
+				$subTargetPath = $targetPath.'/'.$subEntry->getName();
71 71
 				$this->copyFromCache($sourceCache, $subEntry, $subTargetPath);
72 72
 			}
73 73
 		}
Please login to merge, or discard this patch.
lib/private/Lock/DBLockingProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		}
137 137
 		$query = $this->connection->prepare('SELECT `lock` from `*PREFIX*file_locks` WHERE `key` = ?');
138 138
 		$query->execute([$path]);
139
-		$lockValue = (int)$query->fetchColumn();
139
+		$lockValue = (int) $query->fetchColumn();
140 140
 		if ($type === self::LOCK_SHARED) {
141 141
 			if ($this->isLocallyLocked($path)) {
142 142
 				// if we have a shared lock we kept open locally but it's released we always have at least 1 shared lock in the db
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
 		// since we keep shared locks we need to manually clean those
263 263
 		$lockedPaths = array_keys($this->sharedLocks);
264
-		$lockedPaths = array_filter($lockedPaths, function ($path) {
264
+		$lockedPaths = array_filter($lockedPaths, function($path) {
265 265
 			return $this->sharedLocks[$path];
266 266
 		});
267 267
 
Please login to merge, or discard this patch.