@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | use OCP\Files\NotFoundException; |
31 | 31 | use OCP\Files\SimpleFS\ISimpleFolder; |
32 | 32 | |
33 | -class SimpleFolder implements ISimpleFolder { |
|
33 | +class SimpleFolder implements ISimpleFolder { |
|
34 | 34 | |
35 | 35 | /** @var Folder */ |
36 | 36 | private $folder; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function getDirectoryListing() { |
52 | 52 | $listing = $this->folder->getDirectoryListing(); |
53 | 53 | |
54 | - $fileListing = array_map(function (Node $file) { |
|
54 | + $fileListing = array_map(function(Node $file) { |
|
55 | 55 | if ($file instanceof File) { |
56 | 56 | return new SimpleFile($file); |
57 | 57 | } |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | $path = '/'; |
130 | 130 | } |
131 | 131 | if ($path[0] !== '/') { |
132 | - $path = '/' . $path; |
|
132 | + $path = '/'.$path; |
|
133 | 133 | } |
134 | - return $this->fakeRoot . $path; |
|
134 | + return $this->fakeRoot.$path; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function chroot($fakeRoot) { |
144 | 144 | if (!$fakeRoot == '') { |
145 | 145 | if ($fakeRoot[0] !== '/') { |
146 | - $fakeRoot = '/' . $fakeRoot; |
|
146 | + $fakeRoot = '/'.$fakeRoot; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | $this->fakeRoot = $fakeRoot; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | // missing slashes can cause wrong matches! |
178 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
178 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
179 | 179 | |
180 | 180 | if (strpos($path, $root) !== 0) { |
181 | 181 | return null; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | if ($mount instanceof MoveableMount) { |
282 | 282 | // cut of /user/files to get the relative path to data/user/files |
283 | 283 | $pathParts = explode('/', $path, 4); |
284 | - $relPath = '/' . $pathParts[3]; |
|
284 | + $relPath = '/'.$pathParts[3]; |
|
285 | 285 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
286 | 286 | \OC_Hook::emit( |
287 | 287 | Filesystem::CLASSNAME, "umount", |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | } |
708 | 708 | $postFix = (substr($path, -1) === '/') ? '/' : ''; |
709 | 709 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
710 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
710 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
711 | 711 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
712 | 712 | return $this->removeMount($mount, $absolutePath); |
713 | 713 | } |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); |
830 | 830 | } |
831 | 831 | } |
832 | - } catch(\Exception $e) { |
|
832 | + } catch (\Exception $e) { |
|
833 | 833 | throw $e; |
834 | 834 | } finally { |
835 | 835 | $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | } |
854 | 854 | } |
855 | 855 | } |
856 | - } catch(\Exception $e) { |
|
856 | + } catch (\Exception $e) { |
|
857 | 857 | throw $e; |
858 | 858 | } finally { |
859 | 859 | $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | $hooks[] = 'write'; |
988 | 988 | break; |
989 | 989 | default: |
990 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR); |
|
990 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, ILogger::ERROR); |
|
991 | 991 | } |
992 | 992 | |
993 | 993 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | [Filesystem::signal_param_path => $this->getHookPath($path)] |
1092 | 1092 | ); |
1093 | 1093 | } |
1094 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1094 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1095 | 1095 | if ($storage) { |
1096 | 1096 | return $storage->hash($type, $internalPath, $raw); |
1097 | 1097 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | |
1146 | 1146 | $run = $this->runHooks($hooks, $path); |
1147 | 1147 | /** @var \OC\Files\Storage\Storage $storage */ |
1148 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1148 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1149 | 1149 | if ($run and $storage) { |
1150 | 1150 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
1151 | 1151 | try { |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | if ($result && in_array('delete', $hooks) and $result) { |
1175 | 1175 | $this->removeUpdate($storage, $internalPath); |
1176 | 1176 | } |
1177 | - if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
1177 | + if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
1178 | 1178 | $this->writeUpdate($storage, $internalPath); |
1179 | 1179 | } |
1180 | 1180 | if ($result && in_array('touch', $hooks)) { |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | $unlockLater = true; |
1191 | 1191 | // make sure our unlocking callback will still be called if connection is aborted |
1192 | 1192 | ignore_user_abort(true); |
1193 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
1193 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
1194 | 1194 | if (in_array('write', $hooks)) { |
1195 | 1195 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
1196 | 1196 | } else if (in_array('read', $hooks)) { |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | return true; |
1252 | 1252 | } |
1253 | 1253 | |
1254 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
1254 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | /** |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | if ($hook != 'read') { |
1271 | 1271 | \OC_Hook::emit( |
1272 | 1272 | Filesystem::CLASSNAME, |
1273 | - $prefix . $hook, |
|
1273 | + $prefix.$hook, |
|
1274 | 1274 | [ |
1275 | 1275 | Filesystem::signal_param_run => &$run, |
1276 | 1276 | Filesystem::signal_param_path => $path |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | } elseif (!$post) { |
1280 | 1280 | \OC_Hook::emit( |
1281 | 1281 | Filesystem::CLASSNAME, |
1282 | - $prefix . $hook, |
|
1282 | + $prefix.$hook, |
|
1283 | 1283 | [ |
1284 | 1284 | Filesystem::signal_param_path => $path |
1285 | 1285 | ] |
@@ -1372,11 +1372,11 @@ discard block |
||
1372 | 1372 | return $this->getPartFileInfo($path); |
1373 | 1373 | } |
1374 | 1374 | $relativePath = $path; |
1375 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1375 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1376 | 1376 | |
1377 | 1377 | $mount = Filesystem::getMountManager()->find($path); |
1378 | 1378 | if (!$mount) { |
1379 | - \OC::$server->getLogger()->warning('Mountpoint not found for path: ' . $path); |
|
1379 | + \OC::$server->getLogger()->warning('Mountpoint not found for path: '.$path); |
|
1380 | 1380 | return false; |
1381 | 1381 | } |
1382 | 1382 | $storage = $mount->getStorage(); |
@@ -1404,7 +1404,7 @@ discard block |
||
1404 | 1404 | //add the sizes of other mount points to the folder |
1405 | 1405 | $extOnly = ($includeMountPoints === 'ext'); |
1406 | 1406 | $mounts = Filesystem::getMountManager()->findIn($path); |
1407 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
1407 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
1408 | 1408 | $subStorage = $mount->getStorage(); |
1409 | 1409 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
1410 | 1410 | })); |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | |
1414 | 1414 | return $info; |
1415 | 1415 | } else { |
1416 | - \OC::$server->getLogger()->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint()); |
|
1416 | + \OC::$server->getLogger()->warning('Storage not valid for mountpoint: '.$mount->getMountPoint()); |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | return false; |
@@ -1454,18 +1454,18 @@ discard block |
||
1454 | 1454 | |
1455 | 1455 | $sharingDisabled = \OCP\Util::isSharingDisabledForUser(); |
1456 | 1456 | |
1457 | - $fileNames = array_map(function (ICacheEntry $content) { |
|
1457 | + $fileNames = array_map(function(ICacheEntry $content) { |
|
1458 | 1458 | return $content->getName(); |
1459 | 1459 | }, $contents); |
1460 | 1460 | /** |
1461 | 1461 | * @var \OC\Files\FileInfo[] $fileInfos |
1462 | 1462 | */ |
1463 | - $fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1463 | + $fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1464 | 1464 | if ($sharingDisabled) { |
1465 | 1465 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
1466 | 1466 | } |
1467 | 1467 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
1468 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1468 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1469 | 1469 | }, $contents); |
1470 | 1470 | $files = array_combine($fileNames, $fileInfos); |
1471 | 1471 | |
@@ -1490,7 +1490,7 @@ discard block |
||
1490 | 1490 | } catch (\Exception $e) { |
1491 | 1491 | // sometimes when the storage is not available it can be any exception |
1492 | 1492 | \OC::$server->getLogger()->logException($e, [ |
1493 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', |
|
1493 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', |
|
1494 | 1494 | 'level' => ILogger::ERROR, |
1495 | 1495 | 'app' => 'lib', |
1496 | 1496 | ]); |
@@ -1521,7 +1521,7 @@ discard block |
||
1521 | 1521 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); |
1522 | 1522 | } |
1523 | 1523 | |
1524 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1524 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1525 | 1525 | |
1526 | 1526 | // if sharing was disabled for the user we remove the share permissions |
1527 | 1527 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1529,14 +1529,14 @@ discard block |
||
1529 | 1529 | } |
1530 | 1530 | |
1531 | 1531 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
1532 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1532 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1533 | 1533 | } |
1534 | 1534 | } |
1535 | 1535 | } |
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | if ($mimetype_filter) { |
1539 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
1539 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
1540 | 1540 | if (strpos($mimetype_filter, '/')) { |
1541 | 1541 | return $file->getMimetype() === $mimetype_filter; |
1542 | 1542 | } else { |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | if ($data instanceof FileInfo) { |
1566 | 1566 | $data = $data->getData(); |
1567 | 1567 | } |
1568 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1568 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1569 | 1569 | /** |
1570 | 1570 | * @var \OC\Files\Storage\Storage $storage |
1571 | 1571 | * @var string $internalPath |
@@ -1592,7 +1592,7 @@ discard block |
||
1592 | 1592 | * @return FileInfo[] |
1593 | 1593 | */ |
1594 | 1594 | public function search($query) { |
1595 | - return $this->searchCommon('search', ['%' . $query . '%']); |
|
1595 | + return $this->searchCommon('search', ['%'.$query.'%']); |
|
1596 | 1596 | } |
1597 | 1597 | |
1598 | 1598 | /** |
@@ -1643,10 +1643,10 @@ discard block |
||
1643 | 1643 | |
1644 | 1644 | $results = call_user_func_array([$cache, $method], $args); |
1645 | 1645 | foreach ($results as $result) { |
1646 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
1646 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
1647 | 1647 | $internalPath = $result['path']; |
1648 | - $path = $mountPoint . $result['path']; |
|
1649 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
1648 | + $path = $mountPoint.$result['path']; |
|
1649 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
1650 | 1650 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1651 | 1651 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1652 | 1652 | } |
@@ -1664,8 +1664,8 @@ discard block |
||
1664 | 1664 | if ($results) { |
1665 | 1665 | foreach ($results as $result) { |
1666 | 1666 | $internalPath = $result['path']; |
1667 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
1668 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
1667 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
1668 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
1669 | 1669 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1670 | 1670 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1671 | 1671 | } |
@@ -1686,11 +1686,11 @@ discard block |
||
1686 | 1686 | public function getOwner($path) { |
1687 | 1687 | $info = $this->getFileInfo($path); |
1688 | 1688 | if (!$info) { |
1689 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
1689 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
1690 | 1690 | } |
1691 | 1691 | |
1692 | 1692 | if ($info->getOwner() === null) { |
1693 | - throw new NotFoundException($path . ' has no owner'); |
|
1693 | + throw new NotFoundException($path.' has no owner'); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | return $info->getOwner()->getUID(); |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | * @return string |
1726 | 1726 | */ |
1727 | 1727 | public function getPath($id) { |
1728 | - $id = (int)$id; |
|
1728 | + $id = (int) $id; |
|
1729 | 1729 | $manager = Filesystem::getMountManager(); |
1730 | 1730 | $mounts = $manager->findIn($this->fakeRoot); |
1731 | 1731 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1735,7 +1735,7 @@ discard block |
||
1735 | 1735 | |
1736 | 1736 | // put non shared mounts in front of the shared mount |
1737 | 1737 | // this prevent unneeded recursion into shares |
1738 | - usort($mounts, function (IMountPoint $a, IMountPoint $b) { |
|
1738 | + usort($mounts, function(IMountPoint $a, IMountPoint $b) { |
|
1739 | 1739 | return $a instanceof SharedMount && (!$b instanceof SharedMount) ? 1 : -1; |
1740 | 1740 | }); |
1741 | 1741 | |
@@ -1747,7 +1747,7 @@ discard block |
||
1747 | 1747 | $cache = $mount->getStorage()->getCache(); |
1748 | 1748 | $internalPath = $cache->getPathById($id); |
1749 | 1749 | if (is_string($internalPath)) { |
1750 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
1750 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
1751 | 1751 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
1752 | 1752 | return $path; |
1753 | 1753 | } |
@@ -1783,10 +1783,10 @@ discard block |
||
1783 | 1783 | private function targetIsNotShared(IStorage $targetStorage, string $targetInternalPath) { |
1784 | 1784 | |
1785 | 1785 | // note: cannot use the view because the target is already locked |
1786 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
1786 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
1787 | 1787 | if ($fileId === -1) { |
1788 | 1788 | // target might not exist, need to check parent instead |
1789 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1789 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1790 | 1790 | } |
1791 | 1791 | |
1792 | 1792 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1886,7 +1886,7 @@ discard block |
||
1886 | 1886 | $resultPath = ''; |
1887 | 1887 | foreach ($parts as $part) { |
1888 | 1888 | if ($part) { |
1889 | - $resultPath .= '/' . $part; |
|
1889 | + $resultPath .= '/'.$part; |
|
1890 | 1890 | $result[] = $resultPath; |
1891 | 1891 | } |
1892 | 1892 | } |
@@ -2155,16 +2155,16 @@ discard block |
||
2155 | 2155 | public function getUidAndFilename($filename) { |
2156 | 2156 | $info = $this->getFileInfo($filename); |
2157 | 2157 | if (!$info instanceof \OCP\Files\FileInfo) { |
2158 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
2158 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
2159 | 2159 | } |
2160 | 2160 | $uid = $info->getOwner()->getUID(); |
2161 | 2161 | if ($uid != \OCP\User::getUser()) { |
2162 | 2162 | Filesystem::initMountPoints($uid); |
2163 | - $ownerView = new View('/' . $uid . '/files'); |
|
2163 | + $ownerView = new View('/'.$uid.'/files'); |
|
2164 | 2164 | try { |
2165 | 2165 | $filename = $ownerView->getPath($info['fileid']); |
2166 | 2166 | } catch (NotFoundException $e) { |
2167 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
2167 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
2168 | 2168 | } |
2169 | 2169 | } |
2170 | 2170 | return [$uid, $filename]; |
@@ -2181,7 +2181,7 @@ discard block |
||
2181 | 2181 | $directoryParts = array_filter($directoryParts); |
2182 | 2182 | foreach ($directoryParts as $key => $part) { |
2183 | 2183 | $currentPathElements = array_slice($directoryParts, 0, $key); |
2184 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
2184 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
2185 | 2185 | if ($this->is_file($currentPath)) { |
2186 | 2186 | return false; |
2187 | 2187 | } |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { |
173 | 173 | //fix types |
174 | - $data['fileid'] = (int)$data['fileid']; |
|
175 | - $data['parent'] = (int)$data['parent']; |
|
174 | + $data['fileid'] = (int) $data['fileid']; |
|
175 | + $data['parent'] = (int) $data['parent']; |
|
176 | 176 | $data['size'] = 0 + $data['size']; |
177 | - $data['mtime'] = (int)$data['mtime']; |
|
178 | - $data['storage_mtime'] = (int)$data['storage_mtime']; |
|
179 | - $data['encryptedVersion'] = (int)$data['encrypted']; |
|
180 | - $data['encrypted'] = (bool)$data['encrypted']; |
|
177 | + $data['mtime'] = (int) $data['mtime']; |
|
178 | + $data['storage_mtime'] = (int) $data['storage_mtime']; |
|
179 | + $data['encryptedVersion'] = (int) $data['encrypted']; |
|
180 | + $data['encrypted'] = (bool) $data['encrypted']; |
|
181 | 181 | $data['storage_id'] = $data['storage']; |
182 | - $data['storage'] = (int)$data['storage']; |
|
182 | + $data['storage'] = (int) $data['storage']; |
|
183 | 183 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
184 | 184 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
185 | 185 | if ($data['storage_mtime'] == 0) { |
186 | 186 | $data['storage_mtime'] = $data['mtime']; |
187 | 187 | } |
188 | - $data['permissions'] = (int)$data['permissions']; |
|
188 | + $data['permissions'] = (int) $data['permissions']; |
|
189 | 189 | if (isset($data['creation_time'])) { |
190 | 190 | $data['creation_time'] = (int) $data['creation_time']; |
191 | 191 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | ->orderBy('name', 'ASC'); |
221 | 221 | |
222 | 222 | $files = $query->execute()->fetchAll(); |
223 | - return array_map(function (array $data) { |
|
223 | + return array_map(function(array $data) { |
|
224 | 224 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
225 | 225 | }, $files); |
226 | 226 | } |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | |
350 | 350 | $query->update('filecache') |
351 | 351 | ->whereFileId($id) |
352 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
352 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
353 | 353 | return $query->expr()->orX( |
354 | 354 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
355 | 355 | $query->expr()->isNull($key) |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $query = $this->getQueryBuilder(); |
379 | 379 | $query->update('filecache_extended') |
380 | 380 | ->whereFileId($id) |
381 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
381 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
382 | 382 | return $query->expr()->orX( |
383 | 383 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
384 | 384 | $query->expr()->isNull($key) |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | ->wherePath($file); |
471 | 471 | |
472 | 472 | $id = $query->execute()->fetchColumn(); |
473 | - return $id === false ? -1 : (int)$id; |
|
473 | + return $id === false ? -1 : (int) $id; |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | return -1; |
485 | 485 | } else { |
486 | 486 | $parent = $this->getParentPath($file); |
487 | - return (int)$this->getId($parent); |
|
487 | + return (int) $this->getId($parent); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | */ |
542 | 542 | private function getSubFolders(ICacheEntry $entry) { |
543 | 543 | $children = $this->getFolderContentsById($entry->getId()); |
544 | - return array_filter($children, function ($child) { |
|
544 | + return array_filter($children, function($child) { |
|
545 | 545 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
546 | 546 | }); |
547 | 547 | } |
@@ -554,10 +554,10 @@ discard block |
||
554 | 554 | */ |
555 | 555 | private function removeChildren(ICacheEntry $entry) { |
556 | 556 | $children = $this->getFolderContentsById($entry->getId()); |
557 | - $childIds = array_map(function (ICacheEntry $cacheEntry) { |
|
557 | + $childIds = array_map(function(ICacheEntry $cacheEntry) { |
|
558 | 558 | return $cacheEntry->getId(); |
559 | 559 | }, $children); |
560 | - $childFolders = array_filter($children, function ($child) { |
|
560 | + $childFolders = array_filter($children, function($child) { |
|
561 | 561 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
562 | 562 | }); |
563 | 563 | foreach ($childFolders as $folder) { |
@@ -619,10 +619,10 @@ discard block |
||
619 | 619 | [$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath); |
620 | 620 | |
621 | 621 | if (is_null($sourceStorageId) || $sourceStorageId === false) { |
622 | - throw new \Exception('Invalid source storage id: ' . $sourceStorageId); |
|
622 | + throw new \Exception('Invalid source storage id: '.$sourceStorageId); |
|
623 | 623 | } |
624 | 624 | if (is_null($targetStorageId) || $targetStorageId === false) { |
625 | - throw new \Exception('Invalid target storage id: ' . $targetStorageId); |
|
625 | + throw new \Exception('Invalid target storage id: '.$targetStorageId); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | $this->connection->beginTransaction(); |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | ->set('path_hash', $fun->md5($newPathFunction)) |
642 | 642 | ->set('path', $newPathFunction) |
643 | 643 | ->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT))) |
644 | - ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%'))); |
|
644 | + ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%'))); |
|
645 | 645 | |
646 | 646 | try { |
647 | 647 | $query->execute(); |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | ->wherePath($file); |
706 | 706 | $size = $query->execute()->fetchColumn(); |
707 | 707 | if ($size !== false) { |
708 | - if ((int)$size === -1) { |
|
708 | + if ((int) $size === -1) { |
|
709 | 709 | return self::SHALLOW; |
710 | 710 | } else { |
711 | 711 | return self::COMPLETE; |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | ->whereStorageId() |
739 | 739 | ->andWhere($query->expr()->iLike('name', $query->createNamedParameter($pattern))); |
740 | 740 | |
741 | - return array_map(function (array $data) { |
|
741 | + return array_map(function(array $data) { |
|
742 | 742 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
743 | 743 | }, $query->execute()->fetchAll()); |
744 | 744 | } |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | private function searchResultToCacheEntries(Statement $result) { |
751 | 751 | $files = $result->fetchAll(); |
752 | 752 | |
753 | - return array_map(function (array $data) { |
|
753 | + return array_map(function(array $data) { |
|
754 | 754 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
755 | 755 | }, $files); |
756 | 756 | } |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $query->andWhere($query->expr()->eq('mimepart', $query->createNamedParameter($mimeId, IQueryBuilder::PARAM_INT))); |
776 | 776 | } |
777 | 777 | |
778 | - return array_map(function (array $data) { |
|
778 | + return array_map(function(array $data) { |
|
779 | 779 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
780 | 780 | }, $query->execute()->fetchAll()); |
781 | 781 | } |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | ->whereParent($fileId) |
859 | 859 | ->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))); |
860 | 860 | |
861 | - return (int)$query->execute()->fetchColumn(); |
|
861 | + return (int) $query->execute()->fetchColumn(); |
|
862 | 862 | } |
863 | 863 | return -1; |
864 | 864 | } |
@@ -913,8 +913,8 @@ discard block |
||
913 | 913 | ->from('filecache') |
914 | 914 | ->whereStorageId(); |
915 | 915 | |
916 | - return array_map(function ($id) { |
|
917 | - return (int)$id; |
|
916 | + return array_map(function($id) { |
|
917 | + return (int) $id; |
|
918 | 918 | }, $query->execute()->fetchAll(\PDO::FETCH_COLUMN)); |
919 | 919 | } |
920 | 920 |
@@ -149,9 +149,9 @@ |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public function actionInclude($file) { |
152 | - $function = function ($param) use ($file) { |
|
152 | + $function = function($param) use ($file) { |
|
153 | 153 | unset($param["_route"]); |
154 | - $_GET=array_merge($_GET, $param); |
|
154 | + $_GET = array_merge($_GET, $param); |
|
155 | 155 | unset($param); |
156 | 156 | require_once "$file"; |
157 | 157 | } ; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | // To find out if we are running from CLI or not |
257 | 257 | $this->registerParameter('isCLI', \OC::$CLI); |
258 | 258 | |
259 | - $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { |
|
259 | + $this->registerService(\OCP\IServerContainer::class, function(IServerContainer $c) { |
|
260 | 260 | return $c; |
261 | 261 | }); |
262 | 262 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
278 | 278 | |
279 | 279 | |
280 | - $this->registerService(IPreview::class, function (Server $c) { |
|
280 | + $this->registerService(IPreview::class, function(Server $c) { |
|
281 | 281 | return new PreviewManager( |
282 | 282 | $c->getConfig(), |
283 | 283 | $c->getRootFolder(), |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | }); |
290 | 290 | $this->registerDeprecatedAlias('PreviewManager', IPreview::class); |
291 | 291 | |
292 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
292 | + $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
293 | 293 | return new \OC\Preview\Watcher( |
294 | 294 | $c->getAppDataDir('preview') |
295 | 295 | ); |
296 | 296 | }); |
297 | 297 | |
298 | - $this->registerService(\OCP\Encryption\IManager::class, function (Server $c) { |
|
298 | + $this->registerService(\OCP\Encryption\IManager::class, function(Server $c) { |
|
299 | 299 | $view = new View(); |
300 | 300 | $util = new Encryption\Util( |
301 | 301 | $view, |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | }); |
315 | 315 | $this->registerDeprecatedAlias('EncryptionManager', \OCP\Encryption\IManager::class); |
316 | 316 | |
317 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
317 | + $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
318 | 318 | $util = new Encryption\Util( |
319 | 319 | new View(), |
320 | 320 | $c->getUserManager(), |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | ); |
329 | 329 | }); |
330 | 330 | |
331 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
331 | + $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
332 | 332 | $view = new View(); |
333 | 333 | $util = new Encryption\Util( |
334 | 334 | $view, |
@@ -339,30 +339,30 @@ discard block |
||
339 | 339 | |
340 | 340 | return new Encryption\Keys\Storage($view, $util); |
341 | 341 | }); |
342 | - $this->registerService('TagMapper', function (Server $c) { |
|
342 | + $this->registerService('TagMapper', function(Server $c) { |
|
343 | 343 | return new TagMapper($c->getDatabaseConnection()); |
344 | 344 | }); |
345 | 345 | |
346 | - $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
346 | + $this->registerService(\OCP\ITagManager::class, function(Server $c) { |
|
347 | 347 | $tagMapper = $c->query('TagMapper'); |
348 | 348 | return new TagManager($tagMapper, $c->getUserSession()); |
349 | 349 | }); |
350 | 350 | $this->registerDeprecatedAlias('TagManager', \OCP\ITagManager::class); |
351 | 351 | |
352 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
352 | + $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
353 | 353 | $config = $c->getConfig(); |
354 | 354 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
355 | 355 | return new $factoryClass($this); |
356 | 356 | }); |
357 | - $this->registerService(ISystemTagManager::class, function (Server $c) { |
|
357 | + $this->registerService(ISystemTagManager::class, function(Server $c) { |
|
358 | 358 | return $c->query('SystemTagManagerFactory')->getManager(); |
359 | 359 | }); |
360 | 360 | $this->registerDeprecatedAlias('SystemTagManager', ISystemTagManager::class); |
361 | 361 | |
362 | - $this->registerService(ISystemTagObjectMapper::class, function (Server $c) { |
|
362 | + $this->registerService(ISystemTagObjectMapper::class, function(Server $c) { |
|
363 | 363 | return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
364 | 364 | }); |
365 | - $this->registerService('RootFolder', function (Server $c) { |
|
365 | + $this->registerService('RootFolder', function(Server $c) { |
|
366 | 366 | $manager = \OC\Files\Filesystem::getMountManager(null); |
367 | 367 | $view = new View(); |
368 | 368 | $root = new Root( |
@@ -383,8 +383,8 @@ discard block |
||
383 | 383 | }); |
384 | 384 | $this->registerDeprecatedAlias('SystemTagObjectMapper', ISystemTagObjectMapper::class); |
385 | 385 | |
386 | - $this->registerService(IRootFolder::class, function (Server $c) { |
|
387 | - return new LazyRoot(function () use ($c) { |
|
386 | + $this->registerService(IRootFolder::class, function(Server $c) { |
|
387 | + return new LazyRoot(function() use ($c) { |
|
388 | 388 | return $c->query('RootFolder'); |
389 | 389 | }); |
390 | 390 | }); |
@@ -393,44 +393,44 @@ discard block |
||
393 | 393 | $this->registerDeprecatedAlias('UserManager', \OC\User\Manager::class); |
394 | 394 | $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
395 | 395 | |
396 | - $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
396 | + $this->registerService(\OCP\IGroupManager::class, function(Server $c) { |
|
397 | 397 | $groupManager = new \OC\Group\Manager($this->getUserManager(), $c->getEventDispatcher(), $this->getLogger()); |
398 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
398 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
399 | 399 | \OC_Hook::emit('OC_Group', 'pre_createGroup', ['run' => true, 'gid' => $gid]); |
400 | 400 | |
401 | 401 | /** @var IEventDispatcher $dispatcher */ |
402 | 402 | $dispatcher = $this->query(IEventDispatcher::class); |
403 | 403 | $dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid)); |
404 | 404 | }); |
405 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) { |
|
405 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $group) { |
|
406 | 406 | \OC_Hook::emit('OC_User', 'post_createGroup', ['gid' => $group->getGID()]); |
407 | 407 | |
408 | 408 | /** @var IEventDispatcher $dispatcher */ |
409 | 409 | $dispatcher = $this->query(IEventDispatcher::class); |
410 | 410 | $dispatcher->dispatchTyped(new GroupCreatedEvent($group)); |
411 | 411 | }); |
412 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
412 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
413 | 413 | \OC_Hook::emit('OC_Group', 'pre_deleteGroup', ['run' => true, 'gid' => $group->getGID()]); |
414 | 414 | |
415 | 415 | /** @var IEventDispatcher $dispatcher */ |
416 | 416 | $dispatcher = $this->query(IEventDispatcher::class); |
417 | 417 | $dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group)); |
418 | 418 | }); |
419 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
419 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
420 | 420 | \OC_Hook::emit('OC_User', 'post_deleteGroup', ['gid' => $group->getGID()]); |
421 | 421 | |
422 | 422 | /** @var IEventDispatcher $dispatcher */ |
423 | 423 | $dispatcher = $this->query(IEventDispatcher::class); |
424 | 424 | $dispatcher->dispatchTyped(new GroupDeletedEvent($group)); |
425 | 425 | }); |
426 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
426 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
427 | 427 | \OC_Hook::emit('OC_Group', 'pre_addToGroup', ['run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()]); |
428 | 428 | |
429 | 429 | /** @var IEventDispatcher $dispatcher */ |
430 | 430 | $dispatcher = $this->query(IEventDispatcher::class); |
431 | 431 | $dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user)); |
432 | 432 | }); |
433 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
433 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
434 | 434 | \OC_Hook::emit('OC_Group', 'post_addToGroup', ['uid' => $user->getUID(), 'gid' => $group->getGID()]); |
435 | 435 | //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
436 | 436 | \OC_Hook::emit('OC_User', 'post_addToGroup', ['uid' => $user->getUID(), 'gid' => $group->getGID()]); |
@@ -439,12 +439,12 @@ discard block |
||
439 | 439 | $dispatcher = $this->query(IEventDispatcher::class); |
440 | 440 | $dispatcher->dispatchTyped(new UserAddedEvent($group, $user)); |
441 | 441 | }); |
442 | - $groupManager->listen('\OC\Group', 'preRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
442 | + $groupManager->listen('\OC\Group', 'preRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
443 | 443 | /** @var IEventDispatcher $dispatcher */ |
444 | 444 | $dispatcher = $this->query(IEventDispatcher::class); |
445 | 445 | $dispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $user)); |
446 | 446 | }); |
447 | - $groupManager->listen('\OC\Group', 'postRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
447 | + $groupManager->listen('\OC\Group', 'postRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
448 | 448 | /** @var IEventDispatcher $dispatcher */ |
449 | 449 | $dispatcher = $this->query(IEventDispatcher::class); |
450 | 450 | $dispatcher->dispatchTyped(new UserRemovedEvent($group, $user)); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | }); |
454 | 454 | $this->registerDeprecatedAlias('GroupManager', \OCP\IGroupManager::class); |
455 | 455 | |
456 | - $this->registerService(Store::class, function (Server $c) { |
|
456 | + $this->registerService(Store::class, function(Server $c) { |
|
457 | 457 | $session = $c->getSession(); |
458 | 458 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
459 | 459 | $tokenProvider = $c->query(IProvider::class); |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | return new Store($session, $logger, $tokenProvider); |
465 | 465 | }); |
466 | 466 | $this->registerAlias(IStore::class, Store::class); |
467 | - $this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) { |
|
467 | + $this->registerService(Authentication\Token\DefaultTokenMapper::class, function(Server $c) { |
|
468 | 468 | $dbConnection = $c->getDatabaseConnection(); |
469 | 469 | return new Authentication\Token\DefaultTokenMapper($dbConnection); |
470 | 470 | }); |
471 | 471 | $this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
472 | 472 | |
473 | - $this->registerService(\OC\User\Session::class, function (Server $c) { |
|
473 | + $this->registerService(\OC\User\Session::class, function(Server $c) { |
|
474 | 474 | $manager = $c->getUserManager(); |
475 | 475 | $session = new \OC\Session\Memory(''); |
476 | 476 | $timeFactory = new TimeFactory(); |
@@ -495,14 +495,14 @@ discard block |
||
495 | 495 | $c->getLogger(), |
496 | 496 | $c->query(IEventDispatcher::class) |
497 | 497 | ); |
498 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
498 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
499 | 499 | \OC_Hook::emit('OC_User', 'pre_createUser', ['run' => true, 'uid' => $uid, 'password' => $password]); |
500 | 500 | |
501 | 501 | /** @var IEventDispatcher $dispatcher */ |
502 | 502 | $dispatcher = $this->query(IEventDispatcher::class); |
503 | 503 | $dispatcher->dispatchTyped(new BeforeUserCreatedEvent($uid, $password)); |
504 | 504 | }); |
505 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
505 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
506 | 506 | /** @var $user \OC\User\User */ |
507 | 507 | \OC_Hook::emit('OC_User', 'post_createUser', ['uid' => $user->getUID(), 'password' => $password]); |
508 | 508 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $dispatcher = $this->query(IEventDispatcher::class); |
511 | 511 | $dispatcher->dispatchTyped(new UserCreatedEvent($user, $password)); |
512 | 512 | }); |
513 | - $userSession->listen('\OC\User', 'preDelete', function ($user) use ($legacyDispatcher) { |
|
513 | + $userSession->listen('\OC\User', 'preDelete', function($user) use ($legacyDispatcher) { |
|
514 | 514 | /** @var $user \OC\User\User */ |
515 | 515 | \OC_Hook::emit('OC_User', 'pre_deleteUser', ['run' => true, 'uid' => $user->getUID()]); |
516 | 516 | $legacyDispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | $dispatcher = $this->query(IEventDispatcher::class); |
520 | 520 | $dispatcher->dispatchTyped(new BeforeUserDeletedEvent($user)); |
521 | 521 | }); |
522 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
522 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
523 | 523 | /** @var $user \OC\User\User */ |
524 | 524 | \OC_Hook::emit('OC_User', 'post_deleteUser', ['uid' => $user->getUID()]); |
525 | 525 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $dispatcher = $this->query(IEventDispatcher::class); |
528 | 528 | $dispatcher->dispatchTyped(new UserDeletedEvent($user)); |
529 | 529 | }); |
530 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
530 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
531 | 531 | /** @var $user \OC\User\User */ |
532 | 532 | \OC_Hook::emit('OC_User', 'pre_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
533 | 533 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $dispatcher = $this->query(IEventDispatcher::class); |
536 | 536 | $dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($user, $password, $recoveryPassword)); |
537 | 537 | }); |
538 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
538 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
539 | 539 | /** @var $user \OC\User\User */ |
540 | 540 | \OC_Hook::emit('OC_User', 'post_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
541 | 541 | |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | $dispatcher = $this->query(IEventDispatcher::class); |
544 | 544 | $dispatcher->dispatchTyped(new PasswordUpdatedEvent($user, $password, $recoveryPassword)); |
545 | 545 | }); |
546 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
546 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
547 | 547 | \OC_Hook::emit('OC_User', 'pre_login', ['run' => true, 'uid' => $uid, 'password' => $password]); |
548 | 548 | |
549 | 549 | /** @var IEventDispatcher $dispatcher */ |
550 | 550 | $dispatcher = $this->query(IEventDispatcher::class); |
551 | 551 | $dispatcher->dispatchTyped(new BeforeUserLoggedInEvent($uid, $password)); |
552 | 552 | }); |
553 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password, $isTokenLogin) { |
|
553 | + $userSession->listen('\OC\User', 'postLogin', function($user, $password, $isTokenLogin) { |
|
554 | 554 | /** @var $user \OC\User\User */ |
555 | 555 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'isTokenLogin' => $isTokenLogin]); |
556 | 556 | |
@@ -558,12 +558,12 @@ discard block |
||
558 | 558 | $dispatcher = $this->query(IEventDispatcher::class); |
559 | 559 | $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $password, $isTokenLogin)); |
560 | 560 | }); |
561 | - $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) { |
|
561 | + $userSession->listen('\OC\User', 'preRememberedLogin', function($uid) { |
|
562 | 562 | /** @var IEventDispatcher $dispatcher */ |
563 | 563 | $dispatcher = $this->query(IEventDispatcher::class); |
564 | 564 | $dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid)); |
565 | 565 | }); |
566 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
566 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
567 | 567 | /** @var $user \OC\User\User */ |
568 | 568 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]); |
569 | 569 | |
@@ -571,19 +571,19 @@ discard block |
||
571 | 571 | $dispatcher = $this->query(IEventDispatcher::class); |
572 | 572 | $dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password)); |
573 | 573 | }); |
574 | - $userSession->listen('\OC\User', 'logout', function ($user) { |
|
574 | + $userSession->listen('\OC\User', 'logout', function($user) { |
|
575 | 575 | \OC_Hook::emit('OC_User', 'logout', []); |
576 | 576 | |
577 | 577 | /** @var IEventDispatcher $dispatcher */ |
578 | 578 | $dispatcher = $this->query(IEventDispatcher::class); |
579 | 579 | $dispatcher->dispatchTyped(new BeforeUserLoggedOutEvent($user)); |
580 | 580 | }); |
581 | - $userSession->listen('\OC\User', 'postLogout', function ($user) { |
|
581 | + $userSession->listen('\OC\User', 'postLogout', function($user) { |
|
582 | 582 | /** @var IEventDispatcher $dispatcher */ |
583 | 583 | $dispatcher = $this->query(IEventDispatcher::class); |
584 | 584 | $dispatcher->dispatchTyped(new UserLoggedOutEvent($user)); |
585 | 585 | }); |
586 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
586 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) { |
|
587 | 587 | /** @var $user \OC\User\User */ |
588 | 588 | \OC_Hook::emit('OC_User', 'changeUser', ['run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue]); |
589 | 589 | |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | $this->registerAlias(INavigationManager::class, \OC\NavigationManager::class); |
602 | 602 | $this->registerDeprecatedAlias('NavigationManager', INavigationManager::class); |
603 | 603 | |
604 | - $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
604 | + $this->registerService(\OC\AllConfig::class, function(Server $c) { |
|
605 | 605 | return new \OC\AllConfig( |
606 | 606 | $c->getSystemConfig() |
607 | 607 | ); |
@@ -609,18 +609,18 @@ discard block |
||
609 | 609 | $this->registerDeprecatedAlias('AllConfig', \OC\AllConfig::class); |
610 | 610 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
611 | 611 | |
612 | - $this->registerService(\OC\SystemConfig::class, function ($c) use ($config) { |
|
612 | + $this->registerService(\OC\SystemConfig::class, function($c) use ($config) { |
|
613 | 613 | return new \OC\SystemConfig($config); |
614 | 614 | }); |
615 | 615 | $this->registerDeprecatedAlias('SystemConfig', \OC\SystemConfig::class); |
616 | 616 | |
617 | - $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
617 | + $this->registerService(\OC\AppConfig::class, function(Server $c) { |
|
618 | 618 | return new \OC\AppConfig($c->getDatabaseConnection()); |
619 | 619 | }); |
620 | 620 | $this->registerDeprecatedAlias('AppConfig', \OC\AppConfig::class); |
621 | 621 | $this->registerAlias(IAppConfig::class, \OC\AppConfig::class); |
622 | 622 | |
623 | - $this->registerService(IFactory::class, function (Server $c) { |
|
623 | + $this->registerService(IFactory::class, function(Server $c) { |
|
624 | 624 | return new \OC\L10N\Factory( |
625 | 625 | $c->getConfig(), |
626 | 626 | $c->getRequest(), |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | }); |
631 | 631 | $this->registerDeprecatedAlias('L10NFactory', IFactory::class); |
632 | 632 | |
633 | - $this->registerService(IURLGenerator::class, function (Server $c) { |
|
633 | + $this->registerService(IURLGenerator::class, function(Server $c) { |
|
634 | 634 | $config = $c->getConfig(); |
635 | 635 | $cacheFactory = $c->getMemCacheFactory(); |
636 | 636 | $request = $c->getRequest(); |
@@ -645,12 +645,12 @@ discard block |
||
645 | 645 | $this->registerDeprecatedAlias('AppFetcher', AppFetcher::class); |
646 | 646 | $this->registerDeprecatedAlias('CategoryFetcher', CategoryFetcher::class); |
647 | 647 | |
648 | - $this->registerService(ICache::class, function ($c) { |
|
648 | + $this->registerService(ICache::class, function($c) { |
|
649 | 649 | return new Cache\File(); |
650 | 650 | }); |
651 | 651 | $this->registerDeprecatedAlias('UserCache', ICache::class); |
652 | 652 | |
653 | - $this->registerService(Factory::class, function (Server $c) { |
|
653 | + $this->registerService(Factory::class, function(Server $c) { |
|
654 | 654 | |
655 | 655 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
656 | 656 | ArrayCache::class, |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $version = implode(',', $v); |
666 | 666 | $instanceId = \OC_Util::getInstanceId(); |
667 | 667 | $path = \OC::$SERVERROOT; |
668 | - $prefix = md5($instanceId . '-' . $version . '-' . $path); |
|
668 | + $prefix = md5($instanceId.'-'.$version.'-'.$path); |
|
669 | 669 | return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
670 | 670 | $config->getSystemValue('memcache.local', null), |
671 | 671 | $config->getSystemValue('memcache.distributed', null), |
@@ -678,12 +678,12 @@ discard block |
||
678 | 678 | $this->registerDeprecatedAlias('MemCacheFactory', Factory::class); |
679 | 679 | $this->registerAlias(ICacheFactory::class, Factory::class); |
680 | 680 | |
681 | - $this->registerService('RedisFactory', function (Server $c) { |
|
681 | + $this->registerService('RedisFactory', function(Server $c) { |
|
682 | 682 | $systemConfig = $c->getSystemConfig(); |
683 | 683 | return new RedisFactory($systemConfig); |
684 | 684 | }); |
685 | 685 | |
686 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
686 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
687 | 687 | return new \OC\Activity\Manager( |
688 | 688 | $c->getRequest(), |
689 | 689 | $c->getUserSession(), |
@@ -693,14 +693,14 @@ discard block |
||
693 | 693 | }); |
694 | 694 | $this->registerDeprecatedAlias('ActivityManager', \OCP\Activity\IManager::class); |
695 | 695 | |
696 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
696 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
697 | 697 | return new \OC\Activity\EventMerger( |
698 | 698 | $c->getL10N('lib') |
699 | 699 | ); |
700 | 700 | }); |
701 | 701 | $this->registerAlias(IValidator::class, Validator::class); |
702 | 702 | |
703 | - $this->registerService(AvatarManager::class, function (Server $c) { |
|
703 | + $this->registerService(AvatarManager::class, function(Server $c) { |
|
704 | 704 | return new AvatarManager( |
705 | 705 | $c->query(\OC\User\Manager::class), |
706 | 706 | $c->getAppDataDir('avatar'), |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); |
716 | 716 | $this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class); |
717 | 717 | |
718 | - $this->registerService(\OC\Log::class, function (Server $c) { |
|
718 | + $this->registerService(\OC\Log::class, function(Server $c) { |
|
719 | 719 | $logType = $c->query(AllConfig::class)->getSystemValue('log_type', 'file'); |
720 | 720 | $factory = new LogFactory($c, $this->getSystemConfig()); |
721 | 721 | $logger = $factory->get($logType); |
@@ -728,11 +728,11 @@ discard block |
||
728 | 728 | // PSR-3 logger |
729 | 729 | $this->registerAlias(LoggerInterface::class, PsrLoggerAdapter::class); |
730 | 730 | |
731 | - $this->registerService(ILogFactory::class, function (Server $c) { |
|
731 | + $this->registerService(ILogFactory::class, function(Server $c) { |
|
732 | 732 | return new LogFactory($c, $this->getSystemConfig()); |
733 | 733 | }); |
734 | 734 | |
735 | - $this->registerService(IJobList::class, function (Server $c) { |
|
735 | + $this->registerService(IJobList::class, function(Server $c) { |
|
736 | 736 | $config = $c->getConfig(); |
737 | 737 | return new \OC\BackgroundJob\JobList( |
738 | 738 | $c->getDatabaseConnection(), |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | }); |
743 | 743 | $this->registerDeprecatedAlias('JobList', IJobList::class); |
744 | 744 | |
745 | - $this->registerService(IRouter::class, function (Server $c) { |
|
745 | + $this->registerService(IRouter::class, function(Server $c) { |
|
746 | 746 | $cacheFactory = $c->getMemCacheFactory(); |
747 | 747 | $logger = $c->getLogger(); |
748 | 748 | if ($cacheFactory->isLocalCacheAvailable()) { |
@@ -754,39 +754,39 @@ discard block |
||
754 | 754 | }); |
755 | 755 | $this->registerDeprecatedAlias('Router', IRouter::class); |
756 | 756 | |
757 | - $this->registerService(ISearch::class, function ($c) { |
|
757 | + $this->registerService(ISearch::class, function($c) { |
|
758 | 758 | return new Search(); |
759 | 759 | }); |
760 | 760 | $this->registerDeprecatedAlias('Search', ISearch::class); |
761 | 761 | |
762 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
762 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
763 | 763 | return new \OC\Security\RateLimiting\Backend\MemoryCache( |
764 | 764 | $this->getMemCacheFactory(), |
765 | 765 | new \OC\AppFramework\Utility\TimeFactory() |
766 | 766 | ); |
767 | 767 | }); |
768 | 768 | |
769 | - $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
769 | + $this->registerService(\OCP\Security\ISecureRandom::class, function($c) { |
|
770 | 770 | return new SecureRandom(); |
771 | 771 | }); |
772 | 772 | $this->registerDeprecatedAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
773 | 773 | |
774 | - $this->registerService(ICrypto::class, function (Server $c) { |
|
774 | + $this->registerService(ICrypto::class, function(Server $c) { |
|
775 | 775 | return new Crypto($c->getConfig(), $c->getSecureRandom()); |
776 | 776 | }); |
777 | 777 | $this->registerDeprecatedAlias('Crypto', ICrypto::class); |
778 | 778 | |
779 | - $this->registerService(IHasher::class, function (Server $c) { |
|
779 | + $this->registerService(IHasher::class, function(Server $c) { |
|
780 | 780 | return new Hasher($c->getConfig()); |
781 | 781 | }); |
782 | 782 | $this->registerDeprecatedAlias('Hasher', IHasher::class); |
783 | 783 | |
784 | - $this->registerService(ICredentialsManager::class, function (Server $c) { |
|
784 | + $this->registerService(ICredentialsManager::class, function(Server $c) { |
|
785 | 785 | return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
786 | 786 | }); |
787 | 787 | $this->registerDeprecatedAlias('CredentialsManager', ICredentialsManager::class); |
788 | 788 | |
789 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
789 | + $this->registerService(IDBConnection::class, function(Server $c) { |
|
790 | 790 | $systemConfig = $c->getSystemConfig(); |
791 | 791 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
792 | 792 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | $this->registerDeprecatedAlias('DatabaseConnection', IDBConnection::class); |
802 | 802 | |
803 | 803 | |
804 | - $this->registerService(IClientService::class, function (Server $c) { |
|
804 | + $this->registerService(IClientService::class, function(Server $c) { |
|
805 | 805 | $user = \OC_User::getUser(); |
806 | 806 | $uid = $user ? $user : null; |
807 | 807 | return new ClientService( |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | ); |
817 | 817 | }); |
818 | 818 | $this->registerDeprecatedAlias('HttpClientService', IClientService::class); |
819 | - $this->registerService(IEventLogger::class, function (Server $c) { |
|
819 | + $this->registerService(IEventLogger::class, function(Server $c) { |
|
820 | 820 | $eventLogger = new EventLogger(); |
821 | 821 | if ($c->getSystemConfig()->getValue('debug', false)) { |
822 | 822 | // In debug mode, module is being activated by default |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | }); |
827 | 827 | $this->registerDeprecatedAlias('EventLogger', IEventLogger::class); |
828 | 828 | |
829 | - $this->registerService(IQueryLogger::class, function (Server $c) { |
|
829 | + $this->registerService(IQueryLogger::class, function(Server $c) { |
|
830 | 830 | $queryLogger = new QueryLogger(); |
831 | 831 | if ($c->getSystemConfig()->getValue('debug', false)) { |
832 | 832 | // In debug mode, module is being activated by default |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | }); |
837 | 837 | $this->registerDeprecatedAlias('QueryLogger', IQueryLogger::class); |
838 | 838 | |
839 | - $this->registerService(TempManager::class, function (Server $c) { |
|
839 | + $this->registerService(TempManager::class, function(Server $c) { |
|
840 | 840 | return new TempManager( |
841 | 841 | $c->getLogger(), |
842 | 842 | $c->getConfig() |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | $this->registerDeprecatedAlias('TempManager', TempManager::class); |
846 | 846 | $this->registerAlias(ITempManager::class, TempManager::class); |
847 | 847 | |
848 | - $this->registerService(AppManager::class, function (Server $c) { |
|
848 | + $this->registerService(AppManager::class, function(Server $c) { |
|
849 | 849 | return new \OC\App\AppManager( |
850 | 850 | $c->getUserSession(), |
851 | 851 | $c->getConfig(), |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | $this->registerDeprecatedAlias('AppManager', AppManager::class); |
860 | 860 | $this->registerAlias(IAppManager::class, AppManager::class); |
861 | 861 | |
862 | - $this->registerService(IDateTimeZone::class, function (Server $c) { |
|
862 | + $this->registerService(IDateTimeZone::class, function(Server $c) { |
|
863 | 863 | return new DateTimeZone( |
864 | 864 | $c->getConfig(), |
865 | 865 | $c->getSession() |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | }); |
868 | 868 | $this->registerDeprecatedAlias('DateTimeZone', IDateTimeZone::class); |
869 | 869 | |
870 | - $this->registerService(IDateTimeFormatter::class, function (Server $c) { |
|
870 | + $this->registerService(IDateTimeFormatter::class, function(Server $c) { |
|
871 | 871 | $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
872 | 872 | |
873 | 873 | return new DateTimeFormatter( |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | }); |
878 | 878 | $this->registerDeprecatedAlias('DateTimeFormatter', IDateTimeFormatter::class); |
879 | 879 | |
880 | - $this->registerService(IUserMountCache::class, function (Server $c) { |
|
880 | + $this->registerService(IUserMountCache::class, function(Server $c) { |
|
881 | 881 | $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
882 | 882 | $listener = new UserMountCacheListener($mountCache); |
883 | 883 | $listener->listen($c->getUserManager()); |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | }); |
886 | 886 | $this->registerDeprecatedAlias('UserMountCache', IUserMountCache::class); |
887 | 887 | |
888 | - $this->registerService(IMountProviderCollection::class, function (Server $c) { |
|
888 | + $this->registerService(IMountProviderCollection::class, function(Server $c) { |
|
889 | 889 | $loader = \OC\Files\Filesystem::getLoader(); |
890 | 890 | $mountCache = $c->query(IUserMountCache::class); |
891 | 891 | $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
@@ -901,10 +901,10 @@ discard block |
||
901 | 901 | }); |
902 | 902 | $this->registerDeprecatedAlias('MountConfigManager', IMountProviderCollection::class); |
903 | 903 | |
904 | - $this->registerService('IniWrapper', function ($c) { |
|
904 | + $this->registerService('IniWrapper', function($c) { |
|
905 | 905 | return new IniGetWrapper(); |
906 | 906 | }); |
907 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
907 | + $this->registerService('AsyncCommandBus', function(Server $c) { |
|
908 | 908 | $busClass = $c->getConfig()->getSystemValue('commandbus'); |
909 | 909 | if ($busClass) { |
910 | 910 | list($app, $class) = explode('::', $busClass, 2); |
@@ -919,10 +919,10 @@ discard block |
||
919 | 919 | return new CronBus($jobList); |
920 | 920 | } |
921 | 921 | }); |
922 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
922 | + $this->registerService('TrustedDomainHelper', function($c) { |
|
923 | 923 | return new TrustedDomainHelper($this->getConfig()); |
924 | 924 | }); |
925 | - $this->registerService(Throttler::class, function (Server $c) { |
|
925 | + $this->registerService(Throttler::class, function(Server $c) { |
|
926 | 926 | return new Throttler( |
927 | 927 | $c->getDatabaseConnection(), |
928 | 928 | new TimeFactory(), |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | ); |
932 | 932 | }); |
933 | 933 | $this->registerDeprecatedAlias('Throttler', Throttler::class); |
934 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
934 | + $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
935 | 935 | // IConfig and IAppManager requires a working database. This code |
936 | 936 | // might however be called when ownCloud is not yet setup. |
937 | 937 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | $c->getMimeTypeDetector() |
954 | 954 | ); |
955 | 955 | }); |
956 | - $this->registerService(\OCP\IRequest::class, function ($c) { |
|
956 | + $this->registerService(\OCP\IRequest::class, function($c) { |
|
957 | 957 | if (isset($this['urlParams'])) { |
958 | 958 | $urlParams = $this['urlParams']; |
959 | 959 | } else { |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | }); |
990 | 990 | $this->registerDeprecatedAlias('Request', \OCP\IRequest::class); |
991 | 991 | |
992 | - $this->registerService(IMailer::class, function (Server $c) { |
|
992 | + $this->registerService(IMailer::class, function(Server $c) { |
|
993 | 993 | return new Mailer( |
994 | 994 | $c->getConfig(), |
995 | 995 | $c->getLogger(), |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | }); |
1002 | 1002 | $this->registerDeprecatedAlias('Mailer', IMailer::class); |
1003 | 1003 | |
1004 | - $this->registerService('LDAPProvider', function (Server $c) { |
|
1004 | + $this->registerService('LDAPProvider', function(Server $c) { |
|
1005 | 1005 | $config = $c->getConfig(); |
1006 | 1006 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
1007 | 1007 | if (is_null($factoryClass)) { |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | $factory = new $factoryClass($this); |
1012 | 1012 | return $factory->getLDAPProvider(); |
1013 | 1013 | }); |
1014 | - $this->registerService(ILockingProvider::class, function (Server $c) { |
|
1014 | + $this->registerService(ILockingProvider::class, function(Server $c) { |
|
1015 | 1015 | $ini = $c->getIniWrapper(); |
1016 | 1016 | $config = $c->getConfig(); |
1017 | 1017 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -1034,31 +1034,31 @@ discard block |
||
1034 | 1034 | }); |
1035 | 1035 | $this->registerDeprecatedAlias('LockingProvider', ILockingProvider::class); |
1036 | 1036 | |
1037 | - $this->registerService(IMountManager::class, function () { |
|
1037 | + $this->registerService(IMountManager::class, function() { |
|
1038 | 1038 | return new \OC\Files\Mount\Manager(); |
1039 | 1039 | }); |
1040 | 1040 | $this->registerDeprecatedAlias('MountManager', IMountManager::class); |
1041 | 1041 | |
1042 | - $this->registerService(IMimeTypeDetector::class, function (Server $c) { |
|
1042 | + $this->registerService(IMimeTypeDetector::class, function(Server $c) { |
|
1043 | 1043 | return new \OC\Files\Type\Detection( |
1044 | 1044 | $c->getURLGenerator(), |
1045 | 1045 | $c->getLogger(), |
1046 | 1046 | \OC::$configDir, |
1047 | - \OC::$SERVERROOT . '/resources/config/' |
|
1047 | + \OC::$SERVERROOT.'/resources/config/' |
|
1048 | 1048 | ); |
1049 | 1049 | }); |
1050 | 1050 | $this->registerDeprecatedAlias('MimeTypeDetector', IMimeTypeDetector::class); |
1051 | 1051 | |
1052 | - $this->registerService(IMimeTypeLoader::class, function (Server $c) { |
|
1052 | + $this->registerService(IMimeTypeLoader::class, function(Server $c) { |
|
1053 | 1053 | return new \OC\Files\Type\Loader( |
1054 | 1054 | $c->getDatabaseConnection() |
1055 | 1055 | ); |
1056 | 1056 | }); |
1057 | 1057 | $this->registerDeprecatedAlias('MimeTypeLoader', IMimeTypeLoader::class); |
1058 | - $this->registerService(BundleFetcher::class, function () { |
|
1058 | + $this->registerService(BundleFetcher::class, function() { |
|
1059 | 1059 | return new BundleFetcher($this->getL10N('lib')); |
1060 | 1060 | }); |
1061 | - $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
1061 | + $this->registerService(\OCP\Notification\IManager::class, function(Server $c) { |
|
1062 | 1062 | return new Manager( |
1063 | 1063 | $c->query(IValidator::class), |
1064 | 1064 | $c->getLogger() |
@@ -1066,29 +1066,29 @@ discard block |
||
1066 | 1066 | }); |
1067 | 1067 | $this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class); |
1068 | 1068 | |
1069 | - $this->registerService(CapabilitiesManager::class, function (Server $c) { |
|
1069 | + $this->registerService(CapabilitiesManager::class, function(Server $c) { |
|
1070 | 1070 | $manager = new CapabilitiesManager($c->getLogger()); |
1071 | - $manager->registerCapability(function () use ($c) { |
|
1071 | + $manager->registerCapability(function() use ($c) { |
|
1072 | 1072 | return new \OC\OCS\CoreCapabilities($c->getConfig()); |
1073 | 1073 | }); |
1074 | - $manager->registerCapability(function () use ($c) { |
|
1074 | + $manager->registerCapability(function() use ($c) { |
|
1075 | 1075 | return $c->query(\OC\Security\Bruteforce\Capabilities::class); |
1076 | 1076 | }); |
1077 | 1077 | return $manager; |
1078 | 1078 | }); |
1079 | 1079 | $this->registerDeprecatedAlias('CapabilitiesManager', CapabilitiesManager::class); |
1080 | 1080 | |
1081 | - $this->registerService(ICommentsManager::class, function (Server $c) { |
|
1081 | + $this->registerService(ICommentsManager::class, function(Server $c) { |
|
1082 | 1082 | $config = $c->getConfig(); |
1083 | 1083 | $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
1084 | 1084 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
1085 | 1085 | $factory = new $factoryClass($this); |
1086 | 1086 | $manager = $factory->getManager(); |
1087 | 1087 | |
1088 | - $manager->registerDisplayNameResolver('user', function ($id) use ($c) { |
|
1088 | + $manager->registerDisplayNameResolver('user', function($id) use ($c) { |
|
1089 | 1089 | $manager = $c->getUserManager(); |
1090 | 1090 | $user = $manager->get($id); |
1091 | - if(is_null($user)) { |
|
1091 | + if (is_null($user)) { |
|
1092 | 1092 | $l = $c->getL10N('core'); |
1093 | 1093 | $displayName = $l->t('Unknown user'); |
1094 | 1094 | } else { |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | }); |
1102 | 1102 | $this->registerDeprecatedAlias('CommentsManager', ICommentsManager::class); |
1103 | 1103 | |
1104 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
1104 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
1105 | 1105 | /* |
1106 | 1106 | * Dark magic for autoloader. |
1107 | 1107 | * If we do a class_exists it will try to load the class which will |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | } |
1130 | 1130 | return new \OC_Defaults(); |
1131 | 1131 | }); |
1132 | - $this->registerService(SCSSCacher::class, function (Server $c) { |
|
1132 | + $this->registerService(SCSSCacher::class, function(Server $c) { |
|
1133 | 1133 | return new SCSSCacher( |
1134 | 1134 | $c->getLogger(), |
1135 | 1135 | $c->query(\OC\Files\AppData\Factory::class), |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | new TimeFactory() |
1143 | 1143 | ); |
1144 | 1144 | }); |
1145 | - $this->registerService(JSCombiner::class, function (Server $c) { |
|
1145 | + $this->registerService(JSCombiner::class, function(Server $c) { |
|
1146 | 1146 | return new JSCombiner( |
1147 | 1147 | $c->getAppDataDir('js'), |
1148 | 1148 | $c->getURLGenerator(), |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $this->registerDeprecatedAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class); |
1156 | 1156 | $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class); |
1157 | 1157 | |
1158 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
1158 | + $this->registerService('CryptoWrapper', function(Server $c) { |
|
1159 | 1159 | // FIXME: Instantiiated here due to cyclic dependency |
1160 | 1160 | $request = new Request( |
1161 | 1161 | [ |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | $request |
1181 | 1181 | ); |
1182 | 1182 | }); |
1183 | - $this->registerService(CsrfTokenManager::class, function (Server $c) { |
|
1183 | + $this->registerService(CsrfTokenManager::class, function(Server $c) { |
|
1184 | 1184 | $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
1185 | 1185 | |
1186 | 1186 | return new CsrfTokenManager( |
@@ -1189,20 +1189,20 @@ discard block |
||
1189 | 1189 | ); |
1190 | 1190 | }); |
1191 | 1191 | $this->registerDeprecatedAlias('CsrfTokenManager', CsrfTokenManager::class); |
1192 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
1192 | + $this->registerService(SessionStorage::class, function(Server $c) { |
|
1193 | 1193 | return new SessionStorage($c->getSession()); |
1194 | 1194 | }); |
1195 | 1195 | $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class); |
1196 | 1196 | $this->registerDeprecatedAlias('ContentSecurityPolicyManager', ContentSecurityPolicyManager::class); |
1197 | 1197 | |
1198 | - $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { |
|
1198 | + $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) { |
|
1199 | 1199 | return new ContentSecurityPolicyNonceManager( |
1200 | 1200 | $c->getCsrfTokenManager(), |
1201 | 1201 | $c->getRequest() |
1202 | 1202 | ); |
1203 | 1203 | }); |
1204 | 1204 | |
1205 | - $this->registerService(\OCP\Share\IManager::class, function (Server $c) { |
|
1205 | + $this->registerService(\OCP\Share\IManager::class, function(Server $c) { |
|
1206 | 1206 | $config = $c->getConfig(); |
1207 | 1207 | $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
1208 | 1208 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | }); |
1232 | 1232 | $this->registerDeprecatedAlias('ShareManager', \OCP\Share\IManager::class); |
1233 | 1233 | |
1234 | - $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c) { |
|
1234 | + $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) { |
|
1235 | 1235 | $instance = new Collaboration\Collaborators\Search($c); |
1236 | 1236 | |
1237 | 1237 | // register default plugins |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | $this->registerAlias(\OCP\Collaboration\Resources\IProviderManager::class, \OC\Collaboration\Resources\ProviderManager::class); |
1252 | 1252 | $this->registerAlias(\OCP\Collaboration\Resources\IManager::class, \OC\Collaboration\Resources\Manager::class); |
1253 | 1253 | |
1254 | - $this->registerService('SettingsManager', function (Server $c) { |
|
1254 | + $this->registerService('SettingsManager', function(Server $c) { |
|
1255 | 1255 | $manager = new \OC\Settings\Manager( |
1256 | 1256 | $c->getLogger(), |
1257 | 1257 | $c->getL10NFactory(), |
@@ -1260,36 +1260,36 @@ discard block |
||
1260 | 1260 | ); |
1261 | 1261 | return $manager; |
1262 | 1262 | }); |
1263 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
1263 | + $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
1264 | 1264 | return new \OC\Files\AppData\Factory( |
1265 | 1265 | $c->getRootFolder(), |
1266 | 1266 | $c->getSystemConfig() |
1267 | 1267 | ); |
1268 | 1268 | }); |
1269 | 1269 | |
1270 | - $this->registerService('LockdownManager', function (Server $c) { |
|
1271 | - return new LockdownManager(function () use ($c) { |
|
1270 | + $this->registerService('LockdownManager', function(Server $c) { |
|
1271 | + return new LockdownManager(function() use ($c) { |
|
1272 | 1272 | return $c->getSession(); |
1273 | 1273 | }); |
1274 | 1274 | }); |
1275 | 1275 | |
1276 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
1276 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) { |
|
1277 | 1277 | return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
1278 | 1278 | }); |
1279 | 1279 | |
1280 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
1280 | + $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
1281 | 1281 | return new CloudIdManager(); |
1282 | 1282 | }); |
1283 | 1283 | |
1284 | - $this->registerService(IConfig::class, function (Server $c) { |
|
1284 | + $this->registerService(IConfig::class, function(Server $c) { |
|
1285 | 1285 | return new GlobalScale\Config($c->getConfig()); |
1286 | 1286 | }); |
1287 | 1287 | |
1288 | - $this->registerService(ICloudFederationProviderManager::class, function (Server $c) { |
|
1288 | + $this->registerService(ICloudFederationProviderManager::class, function(Server $c) { |
|
1289 | 1289 | return new CloudFederationProviderManager($c->getAppManager(), $c->getHTTPClientService(), $c->getCloudIdManager(), $c->getLogger()); |
1290 | 1290 | }); |
1291 | 1291 | |
1292 | - $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
1292 | + $this->registerService(ICloudFederationFactory::class, function(Server $c) { |
|
1293 | 1293 | return new CloudFederationFactory(); |
1294 | 1294 | }); |
1295 | 1295 | |
@@ -1299,24 +1299,24 @@ discard block |
||
1299 | 1299 | $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
1300 | 1300 | $this->registerDeprecatedAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
1301 | 1301 | |
1302 | - $this->registerService(Defaults::class, function (Server $c) { |
|
1302 | + $this->registerService(Defaults::class, function(Server $c) { |
|
1303 | 1303 | return new Defaults( |
1304 | 1304 | $c->getThemingDefaults() |
1305 | 1305 | ); |
1306 | 1306 | }); |
1307 | 1307 | $this->registerDeprecatedAlias('Defaults', \OCP\Defaults::class); |
1308 | 1308 | |
1309 | - $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) { |
|
1309 | + $this->registerService(\OCP\ISession::class, function(SimpleContainer $c) { |
|
1310 | 1310 | return $c->query(\OCP\IUserSession::class)->getSession(); |
1311 | 1311 | }); |
1312 | 1312 | |
1313 | - $this->registerService(IShareHelper::class, function (Server $c) { |
|
1313 | + $this->registerService(IShareHelper::class, function(Server $c) { |
|
1314 | 1314 | return new ShareHelper( |
1315 | 1315 | $c->query(\OCP\Share\IManager::class) |
1316 | 1316 | ); |
1317 | 1317 | }); |
1318 | 1318 | |
1319 | - $this->registerService(Installer::class, function (Server $c) { |
|
1319 | + $this->registerService(Installer::class, function(Server $c) { |
|
1320 | 1320 | return new Installer( |
1321 | 1321 | $c->getAppFetcher(), |
1322 | 1322 | $c->getHTTPClientService(), |
@@ -1327,16 +1327,16 @@ discard block |
||
1327 | 1327 | ); |
1328 | 1328 | }); |
1329 | 1329 | |
1330 | - $this->registerService(IApiFactory::class, function (Server $c) { |
|
1330 | + $this->registerService(IApiFactory::class, function(Server $c) { |
|
1331 | 1331 | return new ApiFactory($c->getHTTPClientService()); |
1332 | 1332 | }); |
1333 | 1333 | |
1334 | - $this->registerService(IInstanceFactory::class, function (Server $c) { |
|
1334 | + $this->registerService(IInstanceFactory::class, function(Server $c) { |
|
1335 | 1335 | $memcacheFactory = $c->getMemCacheFactory(); |
1336 | 1336 | return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService()); |
1337 | 1337 | }); |
1338 | 1338 | |
1339 | - $this->registerService(IContactsStore::class, function (Server $c) { |
|
1339 | + $this->registerService(IContactsStore::class, function(Server $c) { |
|
1340 | 1340 | return new ContactsStore( |
1341 | 1341 | $c->getContactsManager(), |
1342 | 1342 | $c->getConfig(), |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | $this->registerAlias(IContactsStore::class, ContactsStore::class); |
1348 | 1348 | $this->registerAlias(IAccountManager::class, AccountManager::class); |
1349 | 1349 | |
1350 | - $this->registerService(IStorageFactory::class, function () { |
|
1350 | + $this->registerService(IStorageFactory::class, function() { |
|
1351 | 1351 | return new StorageFactory(); |
1352 | 1352 | }); |
1353 | 1353 | |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | $dispatcher = $this->getEventDispatcher(); |
1387 | 1387 | |
1388 | 1388 | // Delete avatar on user deletion |
1389 | - $dispatcher->addListener('OCP\IUser::preDelete', function (GenericEvent $e) { |
|
1389 | + $dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) { |
|
1390 | 1390 | $logger = $this->getLogger(); |
1391 | 1391 | $manager = $this->getAvatarManager(); |
1392 | 1392 | /** @var IUser $user */ |
@@ -1399,11 +1399,11 @@ discard block |
||
1399 | 1399 | // no avatar to remove |
1400 | 1400 | } catch (\Exception $e) { |
1401 | 1401 | // Ignore exceptions |
1402 | - $logger->info('Could not cleanup avatar of ' . $user->getUID()); |
|
1402 | + $logger->info('Could not cleanup avatar of '.$user->getUID()); |
|
1403 | 1403 | } |
1404 | 1404 | }); |
1405 | 1405 | |
1406 | - $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) { |
|
1406 | + $dispatcher->addListener('OCP\IUser::changeUser', function(GenericEvent $e) { |
|
1407 | 1407 | $manager = $this->getAvatarManager(); |
1408 | 1408 | /** @var IUser $user */ |
1409 | 1409 | $user = $e->getSubject(); |
@@ -1563,7 +1563,7 @@ discard block |
||
1563 | 1563 | * @deprecated since 9.2.0 use IAppData |
1564 | 1564 | */ |
1565 | 1565 | public function getAppFolder() { |
1566 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
1566 | + $dir = '/'.\OC_App::getCurrentApp(); |
|
1567 | 1567 | $root = $this->getRootFolder(); |
1568 | 1568 | if (!$root->nodeExists($dir)) { |
1569 | 1569 | $folder = $root->newFolder($dir); |
@@ -2237,11 +2237,11 @@ discard block |
||
2237 | 2237 | } |
2238 | 2238 | |
2239 | 2239 | private function registerDeprecatedAlias(string $alias, string $target) { |
2240 | - $this->registerService($alias, function (IContainer $container) use ($target, $alias) { |
|
2240 | + $this->registerService($alias, function(IContainer $container) use ($target, $alias) { |
|
2241 | 2241 | try { |
2242 | 2242 | /** @var ILogger $logger */ |
2243 | 2243 | $logger = $container->query(ILogger::class); |
2244 | - $logger->debug('The requested alias "' . $alias . '" is depreacted. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
2244 | + $logger->debug('The requested alias "'.$alias.'" is depreacted. Please request "'.$target.'" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
2245 | 2245 | } catch (QueryException $e) { |
2246 | 2246 | // Could not get logger. Continue |
2247 | 2247 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | class Streamer { |
41 | 41 | // array of regexp. Matching user agents will get tar instead of zip |
42 | - private $preferTarFor = [ '/macintosh|mac os x/i' ]; |
|
42 | + private $preferTarFor = ['/macintosh|mac os x/i']; |
|
43 | 43 | |
44 | 44 | // streamer instance |
45 | 45 | private $streamerInstance; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function sendHeaders($name) { |
93 | 93 | $extension = $this->streamerInstance instanceof ZipStreamer ? '.zip' : '.tar'; |
94 | - $fullName = $name . $extension; |
|
94 | + $fullName = $name.$extension; |
|
95 | 95 | $this->streamerInstance->sendHeaders($fullName); |
96 | 96 | } |
97 | 97 | |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function addDirRecursive(string $dir, string $internalDir = ''): void { |
106 | 106 | $dirname = basename($dir); |
107 | - $rootDir = $internalDir . $dirname; |
|
107 | + $rootDir = $internalDir.$dirname; |
|
108 | 108 | if (!empty($rootDir)) { |
109 | 109 | $this->streamerInstance->addEmptyDir($rootDir); |
110 | 110 | } |
111 | - $internalDir .= $dirname . '/'; |
|
111 | + $internalDir .= $dirname.'/'; |
|
112 | 112 | // prevent absolute dirs |
113 | 113 | $internalDir = ltrim($internalDir, '/'); |
114 | 114 | |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | $dirNode = $userFolder->get($dir); |
118 | 118 | $files = $dirNode->getDirectoryListing(); |
119 | 119 | |
120 | - foreach($files as $file) { |
|
121 | - if($file instanceof File) { |
|
120 | + foreach ($files as $file) { |
|
121 | + if ($file instanceof File) { |
|
122 | 122 | try { |
123 | 123 | $fh = $file->fopen('r'); |
124 | 124 | } catch (NotPermittedException $e) { |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | } |
127 | 127 | $this->addFileFromStream( |
128 | 128 | $fh, |
129 | - $internalDir . $file->getName(), |
|
129 | + $internalDir.$file->getName(), |
|
130 | 130 | $file->getSize(), |
131 | 131 | $file->getMTime() |
132 | 132 | ); |
133 | 133 | fclose($fh); |
134 | 134 | } elseif ($file instanceof Folder) { |
135 | - if($file->isReadable()) { |
|
136 | - $this->addDirRecursive($dir . '/' . $file->getName(), $internalDir); |
|
135 | + if ($file->isReadable()) { |
|
136 | + $this->addDirRecursive($dir.'/'.$file->getName(), $internalDir); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | } |
@@ -105,65 +105,65 @@ discard block |
||
105 | 105 | /** |
106 | 106 | * Core services |
107 | 107 | */ |
108 | - $this->registerService(IOutput::class, function () { |
|
108 | + $this->registerService(IOutput::class, function() { |
|
109 | 109 | return new Output($this->getServer()->getWebRoot()); |
110 | 110 | }); |
111 | 111 | |
112 | - $this->registerService(Folder::class, function () { |
|
112 | + $this->registerService(Folder::class, function() { |
|
113 | 113 | return $this->getServer()->getUserFolder(); |
114 | 114 | }); |
115 | 115 | |
116 | - $this->registerService(IAppData::class, function (SimpleContainer $c) { |
|
116 | + $this->registerService(IAppData::class, function(SimpleContainer $c) { |
|
117 | 117 | return $this->getServer()->getAppDataDir($c->query('AppName')); |
118 | 118 | }); |
119 | 119 | |
120 | - $this->registerService(IL10N::class, function ($c) { |
|
120 | + $this->registerService(IL10N::class, function($c) { |
|
121 | 121 | return $this->getServer()->getL10N($c->query('AppName')); |
122 | 122 | }); |
123 | 123 | |
124 | 124 | // Log wrapper |
125 | - $this->registerService(ILogger::class, function ($c) { |
|
125 | + $this->registerService(ILogger::class, function($c) { |
|
126 | 126 | return new OC\AppFramework\Logger($this->server->query(ILogger::class), $c->query('AppName')); |
127 | 127 | }); |
128 | 128 | |
129 | - $this->registerService(IServerContainer::class, function () { |
|
129 | + $this->registerService(IServerContainer::class, function() { |
|
130 | 130 | return $this->getServer(); |
131 | 131 | }); |
132 | 132 | $this->registerAlias('ServerContainer', IServerContainer::class); |
133 | 133 | |
134 | - $this->registerService(\OCP\WorkflowEngine\IManager::class, function ($c) { |
|
134 | + $this->registerService(\OCP\WorkflowEngine\IManager::class, function($c) { |
|
135 | 135 | return $c->query(Manager::class); |
136 | 136 | }); |
137 | 137 | |
138 | - $this->registerService(\OCP\AppFramework\IAppContainer::class, function ($c) { |
|
138 | + $this->registerService(\OCP\AppFramework\IAppContainer::class, function($c) { |
|
139 | 139 | return $c; |
140 | 140 | }); |
141 | 141 | |
142 | 142 | // commonly used attributes |
143 | - $this->registerService('UserId', function ($c) { |
|
143 | + $this->registerService('UserId', function($c) { |
|
144 | 144 | return $c->query(IUserSession::class)->getSession()->get('user_id'); |
145 | 145 | }); |
146 | 146 | |
147 | - $this->registerService('WebRoot', function ($c) { |
|
147 | + $this->registerService('WebRoot', function($c) { |
|
148 | 148 | return $c->query('ServerContainer')->getWebRoot(); |
149 | 149 | }); |
150 | 150 | |
151 | - $this->registerService('OC_Defaults', function ($c) { |
|
151 | + $this->registerService('OC_Defaults', function($c) { |
|
152 | 152 | return $c->getServer()->getThemingDefaults(); |
153 | 153 | }); |
154 | 154 | |
155 | - $this->registerService(IConfig::class, function ($c) { |
|
155 | + $this->registerService(IConfig::class, function($c) { |
|
156 | 156 | return $c->query(OC\GlobalScale\Config::class); |
157 | 157 | }); |
158 | 158 | |
159 | - $this->registerService('Protocol', function ($c) { |
|
159 | + $this->registerService('Protocol', function($c) { |
|
160 | 160 | /** @var \OC\Server $server */ |
161 | 161 | $server = $c->query('ServerContainer'); |
162 | 162 | $protocol = $server->getRequest()->getHttpProtocol(); |
163 | 163 | return new Http($_SERVER, $protocol); |
164 | 164 | }); |
165 | 165 | |
166 | - $this->registerService('Dispatcher', function ($c) { |
|
166 | + $this->registerService('Dispatcher', function($c) { |
|
167 | 167 | return new Dispatcher( |
168 | 168 | $c['Protocol'], |
169 | 169 | $c['MiddlewareDispatcher'], |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | /** |
183 | 183 | * Middleware |
184 | 184 | */ |
185 | - $this->registerService('MiddlewareDispatcher', function (SimpleContainer $c) { |
|
186 | - $server = $this->getServer(); |
|
185 | + $this->registerService('MiddlewareDispatcher', function(SimpleContainer $c) { |
|
186 | + $server = $this->getServer(); |
|
187 | 187 | |
188 | 188 | $dispatcher = new MiddlewareDispatcher(); |
189 | 189 | $dispatcher->registerMiddleware( |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $c->query(\OC\AppFramework\Middleware\AdditionalScriptsMiddleware::class) |
279 | 279 | ); |
280 | 280 | |
281 | - foreach($this->middleWares as $middleWare) { |
|
281 | + foreach ($this->middleWares as $middleWare) { |
|
282 | 282 | $dispatcher->registerMiddleware($c->query($middleWare)); |
283 | 283 | } |
284 | 284 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @return mixed |
351 | 351 | */ |
352 | 352 | public function log($message, $level) { |
353 | - switch($level){ |
|
353 | + switch ($level) { |
|
354 | 354 | case 'debug': |
355 | 355 | $level = ILogger::DEBUG; |
356 | 356 | break; |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @param string $serviceName e.g. 'OCA\Files\Capabilities' |
377 | 377 | */ |
378 | 378 | public function registerCapability($serviceName) { |
379 | - $this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) { |
|
379 | + $this->query('OC\CapabilitiesManager')->registerCapability(function() use ($serviceName) { |
|
380 | 380 | return $this->query($serviceName); |
381 | 381 | }); |
382 | 382 | } |
@@ -411,12 +411,12 @@ discard block |
||
411 | 411 | return parent::query($name); |
412 | 412 | } else if ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) { |
413 | 413 | return parent::query($name); |
414 | - } else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) { |
|
414 | + } else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']).'\\') === 0) { |
|
415 | 415 | return parent::query($name); |
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
419 | - throw new QueryException('Could not resolve ' . $name . '!' . |
|
419 | + throw new QueryException('Could not resolve '.$name.'!'. |
|
420 | 420 | ' Class can not be instantiated', 1); |
421 | 421 | } |
422 | 422 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | $default = null; |
85 | - if($param->isOptional()) { |
|
85 | + if ($param->isOptional()) { |
|
86 | 86 | $default = $param->getDefaultValue(); |
87 | 87 | } |
88 | 88 | $this->parameters[$param->name] = $default; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * would return int or null if not existing |
98 | 98 | */ |
99 | 99 | public function getType(string $parameter) { |
100 | - if(array_key_exists($parameter, $this->types)) { |
|
100 | + if (array_key_exists($parameter, $this->types)) { |
|
101 | 101 | return $this->types[$parameter]; |
102 | 102 | } |
103 | 103 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | public function getAnnotationParameter(string $name, string $key): string { |
131 | - if(isset($this->annotations[$name][$key])) { |
|
131 | + if (isset($this->annotations[$name][$key])) { |
|
132 | 132 | return $this->annotations[$name][$key]; |
133 | 133 | } |
134 | 134 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | // ensure that @CORS annotated API routes are not used in conjunction |
85 | 85 | // with session authentication since this enables CSRF attack vectors |
86 | 86 | if ($this->reflector->hasAnnotation('CORS') && |
87 | - !$this->reflector->hasAnnotation('PublicPage')) { |
|
87 | + !$this->reflector->hasAnnotation('PublicPage')) { |
|
88 | 88 | $user = $this->request->server['PHP_AUTH_USER']; |
89 | 89 | $pass = $this->request->server['PHP_AUTH_PW']; |
90 | 90 | |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | public function afterController($controller, $methodName, Response $response) { |
114 | 114 | // only react if its a CORS request and if the request sends origin and |
115 | 115 | |
116 | - if(isset($this->request->server['HTTP_ORIGIN']) && |
|
116 | + if (isset($this->request->server['HTTP_ORIGIN']) && |
|
117 | 117 | $this->reflector->hasAnnotation('CORS')) { |
118 | 118 | |
119 | 119 | // allow credentials headers must not be true or CSRF is possible |
120 | 120 | // otherwise |
121 | - foreach($response->getHeaders() as $header => $value) { |
|
122 | - if(strtolower($header) === 'access-control-allow-credentials' && |
|
121 | + foreach ($response->getHeaders() as $header => $value) { |
|
122 | + if (strtolower($header) === 'access-control-allow-credentials' && |
|
123 | 123 | strtolower(trim($value)) === 'true') { |
124 | 124 | $msg = 'Access-Control-Allow-Credentials must not be '. |
125 | 125 | 'set to true in order to prevent CSRF'; |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | * @return Response a Response object or null in case that the exception could not be handled |
145 | 145 | */ |
146 | 146 | public function afterException($controller, $methodName, \Exception $exception) { |
147 | - if($exception instanceof SecurityException){ |
|
148 | - $response = new JSONResponse(['message' => $exception->getMessage()]); |
|
149 | - if($exception->getCode() !== 0) { |
|
147 | + if ($exception instanceof SecurityException) { |
|
148 | + $response = new JSONResponse(['message' => $exception->getMessage()]); |
|
149 | + if ($exception->getCode() !== 0) { |
|
150 | 150 | $response->setStatus($exception->getCode()); |
151 | 151 | } else { |
152 | 152 | $response->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |