@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | Filesystem::initMountPoints($uid); |
| 113 | 113 | if ($uid !== OC_User::getUser()) { |
| 114 | 114 | $info = Filesystem::getFileInfo($filename); |
| 115 | - $ownerView = new View('/' . $uid . '/files'); |
|
| 115 | + $ownerView = new View('/'.$uid.'/files'); |
|
| 116 | 116 | try { |
| 117 | 117 | $filename = $ownerView->getPath($info['fileid']); |
| 118 | 118 | } catch (NotFoundException $e) { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | private static function setUpTrash($user) { |
| 177 | - $view = new View('/' . $user); |
|
| 177 | + $view = new View('/'.$user); |
|
| 178 | 178 | if (!$view->is_dir('files_trashbin')) { |
| 179 | 179 | $view->mkdir('files_trashbin'); |
| 180 | 180 | } |
@@ -209,8 +209,8 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | $view = new View('/'); |
| 211 | 211 | |
| 212 | - $target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp; |
|
| 213 | - $source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp; |
|
| 212 | + $target = $user.'/files_trashbin/files/'.$targetFilename.'.d'.$timestamp; |
|
| 213 | + $source = $owner.'/files_trashbin/files/'.$sourceFilename.'.d'.$timestamp; |
|
| 214 | 214 | $free = $view->free_space($target); |
| 215 | 215 | $isUnknownOrUnlimitedFreeSpace = $free < 0; |
| 216 | 216 | $isEnoughFreeSpaceLeft = $view->filesize($source) < $free; |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | $ownerPath = $file_path; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $ownerView = new View('/' . $owner); |
|
| 257 | + $ownerView = new View('/'.$owner); |
|
| 258 | 258 | // file has been deleted in between |
| 259 | - if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) { |
|
| 259 | + if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/'.$ownerPath)) { |
|
| 260 | 260 | return true; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $lockingProvider = \OC::$server->getLockingProvider(); |
| 278 | 278 | |
| 279 | 279 | // disable proxy to prevent recursive calls |
| 280 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
| 280 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
| 281 | 281 | $gotLock = false; |
| 282 | 282 | |
| 283 | 283 | while (!$gotLock) { |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | $timestamp = $timestamp + 1; |
| 295 | 295 | |
| 296 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
| 296 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /** @var \OC\Files\Storage\Storage $sourceStorage */ |
| 301 | - [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/' . $ownerPath); |
|
| 301 | + [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/'.$ownerPath); |
|
| 302 | 302 | |
| 303 | 303 | |
| 304 | 304 | if ($trashStorage->file_exists($trashInternalPath)) { |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | $config = \OC::$server->getConfig(); |
| 309 | - $systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
| 310 | - $userTrashbinSize = (int)$config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1'); |
|
| 309 | + $systemTrashbinSize = (int) $config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
| 310 | + $userTrashbinSize = (int) $config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1'); |
|
| 311 | 311 | $configuredTrashbinSize = ($userTrashbinSize < 0) ? $systemTrashbinSize : $userTrashbinSize; |
| 312 | 312 | if ($configuredTrashbinSize >= 0 && $sourceStorage->filesize($sourceInternalPath) >= $configuredTrashbinSize) { |
| 313 | 313 | return false; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | if ($trashStorage->file_exists($trashInternalPath)) { |
| 328 | 328 | $trashStorage->unlink($trashInternalPath); |
| 329 | 329 | } |
| 330 | - \OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']); |
|
| 330 | + \OC::$server->getLogger()->error('Couldn\'t move '.$file_path.' to the trash bin', ['app' => 'files_trashbin']); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | \OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']); |
| 359 | 359 | } |
| 360 | 360 | \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path), |
| 361 | - 'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)]); |
|
| 361 | + 'trashPath' => Filesystem::normalizePath($filename.'.d'.$timestamp)]); |
|
| 362 | 362 | |
| 363 | 363 | self::retainVersions($filename, $owner, $ownerPath, $timestamp); |
| 364 | 364 | |
@@ -393,17 +393,17 @@ discard block |
||
| 393 | 393 | $user = OC_User::getUser(); |
| 394 | 394 | $rootView = new View('/'); |
| 395 | 395 | |
| 396 | - if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) { |
|
| 396 | + if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) { |
|
| 397 | 397 | if ($owner !== $user) { |
| 398 | - self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView); |
|
| 398 | + self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.basename($ownerPath).'.d'.$timestamp, $rootView); |
|
| 399 | 399 | } |
| 400 | - self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp); |
|
| 400 | + self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.$filename.'.d'.$timestamp); |
|
| 401 | 401 | } elseif ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) { |
| 402 | 402 | foreach ($versions as $v) { |
| 403 | 403 | if ($owner !== $user) { |
| 404 | - self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp); |
|
| 404 | + self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.$v['name'].'.v'.$v['version'].'.d'.$timestamp); |
|
| 405 | 405 | } |
| 406 | - self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp); |
|
| 406 | + self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.$filename.'.v'.$v['version'].'.d'.$timestamp); |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | } |
@@ -465,18 +465,18 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | public static function restore($file, $filename, $timestamp) { |
| 467 | 467 | $user = OC_User::getUser(); |
| 468 | - $view = new View('/' . $user); |
|
| 468 | + $view = new View('/'.$user); |
|
| 469 | 469 | |
| 470 | 470 | $location = ''; |
| 471 | 471 | if ($timestamp) { |
| 472 | 472 | $location = self::getLocation($user, $filename, $timestamp); |
| 473 | 473 | if ($location === false) { |
| 474 | - \OC::$server->getLogger()->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']); |
|
| 474 | + \OC::$server->getLogger()->error('trash bin database inconsistent! ($user: '.$user.' $filename: '.$filename.', $timestamp: '.$timestamp.')', ['app' => 'files_trashbin']); |
|
| 475 | 475 | } else { |
| 476 | 476 | // if location no longer exists, restore file in the root directory |
| 477 | 477 | if ($location !== '/' && |
| 478 | - (!$view->is_dir('files/' . $location) || |
|
| 479 | - !$view->isCreatable('files/' . $location)) |
|
| 478 | + (!$view->is_dir('files/'.$location) || |
|
| 479 | + !$view->isCreatable('files/'.$location)) |
|
| 480 | 480 | ) { |
| 481 | 481 | $location = ''; |
| 482 | 482 | } |
@@ -486,8 +486,8 @@ discard block |
||
| 486 | 486 | // we need a extension in case a file/dir with the same name already exists |
| 487 | 487 | $uniqueFilename = self::getUniqueFilename($location, $filename, $view); |
| 488 | 488 | |
| 489 | - $source = Filesystem::normalizePath('files_trashbin/files/' . $file); |
|
| 490 | - $target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename); |
|
| 489 | + $source = Filesystem::normalizePath('files_trashbin/files/'.$file); |
|
| 490 | + $target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename); |
|
| 491 | 491 | if (!$view->file_exists($source)) { |
| 492 | 492 | return false; |
| 493 | 493 | } |
@@ -502,10 +502,10 @@ discard block |
||
| 502 | 502 | // handle the restore result |
| 503 | 503 | if ($restoreResult) { |
| 504 | 504 | $fakeRoot = $view->getRoot(); |
| 505 | - $view->chroot('/' . $user . '/files'); |
|
| 506 | - $view->touch('/' . $location . '/' . $uniqueFilename, $mtime); |
|
| 505 | + $view->chroot('/'.$user.'/files'); |
|
| 506 | + $view->touch('/'.$location.'/'.$uniqueFilename, $mtime); |
|
| 507 | 507 | $view->chroot($fakeRoot); |
| 508 | - \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename), |
|
| 508 | + \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename), |
|
| 509 | 509 | 'trashPath' => Filesystem::normalizePath($file)]); |
| 510 | 510 | |
| 511 | 511 | self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | $user = OC_User::getUser(); |
| 542 | 542 | $rootView = new View('/'); |
| 543 | 543 | |
| 544 | - $target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename); |
|
| 544 | + $target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename); |
|
| 545 | 545 | |
| 546 | 546 | [$owner, $ownerPath] = self::getUidAndFilename($target); |
| 547 | 547 | |
@@ -556,14 +556,14 @@ discard block |
||
| 556 | 556 | $versionedFile = $file; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - if ($view->is_dir('/files_trashbin/versions/' . $file)) { |
|
| 560 | - $rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath)); |
|
| 559 | + if ($view->is_dir('/files_trashbin/versions/'.$file)) { |
|
| 560 | + $rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath)); |
|
| 561 | 561 | } elseif ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) { |
| 562 | 562 | foreach ($versions as $v) { |
| 563 | 563 | if ($timestamp) { |
| 564 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
| 564 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
| 565 | 565 | } else { |
| 566 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
| 566 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | public static function deleteAll() { |
| 577 | 577 | $user = OC_User::getUser(); |
| 578 | 578 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
| 579 | - $view = new View('/' . $user); |
|
| 579 | + $view = new View('/'.$user); |
|
| 580 | 580 | $fileInfos = $view->getDirectoryContent('files_trashbin/files'); |
| 581 | 581 | |
| 582 | 582 | try { |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | */ |
| 652 | 652 | public static function delete($filename, $user, $timestamp = null) { |
| 653 | 653 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
| 654 | - $view = new View('/' . $user); |
|
| 654 | + $view = new View('/'.$user); |
|
| 655 | 655 | $size = 0; |
| 656 | 656 | |
| 657 | 657 | if ($timestamp) { |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); |
| 663 | 663 | $query->executeStatement(); |
| 664 | 664 | |
| 665 | - $file = $filename . '.d' . $timestamp; |
|
| 665 | + $file = $filename.'.d'.$timestamp; |
|
| 666 | 666 | } else { |
| 667 | 667 | $file = $filename; |
| 668 | 668 | } |
@@ -670,20 +670,20 @@ discard block |
||
| 670 | 670 | $size += self::deleteVersions($view, $file, $filename, $timestamp, $user); |
| 671 | 671 | |
| 672 | 672 | try { |
| 673 | - $node = $userRoot->get('/files_trashbin/files/' . $file); |
|
| 673 | + $node = $userRoot->get('/files_trashbin/files/'.$file); |
|
| 674 | 674 | } catch (NotFoundException $e) { |
| 675 | 675 | return $size; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | if ($node instanceof Folder) { |
| 679 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file)); |
|
| 679 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file)); |
|
| 680 | 680 | } elseif ($node instanceof File) { |
| 681 | - $size += $view->filesize('/files_trashbin/files/' . $file); |
|
| 681 | + $size += $view->filesize('/files_trashbin/files/'.$file); |
|
| 682 | 682 | } |
| 683 | 683 | |
| 684 | - self::emitTrashbinPreDelete('/files_trashbin/files/' . $file); |
|
| 684 | + self::emitTrashbinPreDelete('/files_trashbin/files/'.$file); |
|
| 685 | 685 | $node->delete(); |
| 686 | - self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); |
|
| 686 | + self::emitTrashbinPostDelete('/files_trashbin/files/'.$file); |
|
| 687 | 687 | |
| 688 | 688 | return $size; |
| 689 | 689 | } |
@@ -699,17 +699,17 @@ discard block |
||
| 699 | 699 | private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) { |
| 700 | 700 | $size = 0; |
| 701 | 701 | if (\OCP\App::isEnabled('files_versions')) { |
| 702 | - if ($view->is_dir('files_trashbin/versions/' . $file)) { |
|
| 703 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file)); |
|
| 704 | - $view->unlink('files_trashbin/versions/' . $file); |
|
| 702 | + if ($view->is_dir('files_trashbin/versions/'.$file)) { |
|
| 703 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file)); |
|
| 704 | + $view->unlink('files_trashbin/versions/'.$file); |
|
| 705 | 705 | } elseif ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) { |
| 706 | 706 | foreach ($versions as $v) { |
| 707 | 707 | if ($timestamp) { |
| 708 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
| 709 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
| 708 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
| 709 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
| 710 | 710 | } else { |
| 711 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
| 712 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
| 711 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
| 712 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | 715 | } |
@@ -726,13 +726,13 @@ discard block |
||
| 726 | 726 | */ |
| 727 | 727 | public static function file_exists($filename, $timestamp = null) { |
| 728 | 728 | $user = OC_User::getUser(); |
| 729 | - $view = new View('/' . $user); |
|
| 729 | + $view = new View('/'.$user); |
|
| 730 | 730 | |
| 731 | 731 | if ($timestamp) { |
| 732 | - $filename = $filename . '.d' . $timestamp; |
|
| 732 | + $filename = $filename.'.d'.$timestamp; |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | - $target = Filesystem::normalizePath('files_trashbin/files/' . $filename); |
|
| 735 | + $target = Filesystem::normalizePath('files_trashbin/files/'.$filename); |
|
| 736 | 736 | return $view->file_exists($target); |
| 737 | 737 | } |
| 738 | 738 | |
@@ -758,11 +758,11 @@ discard block |
||
| 758 | 758 | */ |
| 759 | 759 | private static function calculateFreeSpace($trashbinSize, $user) { |
| 760 | 760 | $config = \OC::$server->getConfig(); |
| 761 | - $userTrashbinSize = (int)$config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1'); |
|
| 761 | + $userTrashbinSize = (int) $config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1'); |
|
| 762 | 762 | if ($userTrashbinSize > -1) { |
| 763 | 763 | return $userTrashbinSize - $trashbinSize; |
| 764 | 764 | } |
| 765 | - $systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
| 765 | + $systemTrashbinSize = (int) $config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
| 766 | 766 | if ($systemTrashbinSize > -1) { |
| 767 | 767 | return $systemTrashbinSize - $trashbinSize; |
| 768 | 768 | } |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | foreach ($files as $file) { |
| 872 | 872 | if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) { |
| 873 | 873 | $tmp = self::delete($file['name'], $user, $file['mtime']); |
| 874 | - \OC::$server->getLogger()->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']); |
|
| 874 | + \OC::$server->getLogger()->info('remove "'.$file['name'].'" ('.$tmp.'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']); |
|
| 875 | 875 | $availableSpace += $tmp; |
| 876 | 876 | $size += $tmp; |
| 877 | 877 | } else { |
@@ -902,10 +902,10 @@ discard block |
||
| 902 | 902 | $size += self::delete($filename, $user, $timestamp); |
| 903 | 903 | $count++; |
| 904 | 904 | } catch (\OCP\Files\NotPermittedException $e) { |
| 905 | - \OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "' . $filename . '" from trashbin failed.']); |
|
| 905 | + \OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "'.$filename.'" from trashbin failed.']); |
|
| 906 | 906 | } |
| 907 | 907 | \OC::$server->getLogger()->info( |
| 908 | - 'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.', |
|
| 908 | + 'Remove "'.$filename.'" from trashbin because it exceeds max retention obligation term.', |
|
| 909 | 909 | ['app' => 'files_trashbin'] |
| 910 | 910 | ); |
| 911 | 911 | } else { |
@@ -931,16 +931,16 @@ discard block |
||
| 931 | 931 | $view->mkdir($destination); |
| 932 | 932 | $view->touch($destination, $view->filemtime($source)); |
| 933 | 933 | foreach ($view->getDirectoryContent($source) as $i) { |
| 934 | - $pathDir = $source . '/' . $i['name']; |
|
| 934 | + $pathDir = $source.'/'.$i['name']; |
|
| 935 | 935 | if ($view->is_dir($pathDir)) { |
| 936 | - $size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view); |
|
| 936 | + $size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view); |
|
| 937 | 937 | } else { |
| 938 | 938 | $size += $view->filesize($pathDir); |
| 939 | - $result = $view->copy($pathDir, $destination . '/' . $i['name']); |
|
| 939 | + $result = $view->copy($pathDir, $destination.'/'.$i['name']); |
|
| 940 | 940 | if (!$result) { |
| 941 | 941 | throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException(); |
| 942 | 942 | } |
| 943 | - $view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir)); |
|
| 943 | + $view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir)); |
|
| 944 | 944 | } |
| 945 | 945 | } |
| 946 | 946 | } else { |
@@ -962,11 +962,11 @@ discard block |
||
| 962 | 962 | * @return array |
| 963 | 963 | */ |
| 964 | 964 | private static function getVersionsFromTrash($filename, $timestamp, $user) { |
| 965 | - $view = new View('/' . $user . '/files_trashbin/versions'); |
|
| 965 | + $view = new View('/'.$user.'/files_trashbin/versions'); |
|
| 966 | 966 | $versions = []; |
| 967 | 967 | |
| 968 | 968 | /** @var \OC\Files\Storage\Storage $storage */ |
| 969 | - [$storage,] = $view->resolvePath('/'); |
|
| 969 | + [$storage, ] = $view->resolvePath('/'); |
|
| 970 | 970 | |
| 971 | 971 | //force rescan of versions, local storage may not have updated the cache |
| 972 | 972 | if (!self::$scannedVersions) { |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | if ($timestamp) { |
| 979 | 979 | // fetch for old versions |
| 980 | 980 | $escapedTimestamp = \OC::$server->getDatabaseConnection()->escapeLikeParameter($timestamp); |
| 981 | - $pattern .= '.v%.d' . $escapedTimestamp; |
|
| 981 | + $pattern .= '.v%.d'.$escapedTimestamp; |
|
| 982 | 982 | $offset = -strlen($escapedTimestamp) - 2; |
| 983 | 983 | } else { |
| 984 | 984 | $pattern .= '.v%'; |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | \OC::$server->getLogger(), |
| 993 | 993 | $cache |
| 994 | 994 | ); |
| 995 | - $normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'. $filename)), '/'); |
|
| 995 | + $normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'.$filename)), '/'); |
|
| 996 | 996 | $parentId = $cache->getId($normalizedParentPath); |
| 997 | 997 | if ($parentId === -1) { |
| 998 | 998 | return []; |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | $result->closeCursor(); |
| 1009 | 1009 | |
| 1010 | 1010 | /** @var CacheEntry[] $matches */ |
| 1011 | - $matches = array_map(function (array $data) { |
|
| 1011 | + $matches = array_map(function(array $data) { |
|
| 1012 | 1012 | return Cache::cacheEntryFromData($data, \OC::$server->getMimeTypeLoader()); |
| 1013 | 1013 | }, $entries); |
| 1014 | 1014 | |
@@ -1038,18 +1038,18 @@ discard block |
||
| 1038 | 1038 | $name = pathinfo($filename, PATHINFO_FILENAME); |
| 1039 | 1039 | $l = \OC::$server->getL10N('files_trashbin'); |
| 1040 | 1040 | |
| 1041 | - $location = '/' . trim($location, '/'); |
|
| 1041 | + $location = '/'.trim($location, '/'); |
|
| 1042 | 1042 | |
| 1043 | 1043 | // if extension is not empty we set a dot in front of it |
| 1044 | 1044 | if ($ext !== '') { |
| 1045 | - $ext = '.' . $ext; |
|
| 1045 | + $ext = '.'.$ext; |
|
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | - if ($view->file_exists('files' . $location . '/' . $filename)) { |
|
| 1048 | + if ($view->file_exists('files'.$location.'/'.$filename)) { |
|
| 1049 | 1049 | $i = 2; |
| 1050 | - $uniqueName = $name . " (" . $l->t("restored") . ")" . $ext; |
|
| 1051 | - while ($view->file_exists('files' . $location . '/' . $uniqueName)) { |
|
| 1052 | - $uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext; |
|
| 1050 | + $uniqueName = $name." (".$l->t("restored").")".$ext; |
|
| 1051 | + while ($view->file_exists('files'.$location.'/'.$uniqueName)) { |
|
| 1052 | + $uniqueName = $name." (".$l->t("restored")." ".$i.")".$ext; |
|
| 1053 | 1053 | $i++; |
| 1054 | 1054 | } |
| 1055 | 1055 | |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | * @return integer size of the folder |
| 1067 | 1067 | */ |
| 1068 | 1068 | private static function calculateSize($view) { |
| 1069 | - $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath(''); |
|
| 1069 | + $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath(''); |
|
| 1070 | 1070 | if (!file_exists($root)) { |
| 1071 | 1071 | return 0; |
| 1072 | 1072 | } |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | * @return integer trash bin size |
| 1098 | 1098 | */ |
| 1099 | 1099 | private static function getTrashbinSize($user) { |
| 1100 | - $view = new View('/' . $user); |
|
| 1100 | + $view = new View('/'.$user); |
|
| 1101 | 1101 | $fileInfo = $view->getFileInfo('/files_trashbin'); |
| 1102 | 1102 | return isset($fileInfo['size']) ? $fileInfo['size'] : 0; |
| 1103 | 1103 | } |
@@ -1109,7 +1109,7 @@ discard block |
||
| 1109 | 1109 | * @return bool |
| 1110 | 1110 | */ |
| 1111 | 1111 | public static function isEmpty($user) { |
| 1112 | - $view = new View('/' . $user . '/files_trashbin'); |
|
| 1112 | + $view = new View('/'.$user.'/files_trashbin'); |
|
| 1113 | 1113 | if ($view->is_dir('/files') && $dh = $view->opendir('/files')) { |
| 1114 | 1114 | while ($file = readdir($dh)) { |
| 1115 | 1115 | if (!Filesystem::isIgnoredDir($file)) { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | public static function pre_renameOrCopy_hook($params) { |
| 130 | 130 | // if we rename a movable mount point, then the versions don't have |
| 131 | 131 | // to be renamed |
| 132 | - $absOldPath = Filesystem::normalizePath('/' . \OC_User::getUser() . '/files' . $params['oldpath']); |
|
| 132 | + $absOldPath = Filesystem::normalizePath('/'.\OC_User::getUser().'/files'.$params['oldpath']); |
|
| 133 | 133 | $manager = Filesystem::getMountManager(); |
| 134 | 134 | $mount = $manager->find($absOldPath); |
| 135 | 135 | $internalPath = $mount->getInternalPath($absOldPath); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $view = new View(\OC_User::getUser() . '/files'); |
|
| 140 | + $view = new View(\OC_User::getUser().'/files'); |
|
| 141 | 141 | if ($view->file_exists($params['newpath'])) { |
| 142 | 142 | Storage::store($params['newpath']); |
| 143 | 143 | } else { |
@@ -94,11 +94,11 @@ |
||
| 94 | 94 | * @param string $newPath new path relative to data/user/files |
| 95 | 95 | */ |
| 96 | 96 | private static function renameChildren($oldPath, $newPath) { |
| 97 | - $absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OC_User::getUser() . '/files/' . $newPath); |
|
| 98 | - $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OC_User::getUser() . '/files/' . $oldPath); |
|
| 97 | + $absNewPath = \OC\Files\Filesystem::normalizePath('/'.\OC_User::getUser().'/files/'.$newPath); |
|
| 98 | + $absOldPath = \OC\Files\Filesystem::normalizePath('/'.\OC_User::getUser().'/files/'.$oldPath); |
|
| 99 | 99 | |
| 100 | 100 | $mountManager = \OC\Files\Filesystem::getMountManager(); |
| 101 | - $mountedShares = $mountManager->findIn('/' . \OC_User::getUser() . '/files/' . $oldPath); |
|
| 101 | + $mountedShares = $mountManager->findIn('/'.\OC_User::getUser().'/files/'.$oldPath); |
|
| 102 | 102 | foreach ($mountedShares as $mount) { |
| 103 | 103 | if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) { |
| 104 | 104 | $mountPoint = $mount->getMountPoint(); |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | OC_Util::checkLoggedIn(); |
| 33 | 33 | \OC::$server->getSession()->close(); |
| 34 | 34 | |
| 35 | -$files = isset($_GET['files']) ? (string)$_GET['files'] : ''; |
|
| 36 | -$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; |
|
| 35 | +$files = isset($_GET['files']) ? (string) $_GET['files'] : ''; |
|
| 36 | +$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : ''; |
|
| 37 | 37 | |
| 38 | 38 | $files_list = json_decode($files); |
| 39 | 39 | // in case we get only a single file |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -$server_params = [ 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ]; |
|
| 69 | +$server_params = ['head' => \OC::$server->getRequest()->getMethod() === 'HEAD']; |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Http range requests support |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | $path = '/'; |
| 132 | 132 | } |
| 133 | 133 | if ($path[0] !== '/') { |
| 134 | - $path = '/' . $path; |
|
| 134 | + $path = '/'.$path; |
|
| 135 | 135 | } |
| 136 | - return $this->fakeRoot . $path; |
|
| 136 | + return $this->fakeRoot.$path; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public function chroot($fakeRoot) { |
| 146 | 146 | if (!$fakeRoot == '') { |
| 147 | 147 | if ($fakeRoot[0] !== '/') { |
| 148 | - $fakeRoot = '/' . $fakeRoot; |
|
| 148 | + $fakeRoot = '/'.$fakeRoot; |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | $this->fakeRoot = $fakeRoot; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // missing slashes can cause wrong matches! |
| 180 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
| 180 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
| 181 | 181 | |
| 182 | 182 | if (strpos($path, $root) !== 0) { |
| 183 | 183 | return null; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | if ($mount instanceof MoveableMount) { |
| 284 | 284 | // cut of /user/files to get the relative path to data/user/files |
| 285 | 285 | $pathParts = explode('/', $path, 4); |
| 286 | - $relPath = '/' . $pathParts[3]; |
|
| 286 | + $relPath = '/'.$pathParts[3]; |
|
| 287 | 287 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
| 288 | 288 | \OC_Hook::emit( |
| 289 | 289 | Filesystem::CLASSNAME, "umount", |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | } |
| 716 | 716 | $postFix = (substr($path, -1) === '/') ? '/' : ''; |
| 717 | 717 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
| 718 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
| 718 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
| 719 | 719 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
| 720 | 720 | return $this->removeMount($mount, $absolutePath); |
| 721 | 721 | } |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | $hooks[] = 'write'; |
| 993 | 993 | break; |
| 994 | 994 | default: |
| 995 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR); |
|
| 995 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, ILogger::ERROR); |
|
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | [Filesystem::signal_param_path => $this->getHookPath($path)] |
| 1097 | 1097 | ); |
| 1098 | 1098 | } |
| 1099 | - [$storage, $internalPath] = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1099 | + [$storage, $internalPath] = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1100 | 1100 | if ($storage) { |
| 1101 | 1101 | return $storage->hash($type, $internalPath, $raw); |
| 1102 | 1102 | } |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | |
| 1151 | 1151 | $run = $this->runHooks($hooks, $path); |
| 1152 | 1152 | /** @var \OC\Files\Storage\Storage $storage */ |
| 1153 | - [$storage, $internalPath] = Filesystem::resolvePath($absolutePath . $postFix); |
|
| 1153 | + [$storage, $internalPath] = Filesystem::resolvePath($absolutePath.$postFix); |
|
| 1154 | 1154 | if ($run and $storage) { |
| 1155 | 1155 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
| 1156 | 1156 | try { |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | if ($result && in_array('delete', $hooks) and $result) { |
| 1180 | 1180 | $this->removeUpdate($storage, $internalPath); |
| 1181 | 1181 | } |
| 1182 | - if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
| 1182 | + if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { |
|
| 1183 | 1183 | $this->writeUpdate($storage, $internalPath); |
| 1184 | 1184 | } |
| 1185 | 1185 | if ($result && in_array('touch', $hooks)) { |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | $unlockLater = true; |
| 1196 | 1196 | // make sure our unlocking callback will still be called if connection is aborted |
| 1197 | 1197 | ignore_user_abort(true); |
| 1198 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
| 1198 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
| 1199 | 1199 | if (in_array('write', $hooks)) { |
| 1200 | 1200 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
| 1201 | 1201 | } elseif (in_array('read', $hooks)) { |
@@ -1256,7 +1256,7 @@ discard block |
||
| 1256 | 1256 | return true; |
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
| 1259 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | /** |
@@ -1275,7 +1275,7 @@ discard block |
||
| 1275 | 1275 | if ($hook != 'read') { |
| 1276 | 1276 | \OC_Hook::emit( |
| 1277 | 1277 | Filesystem::CLASSNAME, |
| 1278 | - $prefix . $hook, |
|
| 1278 | + $prefix.$hook, |
|
| 1279 | 1279 | [ |
| 1280 | 1280 | Filesystem::signal_param_run => &$run, |
| 1281 | 1281 | Filesystem::signal_param_path => $path |
@@ -1284,7 +1284,7 @@ discard block |
||
| 1284 | 1284 | } elseif (!$post) { |
| 1285 | 1285 | \OC_Hook::emit( |
| 1286 | 1286 | Filesystem::CLASSNAME, |
| 1287 | - $prefix . $hook, |
|
| 1287 | + $prefix.$hook, |
|
| 1288 | 1288 | [ |
| 1289 | 1289 | Filesystem::signal_param_path => $path |
| 1290 | 1290 | ] |
@@ -1377,11 +1377,11 @@ discard block |
||
| 1377 | 1377 | return $this->getPartFileInfo($path); |
| 1378 | 1378 | } |
| 1379 | 1379 | $relativePath = $path; |
| 1380 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1380 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1381 | 1381 | |
| 1382 | 1382 | $mount = Filesystem::getMountManager()->find($path); |
| 1383 | 1383 | if (!$mount) { |
| 1384 | - \OC::$server->getLogger()->warning('Mountpoint not found for path: ' . $path); |
|
| 1384 | + \OC::$server->getLogger()->warning('Mountpoint not found for path: '.$path); |
|
| 1385 | 1385 | return false; |
| 1386 | 1386 | } |
| 1387 | 1387 | $storage = $mount->getStorage(); |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | //add the sizes of other mount points to the folder |
| 1410 | 1410 | $extOnly = ($includeMountPoints === 'ext'); |
| 1411 | 1411 | $mounts = Filesystem::getMountManager()->findIn($path); |
| 1412 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
| 1412 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
| 1413 | 1413 | $subStorage = $mount->getStorage(); |
| 1414 | 1414 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
| 1415 | 1415 | })); |
@@ -1418,7 +1418,7 @@ discard block |
||
| 1418 | 1418 | |
| 1419 | 1419 | return $info; |
| 1420 | 1420 | } else { |
| 1421 | - \OC::$server->getLogger()->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint()); |
|
| 1421 | + \OC::$server->getLogger()->warning('Storage not valid for mountpoint: '.$mount->getMountPoint()); |
|
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | 1424 | return false; |
@@ -1459,18 +1459,18 @@ discard block |
||
| 1459 | 1459 | |
| 1460 | 1460 | $sharingDisabled = \OCP\Util::isSharingDisabledForUser(); |
| 1461 | 1461 | |
| 1462 | - $fileNames = array_map(function (ICacheEntry $content) { |
|
| 1462 | + $fileNames = array_map(function(ICacheEntry $content) { |
|
| 1463 | 1463 | return $content->getName(); |
| 1464 | 1464 | }, $contents); |
| 1465 | 1465 | /** |
| 1466 | 1466 | * @var \OC\Files\FileInfo[] $fileInfos |
| 1467 | 1467 | */ |
| 1468 | - $fileInfos = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1468 | + $fileInfos = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
| 1469 | 1469 | if ($sharingDisabled) { |
| 1470 | 1470 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
| 1471 | 1471 | } |
| 1472 | 1472 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
| 1473 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1473 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
| 1474 | 1474 | }, $contents); |
| 1475 | 1475 | $files = array_combine($fileNames, $fileInfos); |
| 1476 | 1476 | |
@@ -1495,7 +1495,7 @@ discard block |
||
| 1495 | 1495 | } catch (\Exception $e) { |
| 1496 | 1496 | // sometimes when the storage is not available it can be any exception |
| 1497 | 1497 | \OC::$server->getLogger()->logException($e, [ |
| 1498 | - 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', |
|
| 1498 | + 'message' => 'Exception while scanning storage "'.$subStorage->getId().'"', |
|
| 1499 | 1499 | 'level' => ILogger::ERROR, |
| 1500 | 1500 | 'app' => 'lib', |
| 1501 | 1501 | ]); |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); |
| 1527 | 1527 | } |
| 1528 | 1528 | |
| 1529 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1529 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
| 1530 | 1530 | |
| 1531 | 1531 | // if sharing was disabled for the user we remove the share permissions |
| 1532 | 1532 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1534,14 +1534,14 @@ discard block |
||
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
| 1537 | - $files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1537 | + $files[$rootEntry->getName()] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
| 1538 | 1538 | } |
| 1539 | 1539 | } |
| 1540 | 1540 | } |
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | 1543 | if ($mimetype_filter) { |
| 1544 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
| 1544 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
| 1545 | 1545 | if (strpos($mimetype_filter, '/')) { |
| 1546 | 1546 | return $file->getMimetype() === $mimetype_filter; |
| 1547 | 1547 | } else { |
@@ -1570,7 +1570,7 @@ discard block |
||
| 1570 | 1570 | if ($data instanceof FileInfo) { |
| 1571 | 1571 | $data = $data->getData(); |
| 1572 | 1572 | } |
| 1573 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
| 1573 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
| 1574 | 1574 | /** |
| 1575 | 1575 | * @var \OC\Files\Storage\Storage $storage |
| 1576 | 1576 | * @var string $internalPath |
@@ -1597,7 +1597,7 @@ discard block |
||
| 1597 | 1597 | * @return FileInfo[] |
| 1598 | 1598 | */ |
| 1599 | 1599 | public function search($query) { |
| 1600 | - return $this->searchCommon('search', ['%' . $query . '%']); |
|
| 1600 | + return $this->searchCommon('search', ['%'.$query.'%']); |
|
| 1601 | 1601 | } |
| 1602 | 1602 | |
| 1603 | 1603 | /** |
@@ -1649,10 +1649,10 @@ discard block |
||
| 1649 | 1649 | |
| 1650 | 1650 | $results = call_user_func_array([$cache, $method], $args); |
| 1651 | 1651 | foreach ($results as $result) { |
| 1652 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
| 1652 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
| 1653 | 1653 | $internalPath = $result['path']; |
| 1654 | - $path = $mountPoint . $result['path']; |
|
| 1655 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
| 1654 | + $path = $mountPoint.$result['path']; |
|
| 1655 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
| 1656 | 1656 | $owner = $userManager->get($storage->getOwner($internalPath)); |
| 1657 | 1657 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1658 | 1658 | } |
@@ -1670,8 +1670,8 @@ discard block |
||
| 1670 | 1670 | if ($results) { |
| 1671 | 1671 | foreach ($results as $result) { |
| 1672 | 1672 | $internalPath = $result['path']; |
| 1673 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
| 1674 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
| 1673 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
| 1674 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
| 1675 | 1675 | $owner = $userManager->get($storage->getOwner($internalPath)); |
| 1676 | 1676 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
| 1677 | 1677 | } |
@@ -1692,11 +1692,11 @@ discard block |
||
| 1692 | 1692 | public function getOwner($path) { |
| 1693 | 1693 | $info = $this->getFileInfo($path); |
| 1694 | 1694 | if (!$info) { |
| 1695 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
| 1695 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | 1698 | if ($info->getOwner() === null) { |
| 1699 | - throw new NotFoundException($path . ' has no owner'); |
|
| 1699 | + throw new NotFoundException($path.' has no owner'); |
|
| 1700 | 1700 | } |
| 1701 | 1701 | |
| 1702 | 1702 | return $info->getOwner()->getUID(); |
@@ -1732,7 +1732,7 @@ discard block |
||
| 1732 | 1732 | * @throws NotFoundException |
| 1733 | 1733 | */ |
| 1734 | 1734 | public function getPath($id, int $storageId = null) { |
| 1735 | - $id = (int)$id; |
|
| 1735 | + $id = (int) $id; |
|
| 1736 | 1736 | $manager = Filesystem::getMountManager(); |
| 1737 | 1737 | $mounts = $manager->findIn($this->fakeRoot); |
| 1738 | 1738 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1742,12 +1742,12 @@ discard block |
||
| 1742 | 1742 | |
| 1743 | 1743 | // put non shared mounts in front of the shared mount |
| 1744 | 1744 | // this prevent unneeded recursion into shares |
| 1745 | - usort($mounts, function (IMountPoint $a, IMountPoint $b) { |
|
| 1745 | + usort($mounts, function(IMountPoint $a, IMountPoint $b) { |
|
| 1746 | 1746 | return $a instanceof SharedMount && (!$b instanceof SharedMount) ? 1 : -1; |
| 1747 | 1747 | }); |
| 1748 | 1748 | |
| 1749 | 1749 | if (!is_null($storageId)) { |
| 1750 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($storageId) { |
|
| 1750 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($storageId) { |
|
| 1751 | 1751 | return $mount->getNumericStorageId() === $storageId; |
| 1752 | 1752 | }); |
| 1753 | 1753 | } |
@@ -1760,7 +1760,7 @@ discard block |
||
| 1760 | 1760 | $cache = $mount->getStorage()->getCache(); |
| 1761 | 1761 | $internalPath = $cache->getPathById($id); |
| 1762 | 1762 | if (is_string($internalPath)) { |
| 1763 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
| 1763 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
| 1764 | 1764 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
| 1765 | 1765 | return $path; |
| 1766 | 1766 | } |
@@ -1796,10 +1796,10 @@ discard block |
||
| 1796 | 1796 | private function targetIsNotShared(IStorage $targetStorage, string $targetInternalPath) { |
| 1797 | 1797 | |
| 1798 | 1798 | // note: cannot use the view because the target is already locked |
| 1799 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
| 1799 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
| 1800 | 1800 | if ($fileId === -1) { |
| 1801 | 1801 | // target might not exist, need to check parent instead |
| 1802 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1802 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | 1805 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1899,7 +1899,7 @@ discard block |
||
| 1899 | 1899 | $resultPath = ''; |
| 1900 | 1900 | foreach ($parts as $part) { |
| 1901 | 1901 | if ($part) { |
| 1902 | - $resultPath .= '/' . $part; |
|
| 1902 | + $resultPath .= '/'.$part; |
|
| 1903 | 1903 | $result[] = $resultPath; |
| 1904 | 1904 | } |
| 1905 | 1905 | } |
@@ -2168,16 +2168,16 @@ discard block |
||
| 2168 | 2168 | public function getUidAndFilename($filename) { |
| 2169 | 2169 | $info = $this->getFileInfo($filename); |
| 2170 | 2170 | if (!$info instanceof \OCP\Files\FileInfo) { |
| 2171 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
| 2171 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
| 2172 | 2172 | } |
| 2173 | 2173 | $uid = $info->getOwner()->getUID(); |
| 2174 | 2174 | if ($uid != \OC_User::getUser()) { |
| 2175 | 2175 | Filesystem::initMountPoints($uid); |
| 2176 | - $ownerView = new View('/' . $uid . '/files'); |
|
| 2176 | + $ownerView = new View('/'.$uid.'/files'); |
|
| 2177 | 2177 | try { |
| 2178 | 2178 | $filename = $ownerView->getPath($info['fileid']); |
| 2179 | 2179 | } catch (NotFoundException $e) { |
| 2180 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
| 2180 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
| 2181 | 2181 | } |
| 2182 | 2182 | } |
| 2183 | 2183 | return [$uid, $filename]; |
@@ -2194,7 +2194,7 @@ discard block |
||
| 2194 | 2194 | $directoryParts = array_filter($directoryParts); |
| 2195 | 2195 | foreach ($directoryParts as $key => $part) { |
| 2196 | 2196 | $currentPathElements = array_slice($directoryParts, 0, $key); |
| 2197 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
| 2197 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
| 2198 | 2198 | if ($this->is_file($currentPath)) { |
| 2199 | 2199 | return false; |
| 2200 | 2200 | } |