@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | $path = '/'; |
128 | 128 | } |
129 | 129 | if ($path[0] !== '/') { |
130 | - $path = '/' . $path; |
|
130 | + $path = '/'.$path; |
|
131 | 131 | } |
132 | - return $this->fakeRoot . $path; |
|
132 | + return $this->fakeRoot.$path; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function chroot($fakeRoot) { |
142 | 142 | if (!$fakeRoot == '') { |
143 | 143 | if ($fakeRoot[0] !== '/') { |
144 | - $fakeRoot = '/' . $fakeRoot; |
|
144 | + $fakeRoot = '/'.$fakeRoot; |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | $this->fakeRoot = $fakeRoot; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | // missing slashes can cause wrong matches! |
176 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
176 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
177 | 177 | |
178 | 178 | if (strpos($path, $root) !== 0) { |
179 | 179 | return null; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | if ($mount instanceof MoveableMount) { |
280 | 280 | // cut of /user/files to get the relative path to data/user/files |
281 | 281 | $pathParts = explode('/', $path, 4); |
282 | - $relPath = '/' . $pathParts[3]; |
|
282 | + $relPath = '/'.$pathParts[3]; |
|
283 | 283 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
284 | 284 | \OC_Hook::emit( |
285 | 285 | Filesystem::CLASSNAME, "umount", |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | } |
700 | 700 | $postFix = (substr($path, -1) === '/') ? '/' : ''; |
701 | 701 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
702 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
702 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
703 | 703 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
704 | 704 | return $this->removeMount($mount, $absolutePath); |
705 | 705 | } |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); |
820 | 820 | } |
821 | 821 | } |
822 | - } catch(\Exception $e) { |
|
822 | + } catch (\Exception $e) { |
|
823 | 823 | throw $e; |
824 | 824 | } finally { |
825 | 825 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | } |
844 | 844 | } |
845 | 845 | } |
846 | - } catch(\Exception $e) { |
|
846 | + } catch (\Exception $e) { |
|
847 | 847 | throw $e; |
848 | 848 | } finally { |
849 | 849 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | $hooks[] = 'write'; |
977 | 977 | break; |
978 | 978 | default: |
979 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR); |
|
979 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, ILogger::ERROR); |
|
980 | 980 | } |
981 | 981 | |
982 | 982 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | array(Filesystem::signal_param_path => $this->getHookPath($path)) |
1081 | 1081 | ); |
1082 | 1082 | } |
1083 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1083 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1084 | 1084 | if ($storage) { |
1085 | 1085 | return $storage->hash($type, $internalPath, $raw); |
1086 | 1086 | } |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | |
1135 | 1135 | $run = $this->runHooks($hooks, $path); |
1136 | 1136 | /** @var \OC\Files\Storage\Storage $storage */ |
1137 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1137 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1138 | 1138 | if ($run and $storage) { |
1139 | 1139 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
1140 | 1140 | $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE); |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | $unlockLater = true; |
1174 | 1174 | // make sure our unlocking callback will still be called if connection is aborted |
1175 | 1175 | ignore_user_abort(true); |
1176 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
1176 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
1177 | 1177 | if (in_array('write', $hooks)) { |
1178 | 1178 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
1179 | 1179 | } else if (in_array('read', $hooks)) { |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | return true; |
1235 | 1235 | } |
1236 | 1236 | |
1237 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
1237 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | /** |
@@ -1253,7 +1253,7 @@ discard block |
||
1253 | 1253 | if ($hook != 'read') { |
1254 | 1254 | \OC_Hook::emit( |
1255 | 1255 | Filesystem::CLASSNAME, |
1256 | - $prefix . $hook, |
|
1256 | + $prefix.$hook, |
|
1257 | 1257 | array( |
1258 | 1258 | Filesystem::signal_param_run => &$run, |
1259 | 1259 | Filesystem::signal_param_path => $path |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | } elseif (!$post) { |
1263 | 1263 | \OC_Hook::emit( |
1264 | 1264 | Filesystem::CLASSNAME, |
1265 | - $prefix . $hook, |
|
1265 | + $prefix.$hook, |
|
1266 | 1266 | array( |
1267 | 1267 | Filesystem::signal_param_path => $path |
1268 | 1268 | ) |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | return $this->getPartFileInfo($path); |
1358 | 1358 | } |
1359 | 1359 | $relativePath = $path; |
1360 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1360 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1361 | 1361 | |
1362 | 1362 | $mount = Filesystem::getMountManager()->find($path); |
1363 | 1363 | if (!$mount) { |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | //add the sizes of other mount points to the folder |
1385 | 1385 | $extOnly = ($includeMountPoints === 'ext'); |
1386 | 1386 | $mounts = Filesystem::getMountManager()->findIn($path); |
1387 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
1387 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
1388 | 1388 | $subStorage = $mount->getStorage(); |
1389 | 1389 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
1390 | 1390 | })); |
@@ -1434,12 +1434,12 @@ discard block |
||
1434 | 1434 | /** |
1435 | 1435 | * @var \OC\Files\FileInfo[] $files |
1436 | 1436 | */ |
1437 | - $files = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1437 | + $files = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1438 | 1438 | if ($sharingDisabled) { |
1439 | 1439 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
1440 | 1440 | } |
1441 | 1441 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
1442 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1442 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1443 | 1443 | }, $contents); |
1444 | 1444 | |
1445 | 1445 | //add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | } catch (\Exception $e) { |
1464 | 1464 | // sometimes when the storage is not available it can be any exception |
1465 | 1465 | \OC::$server->getLogger()->logException($e, [ |
1466 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', |
|
1466 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', |
|
1467 | 1467 | 'level' => ILogger::ERROR, |
1468 | 1468 | 'app' => 'lib', |
1469 | 1469 | ]); |
@@ -1501,7 +1501,7 @@ discard block |
||
1501 | 1501 | break; |
1502 | 1502 | } |
1503 | 1503 | } |
1504 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1504 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1505 | 1505 | |
1506 | 1506 | // if sharing was disabled for the user we remove the share permissions |
1507 | 1507 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1509,14 +1509,14 @@ discard block |
||
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
1512 | - $files[] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1512 | + $files[] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1513 | 1513 | } |
1514 | 1514 | } |
1515 | 1515 | } |
1516 | 1516 | } |
1517 | 1517 | |
1518 | 1518 | if ($mimetype_filter) { |
1519 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
1519 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
1520 | 1520 | if (strpos($mimetype_filter, '/')) { |
1521 | 1521 | return $file->getMimetype() === $mimetype_filter; |
1522 | 1522 | } else { |
@@ -1545,7 +1545,7 @@ discard block |
||
1545 | 1545 | if ($data instanceof FileInfo) { |
1546 | 1546 | $data = $data->getData(); |
1547 | 1547 | } |
1548 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1548 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1549 | 1549 | /** |
1550 | 1550 | * @var \OC\Files\Storage\Storage $storage |
1551 | 1551 | * @var string $internalPath |
@@ -1572,7 +1572,7 @@ discard block |
||
1572 | 1572 | * @return FileInfo[] |
1573 | 1573 | */ |
1574 | 1574 | public function search($query) { |
1575 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
1575 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
1576 | 1576 | } |
1577 | 1577 | |
1578 | 1578 | /** |
@@ -1623,10 +1623,10 @@ discard block |
||
1623 | 1623 | |
1624 | 1624 | $results = call_user_func_array(array($cache, $method), $args); |
1625 | 1625 | foreach ($results as $result) { |
1626 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
1626 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
1627 | 1627 | $internalPath = $result['path']; |
1628 | - $path = $mountPoint . $result['path']; |
|
1629 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
1628 | + $path = $mountPoint.$result['path']; |
|
1629 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
1630 | 1630 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1631 | 1631 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1632 | 1632 | } |
@@ -1644,8 +1644,8 @@ discard block |
||
1644 | 1644 | if ($results) { |
1645 | 1645 | foreach ($results as $result) { |
1646 | 1646 | $internalPath = $result['path']; |
1647 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
1648 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
1647 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
1648 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
1649 | 1649 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1650 | 1650 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1651 | 1651 | } |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | public function getOwner($path) { |
1667 | 1667 | $info = $this->getFileInfo($path); |
1668 | 1668 | if (!$info) { |
1669 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
1669 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
1670 | 1670 | } |
1671 | 1671 | return $info->getOwner()->getUID(); |
1672 | 1672 | } |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | * @return string |
1701 | 1701 | */ |
1702 | 1702 | public function getPath($id) { |
1703 | - $id = (int)$id; |
|
1703 | + $id = (int) $id; |
|
1704 | 1704 | $manager = Filesystem::getMountManager(); |
1705 | 1705 | $mounts = $manager->findIn($this->fakeRoot); |
1706 | 1706 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1715,7 +1715,7 @@ discard block |
||
1715 | 1715 | $cache = $mount->getStorage()->getCache(); |
1716 | 1716 | $internalPath = $cache->getPathById($id); |
1717 | 1717 | if (is_string($internalPath)) { |
1718 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
1718 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
1719 | 1719 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
1720 | 1720 | return $path; |
1721 | 1721 | } |
@@ -1758,10 +1758,10 @@ discard block |
||
1758 | 1758 | } |
1759 | 1759 | |
1760 | 1760 | // note: cannot use the view because the target is already locked |
1761 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
1761 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
1762 | 1762 | if ($fileId === -1) { |
1763 | 1763 | // target might not exist, need to check parent instead |
1764 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1764 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1765 | 1765 | } |
1766 | 1766 | |
1767 | 1767 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1861,7 +1861,7 @@ discard block |
||
1861 | 1861 | $resultPath = ''; |
1862 | 1862 | foreach ($parts as $part) { |
1863 | 1863 | if ($part) { |
1864 | - $resultPath .= '/' . $part; |
|
1864 | + $resultPath .= '/'.$part; |
|
1865 | 1865 | $result[] = $resultPath; |
1866 | 1866 | } |
1867 | 1867 | } |
@@ -2124,16 +2124,16 @@ discard block |
||
2124 | 2124 | public function getUidAndFilename($filename) { |
2125 | 2125 | $info = $this->getFileInfo($filename); |
2126 | 2126 | if (!$info instanceof \OCP\Files\FileInfo) { |
2127 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
2127 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
2128 | 2128 | } |
2129 | 2129 | $uid = $info->getOwner()->getUID(); |
2130 | 2130 | if ($uid != \OCP\User::getUser()) { |
2131 | 2131 | Filesystem::initMountPoints($uid); |
2132 | - $ownerView = new View('/' . $uid . '/files'); |
|
2132 | + $ownerView = new View('/'.$uid.'/files'); |
|
2133 | 2133 | try { |
2134 | 2134 | $filename = $ownerView->getPath($info['fileid']); |
2135 | 2135 | } catch (NotFoundException $e) { |
2136 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
2136 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
2137 | 2137 | } |
2138 | 2138 | } |
2139 | 2139 | return [$uid, $filename]; |
@@ -2150,7 +2150,7 @@ discard block |
||
2150 | 2150 | $directoryParts = array_filter($directoryParts); |
2151 | 2151 | foreach ($directoryParts as $key => $part) { |
2152 | 2152 | $currentPathElements = array_slice($directoryParts, 0, $key); |
2153 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
2153 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
2154 | 2154 | if ($this->is_file($currentPath)) { |
2155 | 2155 | return false; |
2156 | 2156 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } else { |
107 | 107 | // Update old classes to new namespace |
108 | 108 | if (strpos($storage, 'OC_Filestorage_') !== false) { |
109 | - $storage = '\OC\Files\Storage\\' . substr($storage, 15); |
|
109 | + $storage = '\OC\Files\Storage\\'.substr($storage, 15); |
|
110 | 110 | } |
111 | 111 | $this->class = $storage; |
112 | 112 | $this->arguments = $arguments; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | return; |
159 | 159 | } |
160 | 160 | } else { |
161 | - \OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', ILogger::ERROR); |
|
161 | + \OCP\Util::writeLog('core', 'storage backend '.$this->class.' not found', ILogger::ERROR); |
|
162 | 162 | $this->invalidStorage = true; |
163 | 163 | return; |
164 | 164 | } |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function getInternalPath($path) { |
210 | 210 | $path = Filesystem::normalizePath($path, true, false, true); |
211 | - if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) { |
|
211 | + if ($this->mountPoint === $path or $this->mountPoint.'/' === $path) { |
|
212 | 212 | $internalPath = ''; |
213 | 213 | } else { |
214 | 214 | $internalPath = substr($path, strlen($this->mountPoint)); |
215 | 215 | } |
216 | 216 | // substr returns false instead of an empty string, we always want a string |
217 | - return (string)$internalPath; |
|
217 | + return (string) $internalPath; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function getStorageRootId() { |
269 | 269 | if (is_null($this->rootId)) { |
270 | - $this->rootId = (int)$this->getStorage()->getCache()->getId(''); |
|
270 | + $this->rootId = (int) $this->getStorage()->getCache()->getId(''); |
|
271 | 271 | } |
272 | 272 | return $this->rootId; |
273 | 273 | } |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | // check if the file is stored in the array cache, this means that we |
369 | 369 | // copy a file over to the versions folder, in this case we don't want to |
370 | 370 | // decrypt it |
371 | - if ($this->arrayCache->hasKey('encryption_copy_version_' . $path)) { |
|
372 | - $this->arrayCache->remove('encryption_copy_version_' . $path); |
|
371 | + if ($this->arrayCache->hasKey('encryption_copy_version_'.$path)) { |
|
372 | + $this->arrayCache->remove('encryption_copy_version_'.$path); |
|
373 | 373 | return $this->storage->fopen($path, $mode); |
374 | 374 | } |
375 | 375 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | } |
441 | 441 | } catch (ModuleDoesNotExistsException $e) { |
442 | 442 | $this->logger->logException($e, [ |
443 | - 'message' => 'Encryption module "' . $encryptionModuleId . '" not found, file will be stored unencrypted', |
|
443 | + 'message' => 'Encryption module "'.$encryptionModuleId.'" not found, file will be stored unencrypted', |
|
444 | 444 | 'level' => ILogger::WARN, |
445 | 445 | 'app' => 'core', |
446 | 446 | ]); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | try { |
496 | 496 | $result = $this->fixUnencryptedSize($path, $size, $unencryptedSize); |
497 | 497 | } catch (\Exception $e) { |
498 | - $this->logger->error('Couldn\'t re-calculate unencrypted size for '. $path); |
|
498 | + $this->logger->error('Couldn\'t re-calculate unencrypted size for '.$path); |
|
499 | 499 | $this->logger->logException($e); |
500 | 500 | } |
501 | 501 | unset($this->fixUnencryptedSizeOf[$this->getFullPath($path)]); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | |
525 | 525 | // if we couldn't open the file we return the old unencrypted size |
526 | 526 | if (!is_resource($stream)) { |
527 | - $this->logger->error('Could not open ' . $path . '. Recalculation of unencrypted size aborted.'); |
|
527 | + $this->logger->error('Could not open '.$path.'. Recalculation of unencrypted size aborted.'); |
|
528 | 528 | return $unencryptedSize; |
529 | 529 | } |
530 | 530 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | // next highest is end of chunks, one subtracted is last one |
550 | 550 | // we have to read the last chunk, we can't just calculate it (because of padding etc) |
551 | 551 | |
552 | - $lastChunkNr = ceil($size/ $blockSize)-1; |
|
552 | + $lastChunkNr = ceil($size / $blockSize) - 1; |
|
553 | 553 | // calculate last chunk position |
554 | 554 | $lastChunkPos = ($lastChunkNr * $blockSize); |
555 | 555 | // try to fseek to the last chunk, if it fails we have to read the whole file |
@@ -557,16 +557,16 @@ discard block |
||
557 | 557 | $newUnencryptedSize += $lastChunkNr * $unencryptedBlockSize; |
558 | 558 | } |
559 | 559 | |
560 | - $lastChunkContentEncrypted=''; |
|
560 | + $lastChunkContentEncrypted = ''; |
|
561 | 561 | $count = $blockSize; |
562 | 562 | |
563 | 563 | while ($count > 0) { |
564 | - $data=fread($stream, $blockSize); |
|
565 | - $count=strlen($data); |
|
564 | + $data = fread($stream, $blockSize); |
|
565 | + $count = strlen($data); |
|
566 | 566 | $lastChunkContentEncrypted .= $data; |
567 | - if(strlen($lastChunkContentEncrypted) > $blockSize) { |
|
567 | + if (strlen($lastChunkContentEncrypted) > $blockSize) { |
|
568 | 568 | $newUnencryptedSize += $unencryptedBlockSize; |
569 | - $lastChunkContentEncrypted=substr($lastChunkContentEncrypted, $blockSize); |
|
569 | + $lastChunkContentEncrypted = substr($lastChunkContentEncrypted, $blockSize); |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | |
575 | 575 | // we have to decrypt the last chunk to get it actual size |
576 | 576 | $encryptionModule->begin($this->getFullPath($path), $this->uid, 'r', $header, []); |
577 | - $decryptedLastChunk = $encryptionModule->decrypt($lastChunkContentEncrypted, $lastChunkNr . 'end'); |
|
578 | - $decryptedLastChunk .= $encryptionModule->end($this->getFullPath($path), $lastChunkNr . 'end'); |
|
577 | + $decryptedLastChunk = $encryptionModule->decrypt($lastChunkContentEncrypted, $lastChunkNr.'end'); |
|
578 | + $decryptedLastChunk .= $encryptionModule->end($this->getFullPath($path), $lastChunkNr.'end'); |
|
579 | 579 | |
580 | 580 | // calc the real file size with the size of the last chunk |
581 | 581 | $newUnencryptedSize += strlen($decryptedLastChunk); |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | $cacheInformation = [ |
660 | 660 | 'encrypted' => $isEncrypted, |
661 | 661 | ]; |
662 | - if($isEncrypted) { |
|
662 | + if ($isEncrypted) { |
|
663 | 663 | $encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion']; |
664 | 664 | |
665 | 665 | // In case of a move operation from an unencrypted to an encrypted |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | // correct value would be "1". Thus we manually set the value to "1" |
668 | 668 | // for those cases. |
669 | 669 | // See also https://github.com/owncloud/core/issues/23078 |
670 | - if($encryptedVersion === 0 || !$keepEncryptionVersion) { |
|
670 | + if ($encryptedVersion === 0 || !$keepEncryptionVersion) { |
|
671 | 671 | $encryptedVersion = 1; |
672 | 672 | } |
673 | 673 | |
@@ -703,9 +703,9 @@ discard block |
||
703 | 703 | // remember that we try to create a version so that we can detect it during |
704 | 704 | // fopen($sourceInternalPath) and by-pass the encryption in order to |
705 | 705 | // create a 1:1 copy of the file |
706 | - $this->arrayCache->set('encryption_copy_version_' . $sourceInternalPath, true); |
|
706 | + $this->arrayCache->set('encryption_copy_version_'.$sourceInternalPath, true); |
|
707 | 707 | $result = $this->storage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); |
708 | - $this->arrayCache->remove('encryption_copy_version_' . $sourceInternalPath); |
|
708 | + $this->arrayCache->remove('encryption_copy_version_'.$sourceInternalPath); |
|
709 | 709 | if ($result) { |
710 | 710 | $info = $this->getCache('', $sourceStorage)->get($sourceInternalPath); |
711 | 711 | // make sure that we update the unencrypted size for the version |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | $mount = $this->mountManager->findByStorageId($sourceStorage->getId()); |
726 | 726 | if (count($mount) === 1) { |
727 | 727 | $mountPoint = $mount[0]->getMountPoint(); |
728 | - $source = $mountPoint . '/' . $sourceInternalPath; |
|
728 | + $source = $mountPoint.'/'.$sourceInternalPath; |
|
729 | 729 | $target = $this->getFullPath($targetInternalPath); |
730 | 730 | $this->copyKeys($source, $target); |
731 | 731 | } else { |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | if (is_resource($dh)) { |
739 | 739 | while ($result and ($file = readdir($dh)) !== false) { |
740 | 740 | if (!Filesystem::isIgnoredDir($file)) { |
741 | - $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file, false, $isRename); |
|
741 | + $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath.'/'.$file, $targetInternalPath.'/'.$file, false, $isRename); |
|
742 | 742 | } |
743 | 743 | } |
744 | 744 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | fclose($target); |
755 | 755 | throw $e; |
756 | 756 | } |
757 | - if($result) { |
|
757 | + if ($result) { |
|
758 | 758 | if ($preserveMtime) { |
759 | 759 | $this->touch($targetInternalPath, $sourceStorage->filemtime($sourceInternalPath)); |
760 | 760 | } |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | $this->getCache()->remove($targetInternalPath); |
767 | 767 | } |
768 | 768 | } |
769 | - return (bool)$result; |
|
769 | + return (bool) $result; |
|
770 | 770 | |
771 | 771 | } |
772 | 772 | |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | * @return string full path including mount point |
838 | 838 | */ |
839 | 839 | protected function getFullPath($path) { |
840 | - return Filesystem::normalizePath($this->mountPoint . '/' . $path); |
|
840 | + return Filesystem::normalizePath($this->mountPoint.'/'.$path); |
|
841 | 841 | } |
842 | 842 | |
843 | 843 | /** |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | $header = substr($header, 0, $endAt + strlen(Util::HEADER_END)); |
894 | 894 | |
895 | 895 | // +1 to not start with an ':' which would result in empty element at the beginning |
896 | - $exploded = explode(':', substr($header, strlen(Util::HEADER_START)+1)); |
|
896 | + $exploded = explode(':', substr($header, strlen(Util::HEADER_START) + 1)); |
|
897 | 897 | |
898 | 898 | $element = array_shift($exploded); |
899 | 899 | while ($element !== Util::HEADER_END) { |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | try { |
957 | 957 | $encryptionModule = $this->encryptionManager->getEncryptionModule($encryptionModuleId); |
958 | 958 | } catch (ModuleDoesNotExistsException $e) { |
959 | - $this->logger->critical('Encryption module defined in "' . $path . '" not loaded!'); |
|
959 | + $this->logger->critical('Encryption module defined in "'.$path.'" not loaded!'); |
|
960 | 960 | throw $e; |
961 | 961 | } |
962 | 962 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->realDataDir = $this->datadir; |
67 | 67 | } else { |
68 | 68 | $realPath = realpath($this->datadir) ?: $this->datadir; |
69 | - $this->realDataDir = rtrim($realPath, '/') . '/'; |
|
69 | + $this->realDataDir = rtrim($realPath, '/').'/'; |
|
70 | 70 | } |
71 | 71 | if (substr($this->datadir, -1) !== '/') { |
72 | 72 | $this->datadir .= '/'; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | public function getId() { |
81 | - return 'local::' . $this->datadir; |
|
81 | + return 'local::'.$this->datadir; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | public function mkdir($path) { |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | $dstParent = dirname($path2); |
237 | 237 | |
238 | 238 | if (!$this->isUpdatable($srcParent)) { |
239 | - \OCP\Util::writeLog('core', 'unable to rename, source directory is not writable : ' . $srcParent, ILogger::ERROR); |
|
239 | + \OCP\Util::writeLog('core', 'unable to rename, source directory is not writable : '.$srcParent, ILogger::ERROR); |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
243 | 243 | if (!$this->isUpdatable($dstParent)) { |
244 | - \OCP\Util::writeLog('core', 'unable to rename, destination directory is not writable : ' . $dstParent, ILogger::ERROR); |
|
244 | + \OCP\Util::writeLog('core', 'unable to rename, destination directory is not writable : '.$dstParent, ILogger::ERROR); |
|
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | |
248 | 248 | if (!$this->file_exists($path1)) { |
249 | - \OCP\Util::writeLog('core', 'unable to rename, file does not exists : ' . $path1, ILogger::ERROR); |
|
249 | + \OCP\Util::writeLog('core', 'unable to rename, file does not exists : '.$path1, ILogger::ERROR); |
|
250 | 250 | return false; |
251 | 251 | } |
252 | 252 | |
@@ -327,13 +327,13 @@ discard block |
||
327 | 327 | foreach (scandir($physicalDir) as $item) { |
328 | 328 | if (\OC\Files\Filesystem::isIgnoredDir($item)) |
329 | 329 | continue; |
330 | - $physicalItem = $physicalDir . '/' . $item; |
|
330 | + $physicalItem = $physicalDir.'/'.$item; |
|
331 | 331 | |
332 | 332 | if (strstr(strtolower($item), strtolower($query)) !== false) { |
333 | - $files[] = $dir . '/' . $item; |
|
333 | + $files[] = $dir.'/'.$item; |
|
334 | 334 | } |
335 | 335 | if (is_dir($physicalItem)) { |
336 | - $files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item)); |
|
336 | + $files = array_merge($files, $this->searchInDir($query, $dir.'/'.$item)); |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | return $files; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @throws ForbiddenException |
363 | 363 | */ |
364 | 364 | public function getSourcePath($path) { |
365 | - $fullPath = $this->datadir . $path; |
|
365 | + $fullPath = $this->datadir.$path; |
|
366 | 366 | $currentPath = $path; |
367 | 367 | if ($this->allowSymlinks || $currentPath === '') { |
368 | 368 | return $fullPath; |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | if ($currentPath === '' || $currentPath === '.') { |
375 | 375 | return $fullPath; |
376 | 376 | } |
377 | - $realPath = realpath($this->datadir . $currentPath); |
|
377 | + $realPath = realpath($this->datadir.$currentPath); |
|
378 | 378 | } |
379 | 379 | if ($realPath) { |
380 | - $realPath = $realPath . '/'; |
|
380 | + $realPath = $realPath.'/'; |
|
381 | 381 | } |
382 | 382 | if (substr($realPath, 0, $this->dataDirLength) === $this->realDataDir) { |
383 | 383 | return $fullPath; |
@@ -404,9 +404,9 @@ discard block |
||
404 | 404 | if ($this->is_file($path)) { |
405 | 405 | $stat = $this->stat($path); |
406 | 406 | return md5( |
407 | - $stat['mtime'] . |
|
408 | - $stat['ino'] . |
|
409 | - $stat['dev'] . |
|
407 | + $stat['mtime']. |
|
408 | + $stat['ino']. |
|
409 | + $stat['dev']. |
|
410 | 410 | $stat['size'] |
411 | 411 | ); |
412 | 412 | } else { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | if (is_string($params['secure'])) { |
104 | 104 | $this->secure = ($params['secure'] === 'true'); |
105 | 105 | } else { |
106 | - $this->secure = (bool)$params['secure']; |
|
106 | + $this->secure = (bool) $params['secure']; |
|
107 | 107 | } |
108 | 108 | } else { |
109 | 109 | $this->secure = false; |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | } |
121 | 121 | } |
122 | 122 | $this->root = $params['root'] ?? '/'; |
123 | - $this->root = '/' . ltrim($this->root, '/'); |
|
124 | - $this->root = rtrim($this->root, '/') . '/'; |
|
123 | + $this->root = '/'.ltrim($this->root, '/'); |
|
124 | + $this->root = rtrim($this->root, '/').'/'; |
|
125 | 125 | } else { |
126 | 126 | throw new \Exception('Invalid webdav storage configuration'); |
127 | 127 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | /** {@inheritdoc} */ |
165 | 165 | public function getId() { |
166 | - return 'webdav::' . $this->user . '@' . $this->host . '/' . $this->root; |
|
166 | + return 'webdav::'.$this->user.'@'.$this->host.'/'.$this->root; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** {@inheritdoc} */ |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if ($this->secure) { |
173 | 173 | $baseUri .= 's'; |
174 | 174 | } |
175 | - $baseUri .= '://' . $this->host . $this->root; |
|
175 | + $baseUri .= '://'.$this->host.$this->root; |
|
176 | 176 | return $baseUri; |
177 | 177 | } |
178 | 178 | |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | $path = $this->cleanPath($path); |
194 | 194 | // FIXME: some WebDAV impl return 403 when trying to DELETE |
195 | 195 | // a non-empty folder |
196 | - $result = $this->simpleResponse('DELETE', $path . '/', null, 204); |
|
197 | - $this->statCache->clear($path . '/'); |
|
196 | + $result = $this->simpleResponse('DELETE', $path.'/', null, 204); |
|
197 | + $this->statCache->clear($path.'/'); |
|
198 | 198 | $this->statCache->remove($path); |
199 | 199 | return $result; |
200 | 200 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $this->statCache->set($path, $response); |
270 | 270 | } catch (ClientHttpException $e) { |
271 | 271 | if ($e->getHttpStatus() === 404) { |
272 | - $this->statCache->clear($path . '/'); |
|
272 | + $this->statCache->clear($path.'/'); |
|
273 | 273 | $this->statCache->set($path, false); |
274 | 274 | return false; |
275 | 275 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $this->init(); |
327 | 327 | $path = $this->cleanPath($path); |
328 | 328 | $result = $this->simpleResponse('DELETE', $path, null, 204); |
329 | - $this->statCache->clear($path . '/'); |
|
329 | + $this->statCache->clear($path.'/'); |
|
330 | 330 | $this->statCache->remove($path); |
331 | 331 | return $result; |
332 | 332 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | try { |
342 | 342 | $response = $this->httpClientService |
343 | 343 | ->newClient() |
344 | - ->get($this->createBaseUri() . $this->encodePath($path), [ |
|
344 | + ->get($this->createBaseUri().$this->encodePath($path), [ |
|
345 | 345 | 'auth' => [$this->user, $this->password], |
346 | 346 | 'stream' => true |
347 | 347 | ]); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | if ($response->getStatusCode() === Http::STATUS_LOCKED) { |
359 | 359 | throw new \OCP\Lock\LockedException($path); |
360 | 360 | } else { |
361 | - Util::writeLog("webdav client", 'Guzzle get returned status code ' . $response->getStatusCode(), ILogger::ERROR); |
|
361 | + Util::writeLog("webdav client", 'Guzzle get returned status code '.$response->getStatusCode(), ILogger::ERROR); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $tmpFile = $tempManager->getTemporaryFile($ext); |
399 | 399 | } |
400 | 400 | $handle = fopen($tmpFile, $mode); |
401 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
401 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
402 | 402 | $this->writeBack($tmpFile, $path); |
403 | 403 | }); |
404 | 404 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | return FileInfo::SPACE_UNKNOWN; |
424 | 424 | } |
425 | 425 | if (isset($response['{DAV:}quota-available-bytes'])) { |
426 | - return (int)$response['{DAV:}quota-available-bytes']; |
|
426 | + return (int) $response['{DAV:}quota-available-bytes']; |
|
427 | 427 | } else { |
428 | 428 | return FileInfo::SPACE_UNKNOWN; |
429 | 429 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | |
500 | 500 | $this->httpClientService |
501 | 501 | ->newClient() |
502 | - ->put($this->createBaseUri() . $this->encodePath($target), [ |
|
502 | + ->put($this->createBaseUri().$this->encodePath($target), [ |
|
503 | 503 | 'body' => $source, |
504 | 504 | 'auth' => [$this->user, $this->password] |
505 | 505 | ]); |
@@ -516,18 +516,18 @@ discard block |
||
516 | 516 | // overwrite directory ? |
517 | 517 | if ($this->is_dir($path2)) { |
518 | 518 | // needs trailing slash in destination |
519 | - $path2 = rtrim($path2, '/') . '/'; |
|
519 | + $path2 = rtrim($path2, '/').'/'; |
|
520 | 520 | } |
521 | 521 | $this->client->request( |
522 | 522 | 'MOVE', |
523 | 523 | $this->encodePath($path1), |
524 | 524 | null, |
525 | 525 | [ |
526 | - 'Destination' => $this->createBaseUri() . $this->encodePath($path2), |
|
526 | + 'Destination' => $this->createBaseUri().$this->encodePath($path2), |
|
527 | 527 | ] |
528 | 528 | ); |
529 | - $this->statCache->clear($path1 . '/'); |
|
530 | - $this->statCache->clear($path2 . '/'); |
|
529 | + $this->statCache->clear($path1.'/'); |
|
530 | + $this->statCache->clear($path2.'/'); |
|
531 | 531 | $this->statCache->set($path1, false); |
532 | 532 | $this->statCache->set($path2, true); |
533 | 533 | $this->removeCachedFile($path1); |
@@ -548,17 +548,17 @@ discard block |
||
548 | 548 | // overwrite directory ? |
549 | 549 | if ($this->is_dir($path2)) { |
550 | 550 | // needs trailing slash in destination |
551 | - $path2 = rtrim($path2, '/') . '/'; |
|
551 | + $path2 = rtrim($path2, '/').'/'; |
|
552 | 552 | } |
553 | 553 | $this->client->request( |
554 | 554 | 'COPY', |
555 | 555 | $this->encodePath($path1), |
556 | 556 | null, |
557 | 557 | [ |
558 | - 'Destination' => $this->createBaseUri() . $this->encodePath($path2), |
|
558 | + 'Destination' => $this->createBaseUri().$this->encodePath($path2), |
|
559 | 559 | ] |
560 | 560 | ); |
561 | - $this->statCache->clear($path2 . '/'); |
|
561 | + $this->statCache->clear($path2.'/'); |
|
562 | 562 | $this->statCache->set($path2, true); |
563 | 563 | $this->removeCachedFile($path2); |
564 | 564 | return true; |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | return [ |
579 | 579 | 'mtime' => strtotime($response['{DAV:}getlastmodified']), |
580 | - 'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, |
|
580 | + 'size' => (int) isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, |
|
581 | 581 | ]; |
582 | 582 | } catch (\Exception $e) { |
583 | 583 | $this->convertException($e, $path); |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | return $response['statusCode'] == $expected; |
660 | 660 | } catch (ClientHttpException $e) { |
661 | 661 | if ($e->getHttpStatus() === 404 && $method === 'DELETE') { |
662 | - $this->statCache->clear($path . '/'); |
|
662 | + $this->statCache->clear($path.'/'); |
|
663 | 663 | $this->statCache->set($path, false); |
664 | 664 | return false; |
665 | 665 | } |
@@ -680,22 +680,22 @@ discard block |
||
680 | 680 | |
681 | 681 | /** {@inheritdoc} */ |
682 | 682 | public function isUpdatable($path) { |
683 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_UPDATE); |
|
683 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_UPDATE); |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | /** {@inheritdoc} */ |
687 | 687 | public function isCreatable($path) { |
688 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_CREATE); |
|
688 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_CREATE); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | /** {@inheritdoc} */ |
692 | 692 | public function isSharable($path) { |
693 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE); |
|
693 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_SHARE); |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | /** {@inheritdoc} */ |
697 | 697 | public function isDeletable($path) { |
698 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_DELETE); |
|
698 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_DELETE); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | /** {@inheritdoc} */ |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | if (!empty($etag) && $cachedData['etag'] !== $etag) { |
785 | 785 | return true; |
786 | 786 | } else if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { |
787 | - $sharePermissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions']; |
|
787 | + $sharePermissions = (int) $response['{http://open-collaboration-services.org/ns}share-permissions']; |
|
788 | 788 | return $sharePermissions !== $cachedData['permissions']; |
789 | 789 | } else if (isset($response['{http://owncloud.org/ns}permissions'])) { |
790 | 790 | $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']); |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | if ($e->getHttpStatus() === 405) { |
801 | 801 | if ($path === '') { |
802 | 802 | // if root is gone it means the storage is not available |
803 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
803 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
804 | 804 | } |
805 | 805 | return false; |
806 | 806 | } |
@@ -834,19 +834,19 @@ discard block |
||
834 | 834 | } |
835 | 835 | if ($e->getHttpStatus() === Http::STATUS_UNAUTHORIZED) { |
836 | 836 | // either password was changed or was invalid all along |
837 | - throw new StorageInvalidException(get_class($e) . ': ' . $e->getMessage()); |
|
837 | + throw new StorageInvalidException(get_class($e).': '.$e->getMessage()); |
|
838 | 838 | } else if ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) { |
839 | 839 | // ignore exception for MethodNotAllowed, false will be returned |
840 | 840 | return; |
841 | 841 | } |
842 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
842 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
843 | 843 | } else if ($e instanceof ClientException) { |
844 | 844 | // connection timeout or refused, server could be temporarily down |
845 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
845 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
846 | 846 | } else if ($e instanceof \InvalidArgumentException) { |
847 | 847 | // parse error because the server returned HTML instead of XML, |
848 | 848 | // possibly temporarily down |
849 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
849 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
850 | 850 | } else if (($e instanceof StorageNotAvailableException) || ($e instanceof StorageInvalidException)) { |
851 | 851 | // rethrow |
852 | 852 | throw $e; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $this->mkdir($path2); |
220 | 220 | while ($file = readdir($dir)) { |
221 | 221 | if (!Filesystem::isIgnoredDir($file)) { |
222 | - if (!$this->copy($path1 . '/' . $file, $path2 . '/' . $file)) { |
|
222 | + if (!$this->copy($path1.'/'.$file, $path2.'/'.$file)) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 | } |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | if (is_resource($dh)) { |
274 | 274 | while (($file = readdir($dh)) !== false) { |
275 | 275 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
276 | - if ($this->is_dir($path . '/' . $file)) { |
|
277 | - mkdir($target . '/' . $file); |
|
278 | - $this->addLocalFolder($path . '/' . $file, $target . '/' . $file); |
|
276 | + if ($this->is_dir($path.'/'.$file)) { |
|
277 | + mkdir($target.'/'.$file); |
|
278 | + $this->addLocalFolder($path.'/'.$file, $target.'/'.$file); |
|
279 | 279 | } else { |
280 | - $tmp = $this->toTmpFile($path . '/' . $file); |
|
281 | - rename($tmp, $target . '/' . $file); |
|
280 | + $tmp = $this->toTmpFile($path.'/'.$file); |
|
281 | + rename($tmp, $target.'/'.$file); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | } |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | while (($item = readdir($dh)) !== false) { |
298 | 298 | if (\OC\Files\Filesystem::isIgnoredDir($item)) continue; |
299 | 299 | if (strstr(strtolower($item), strtolower($query)) !== false) { |
300 | - $files[] = $dir . '/' . $item; |
|
300 | + $files[] = $dir.'/'.$item; |
|
301 | 301 | } |
302 | - if ($this->is_dir($dir . '/' . $item)) { |
|
303 | - $files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item)); |
|
302 | + if ($this->is_dir($dir.'/'.$item)) { |
|
303 | + $files = array_merge($files, $this->searchInDir($query, $dir.'/'.$item)); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | if (!isset($this->watcher)) { |
352 | 352 | $this->watcher = new Watcher($storage); |
353 | 353 | $globalPolicy = \OC::$server->getConfig()->getSystemValue('filesystem_check_changes', Watcher::CHECK_NEVER); |
354 | - $this->watcher->setPolicy((int)$this->getMountOption('filesystem_check_changes', $globalPolicy)); |
|
354 | + $this->watcher->setPolicy((int) $this->getMountOption('filesystem_check_changes', $globalPolicy)); |
|
355 | 355 | } |
356 | 356 | return $this->watcher; |
357 | 357 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | */ |
426 | 426 | public function cleanPath($path) { |
427 | 427 | if (strlen($path) == 0 or $path[0] != '/') { |
428 | - $path = '/' . $path; |
|
428 | + $path = '/'.$path; |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | $output = array(); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | \OC::$server->getLogger()->info("External storage not available: stat() failed"); |
454 | 454 | return false; |
455 | 455 | } catch (\Exception $e) { |
456 | - \OC::$server->getLogger()->info("External storage not available: " . $e->getMessage()); |
|
456 | + \OC::$server->getLogger()->info("External storage not available: ".$e->getMessage()); |
|
457 | 457 | \OC::$server->getLogger()->logException($e, ['level' => ILogger::DEBUG]); |
458 | 458 | return false; |
459 | 459 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | if (is_resource($dh)) { |
605 | 605 | while ($result and ($file = readdir($dh)) !== false) { |
606 | 606 | if (!Filesystem::isIgnoredDir($file)) { |
607 | - $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file); |
|
607 | + $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath.'/'.$file, $targetInternalPath.'/'.$file); |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | $this->getCache()->remove($targetInternalPath); |
631 | 631 | } |
632 | 632 | } |
633 | - return (bool)$result; |
|
633 | + return (bool) $result; |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | /** |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | ); |
711 | 711 | } |
712 | 712 | try { |
713 | - $provider->acquireLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); |
|
713 | + $provider->acquireLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type); |
|
714 | 714 | } catch (LockedException $e) { |
715 | 715 | if ($logger) { |
716 | 716 | $logger->logException($e); |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | ); |
743 | 743 | } |
744 | 744 | try { |
745 | - $provider->releaseLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); |
|
745 | + $provider->releaseLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type); |
|
746 | 746 | } catch (LockedException $e) { |
747 | 747 | if ($logger) { |
748 | 748 | $logger->logException($e); |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | ); |
775 | 775 | } |
776 | 776 | try { |
777 | - $provider->changeLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); |
|
777 | + $provider->changeLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type); |
|
778 | 778 | } catch (LockedException $e) { |
779 | 779 | if ($logger) { |
780 | 780 | $logger->logException($e); |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | if ($lock) { |
330 | 330 | if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { |
331 | - $this->storage->acquireLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
331 | + $this->storage->acquireLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
332 | 332 | $this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); |
333 | 333 | } |
334 | 334 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | if ($lock) { |
341 | 341 | if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { |
342 | 342 | $this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); |
343 | - $this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
343 | + $this->storage->releaseLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 | return $data; |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | $exceptionOccurred = false; |
430 | 430 | $childQueue = []; |
431 | 431 | foreach ($newChildren as $file) { |
432 | - $child = $path ? $path . '/' . $file : $file; |
|
432 | + $child = $path ? $path.'/'.$file : $file; |
|
433 | 433 | try { |
434 | 434 | $existingData = isset($existingChildren[$file]) ? $existingChildren[$file] : null; |
435 | 435 | $data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock); |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | \OC::$server->getDatabaseConnection()->beginTransaction(); |
455 | 455 | } |
456 | 456 | \OC::$server->getLogger()->logException($ex, [ |
457 | - 'message' => 'Exception while scanning file "' . $child . '"', |
|
457 | + 'message' => 'Exception while scanning file "'.$child.'"', |
|
458 | 458 | 'level' => ILogger::DEBUG, |
459 | 459 | 'app' => 'core', |
460 | 460 | ]); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | } |
469 | 469 | $removedChildren = \array_diff(array_keys($existingChildren), $newChildren); |
470 | 470 | foreach ($removedChildren as $childName) { |
471 | - $child = $path ? $path . '/' . $childName : $childName; |
|
471 | + $child = $path ? $path.'/'.$childName : $childName; |
|
472 | 472 | $this->removeFromCache($child); |
473 | 473 | } |
474 | 474 | if ($this->useTransactions) { |
@@ -508,13 +508,13 @@ discard block |
||
508 | 508 | */ |
509 | 509 | public function backgroundScan() { |
510 | 510 | if (!$this->cache->inCache('')) { |
511 | - $this->runBackgroundScanJob(function () { |
|
511 | + $this->runBackgroundScanJob(function() { |
|
512 | 512 | $this->scan('', self::SCAN_RECURSIVE, self::REUSE_ETAG); |
513 | 513 | }, ''); |
514 | 514 | } else { |
515 | 515 | $lastPath = null; |
516 | 516 | while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) { |
517 | - $this->runBackgroundScanJob(function () use ($path) { |
|
517 | + $this->runBackgroundScanJob(function() use ($path) { |
|
518 | 518 | $this->scan($path, self::SCAN_RECURSIVE_INCOMPLETE, self::REUSE_ETAG | self::REUSE_SIZE); |
519 | 519 | }, $path); |
520 | 520 | // FIXME: this won't proceed with the next item, needs revamping of getIncomplete() |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function __construct(string $path, string $fallbackPath = '', IConfig $config) { |
57 | 57 | $this->logFile = $path; |
58 | 58 | if (!file_exists($this->logFile)) { |
59 | - if( |
|
59 | + if ( |
|
60 | 60 | ( |
61 | 61 | !is_writable(dirname($this->logFile)) |
62 | 62 | || !touch($this->logFile) |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $time = $time->format($format); |
99 | 99 | $url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--'; |
100 | 100 | $method = is_string($request->getMethod()) ? $request->getMethod() : '--'; |
101 | - if($this->config->getSystemValue('installed', false)) { |
|
101 | + if ($this->config->getSystemValue('installed', false)) { |
|
102 | 102 | $user = \OC_User::getUser() ? \OC_User::getUser() : '--'; |
103 | 103 | } else { |
104 | 104 | $user = '--'; |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | // PHP's json_encode only accept proper UTF-8 strings, loop over all |
125 | 125 | // elements to ensure that they are properly UTF-8 compliant or convert |
126 | 126 | // them manually. |
127 | - foreach($entry as $key => $value) { |
|
128 | - if(is_string($value)) { |
|
127 | + foreach ($entry as $key => $value) { |
|
128 | + if (is_string($value)) { |
|
129 | 129 | $testEncode = json_encode($value); |
130 | - if($testEncode === false) { |
|
130 | + if ($testEncode === false) { |
|
131 | 131 | $entry[$key] = utf8_encode($value); |
132 | 132 | } |
133 | 133 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param int $offset |
156 | 156 | * @return array |
157 | 157 | */ |
158 | - public function getEntries($limit=50, $offset=0) { |
|
158 | + public function getEntries($limit = 50, $offset = 0) { |
|
159 | 159 | $minLevel = $this->config->getSystemValue("loglevel", ILogger::WARN); |
160 | 160 | $entries = array(); |
161 | 161 | $handle = @fopen($this->logFile, 'rb'); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $entriesCount = 0; |
167 | 167 | $lines = 0; |
168 | 168 | // Loop through each character of the file looking for new lines |
169 | - while ($pos >= 0 && ($limit === null ||$entriesCount < $limit)) { |
|
169 | + while ($pos >= 0 && ($limit === null || $entriesCount < $limit)) { |
|
170 | 170 | fseek($handle, $pos); |
171 | 171 | $ch = fgetc($handle); |
172 | 172 | if ($ch == "\n" || $pos == 0) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function getCustomLogger(string $path):ILogger { |
64 | 64 | $systemConfig = null; |
65 | 65 | $iconfig = $this->c->getConfig(); |
66 | - if($iconfig instanceof AllConfig) { |
|
66 | + if ($iconfig instanceof AllConfig) { |
|
67 | 67 | // Log is bound to SystemConfig, but fetches it from \OC::$server if not supplied |
68 | 68 | $systemConfig = $iconfig->getSystemConfig(); |
69 | 69 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | protected function buildLogFile(string $logFile = ''):File { |
75 | 75 | $config = $this->c->getConfig(); |
76 | 76 | $defaultLogFile = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log'; |
77 | - if($logFile === '') { |
|
77 | + if ($logFile === '') { |
|
78 | 78 | $logFile = $config->getSystemValue('logfile', $defaultLogFile); |
79 | 79 | } |
80 | 80 | $fallback = $defaultLogFile !== $logFile ? $defaultLogFile : ''; |