@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | protected function buildPath($path) { |
| 59 | - $fullPath = \OC\Files\Filesystem::normalizePath($this->root . '/' . $path); |
|
| 59 | + $fullPath = \OC\Files\Filesystem::normalizePath($this->root.'/'.$path); |
|
| 60 | 60 | return ltrim($fullPath, '/'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } catch (FileNotFoundException $e) { |
| 164 | 164 | return false; |
| 165 | 165 | } |
| 166 | - $names = array_map(function ($object) { |
|
| 166 | + $names = array_map(function($object) { |
|
| 167 | 167 | return $object['basename']; |
| 168 | 168 | }, $content); |
| 169 | 169 | return IteratorDirectory::wrap($names); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $tmpFile = \OCP\Files::tmpFile(); |
| 210 | 210 | } |
| 211 | 211 | $source = fopen($tmpFile, $mode); |
| 212 | - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) { |
|
| 212 | + return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath) { |
|
| 213 | 213 | $this->flysystem->putStream($fullPath, fopen($tmpFile, 'r')); |
| 214 | 214 | unlink($tmpFile); |
| 215 | 215 | }); |
@@ -32,7 +32,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -69,15 +69,15 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 { |
@@ -58,7 +58,7 @@ |
||
| 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() { |
@@ -51,8 +51,8 @@ |
||
| 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()) { |
@@ -67,7 +67,7 @@ |
||
| 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 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -51,19 +51,19 @@ |
||
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | // create audio result |
| 54 | - if($fileData['mimepart'] === 'audio'){ |
|
| 54 | + if ($fileData['mimepart'] === 'audio') { |
|
| 55 | 55 | $result = new \OC\Search\Result\Audio($fileData); |
| 56 | 56 | } |
| 57 | 57 | // create image result |
| 58 | - elseif($fileData['mimepart'] === 'image'){ |
|
| 58 | + elseif ($fileData['mimepart'] === 'image') { |
|
| 59 | 59 | $result = new \OC\Search\Result\Image($fileData); |
| 60 | 60 | } |
| 61 | 61 | // create folder result |
| 62 | - elseif($fileData['mimetype'] === 'httpd/unix-directory'){ |
|
| 62 | + elseif ($fileData['mimetype'] === 'httpd/unix-directory') { |
|
| 63 | 63 | $result = new \OC\Search\Result\Folder($fileData); |
| 64 | 64 | } |
| 65 | 65 | // or create file result |
| 66 | - else{ |
|
| 66 | + else { |
|
| 67 | 67 | $result = new \OC\Search\Result\File($fileData); |
| 68 | 68 | } |
| 69 | 69 | // add to results |