@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | Filesystem::initMountPoints($uid); |
112 | 112 | if ($uid !== User::getUser()) { |
113 | 113 | $info = Filesystem::getFileInfo($filename); |
114 | - $ownerView = new View('/' . $uid . '/files'); |
|
114 | + $ownerView = new View('/'.$uid.'/files'); |
|
115 | 115 | try { |
116 | 116 | $filename = $ownerView->getPath($info['fileid']); |
117 | 117 | } catch (NotFoundException $e) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | private static function setUpTrash($user) { |
176 | - $view = new View('/' . $user); |
|
176 | + $view = new View('/'.$user); |
|
177 | 177 | if (!$view->is_dir('files_trashbin')) { |
178 | 178 | $view->mkdir('files_trashbin'); |
179 | 179 | } |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | |
209 | 209 | $view = new View('/'); |
210 | 210 | |
211 | - $target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp; |
|
212 | - $source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp; |
|
211 | + $target = $user.'/files_trashbin/files/'.$targetFilename.'.d'.$timestamp; |
|
212 | + $source = $owner.'/files_trashbin/files/'.$sourceFilename.'.d'.$timestamp; |
|
213 | 213 | $free = $view->free_space($target); |
214 | 214 | $isUnknownOrUnlimitedFreeSpace = $free < 0; |
215 | 215 | $isEnoughFreeSpaceLeft = $view->filesize($source) < $free; |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | $ownerPath = $file_path; |
254 | 254 | } |
255 | 255 | |
256 | - $ownerView = new View('/' . $owner); |
|
256 | + $ownerView = new View('/'.$owner); |
|
257 | 257 | // file has been deleted in between |
258 | - if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) { |
|
258 | + if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/'.$ownerPath)) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $lockingProvider = \OC::$server->getLockingProvider(); |
277 | 277 | |
278 | 278 | // disable proxy to prevent recursive calls |
279 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
279 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
280 | 280 | $gotLock = false; |
281 | 281 | |
282 | 282 | while (!$gotLock) { |
@@ -292,12 +292,12 @@ discard block |
||
292 | 292 | |
293 | 293 | $timestamp = $timestamp + 1; |
294 | 294 | |
295 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
295 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
299 | 299 | /** @var \OC\Files\Storage\Storage $sourceStorage */ |
300 | - [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/' . $ownerPath); |
|
300 | + [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/'.$ownerPath); |
|
301 | 301 | |
302 | 302 | |
303 | 303 | if ($trashStorage->file_exists($trashInternalPath)) { |
@@ -305,8 +305,8 @@ discard block |
||
305 | 305 | } |
306 | 306 | |
307 | 307 | $config = \OC::$server->getConfig(); |
308 | - $systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
309 | - $userTrashbinSize = (int)$config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1'); |
|
308 | + $systemTrashbinSize = (int) $config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
309 | + $userTrashbinSize = (int) $config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1'); |
|
310 | 310 | $configuredTrashbinSize = ($userTrashbinSize < 0) ? $systemTrashbinSize : $userTrashbinSize; |
311 | 311 | if ($configuredTrashbinSize >= 0 && $sourceStorage->filesize($sourceInternalPath) >= $configuredTrashbinSize) { |
312 | 312 | return false; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | if ($trashStorage->file_exists($trashInternalPath)) { |
327 | 327 | $trashStorage->unlink($trashInternalPath); |
328 | 328 | } |
329 | - \OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']); |
|
329 | + \OC::$server->getLogger()->error('Couldn\'t move '.$file_path.' to the trash bin', ['app' => 'files_trashbin']); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | \OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']); |
358 | 358 | } |
359 | 359 | \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path), |
360 | - 'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)]); |
|
360 | + 'trashPath' => Filesystem::normalizePath($filename.'.d'.$timestamp)]); |
|
361 | 361 | |
362 | 362 | self::retainVersions($filename, $owner, $ownerPath, $timestamp); |
363 | 363 | |
@@ -392,17 +392,17 @@ discard block |
||
392 | 392 | $user = User::getUser(); |
393 | 393 | $rootView = new View('/'); |
394 | 394 | |
395 | - if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) { |
|
395 | + if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) { |
|
396 | 396 | if ($owner !== $user) { |
397 | - self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView); |
|
397 | + self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.basename($ownerPath).'.d'.$timestamp, $rootView); |
|
398 | 398 | } |
399 | - self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp); |
|
399 | + self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.$filename.'.d'.$timestamp); |
|
400 | 400 | } elseif ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) { |
401 | 401 | foreach ($versions as $v) { |
402 | 402 | if ($owner !== $user) { |
403 | - self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp); |
|
403 | + self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.$v['name'].'.v'.$v['version'].'.d'.$timestamp); |
|
404 | 404 | } |
405 | - self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp); |
|
405 | + self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.$filename.'.v'.$v['version'].'.d'.$timestamp); |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | } |
@@ -464,18 +464,18 @@ discard block |
||
464 | 464 | */ |
465 | 465 | public static function restore($file, $filename, $timestamp) { |
466 | 466 | $user = User::getUser(); |
467 | - $view = new View('/' . $user); |
|
467 | + $view = new View('/'.$user); |
|
468 | 468 | |
469 | 469 | $location = ''; |
470 | 470 | if ($timestamp) { |
471 | 471 | $location = self::getLocation($user, $filename, $timestamp); |
472 | 472 | if ($location === false) { |
473 | - \OC::$server->getLogger()->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']); |
|
473 | + \OC::$server->getLogger()->error('trash bin database inconsistent! ($user: '.$user.' $filename: '.$filename.', $timestamp: '.$timestamp.')', ['app' => 'files_trashbin']); |
|
474 | 474 | } else { |
475 | 475 | // if location no longer exists, restore file in the root directory |
476 | 476 | if ($location !== '/' && |
477 | - (!$view->is_dir('files/' . $location) || |
|
478 | - !$view->isCreatable('files/' . $location)) |
|
477 | + (!$view->is_dir('files/'.$location) || |
|
478 | + !$view->isCreatable('files/'.$location)) |
|
479 | 479 | ) { |
480 | 480 | $location = ''; |
481 | 481 | } |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | // we need a extension in case a file/dir with the same name already exists |
486 | 486 | $uniqueFilename = self::getUniqueFilename($location, $filename, $view); |
487 | 487 | |
488 | - $source = Filesystem::normalizePath('files_trashbin/files/' . $file); |
|
489 | - $target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename); |
|
488 | + $source = Filesystem::normalizePath('files_trashbin/files/'.$file); |
|
489 | + $target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename); |
|
490 | 490 | if (!$view->file_exists($source)) { |
491 | 491 | return false; |
492 | 492 | } |
@@ -501,10 +501,10 @@ discard block |
||
501 | 501 | // handle the restore result |
502 | 502 | if ($restoreResult) { |
503 | 503 | $fakeRoot = $view->getRoot(); |
504 | - $view->chroot('/' . $user . '/files'); |
|
505 | - $view->touch('/' . $location . '/' . $uniqueFilename, $mtime); |
|
504 | + $view->chroot('/'.$user.'/files'); |
|
505 | + $view->touch('/'.$location.'/'.$uniqueFilename, $mtime); |
|
506 | 506 | $view->chroot($fakeRoot); |
507 | - \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename), |
|
507 | + \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename), |
|
508 | 508 | 'trashPath' => Filesystem::normalizePath($file)]); |
509 | 509 | |
510 | 510 | self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | $user = User::getUser(); |
541 | 541 | $rootView = new View('/'); |
542 | 542 | |
543 | - $target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename); |
|
543 | + $target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename); |
|
544 | 544 | |
545 | 545 | [$owner, $ownerPath] = self::getUidAndFilename($target); |
546 | 546 | |
@@ -555,14 +555,14 @@ discard block |
||
555 | 555 | $versionedFile = $file; |
556 | 556 | } |
557 | 557 | |
558 | - if ($view->is_dir('/files_trashbin/versions/' . $file)) { |
|
559 | - $rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath)); |
|
558 | + if ($view->is_dir('/files_trashbin/versions/'.$file)) { |
|
559 | + $rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath)); |
|
560 | 560 | } elseif ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) { |
561 | 561 | foreach ($versions as $v) { |
562 | 562 | if ($timestamp) { |
563 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
563 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
564 | 564 | } else { |
565 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
565 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | public static function deleteAll() { |
576 | 576 | $user = User::getUser(); |
577 | 577 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
578 | - $view = new View('/' . $user); |
|
578 | + $view = new View('/'.$user); |
|
579 | 579 | $fileInfos = $view->getDirectoryContent('files_trashbin/files'); |
580 | 580 | |
581 | 581 | try { |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | */ |
651 | 651 | public static function delete($filename, $user, $timestamp = null) { |
652 | 652 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
653 | - $view = new View('/' . $user); |
|
653 | + $view = new View('/'.$user); |
|
654 | 654 | $size = 0; |
655 | 655 | |
656 | 656 | if ($timestamp) { |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); |
662 | 662 | $query->execute(); |
663 | 663 | |
664 | - $file = $filename . '.d' . $timestamp; |
|
664 | + $file = $filename.'.d'.$timestamp; |
|
665 | 665 | } else { |
666 | 666 | $file = $filename; |
667 | 667 | } |
@@ -669,20 +669,20 @@ discard block |
||
669 | 669 | $size += self::deleteVersions($view, $file, $filename, $timestamp, $user); |
670 | 670 | |
671 | 671 | try { |
672 | - $node = $userRoot->get('/files_trashbin/files/' . $file); |
|
672 | + $node = $userRoot->get('/files_trashbin/files/'.$file); |
|
673 | 673 | } catch (NotFoundException $e) { |
674 | 674 | return $size; |
675 | 675 | } |
676 | 676 | |
677 | 677 | if ($node instanceof Folder) { |
678 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file)); |
|
678 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file)); |
|
679 | 679 | } elseif ($node instanceof File) { |
680 | - $size += $view->filesize('/files_trashbin/files/' . $file); |
|
680 | + $size += $view->filesize('/files_trashbin/files/'.$file); |
|
681 | 681 | } |
682 | 682 | |
683 | - self::emitTrashbinPreDelete('/files_trashbin/files/' . $file); |
|
683 | + self::emitTrashbinPreDelete('/files_trashbin/files/'.$file); |
|
684 | 684 | $node->delete(); |
685 | - self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); |
|
685 | + self::emitTrashbinPostDelete('/files_trashbin/files/'.$file); |
|
686 | 686 | |
687 | 687 | return $size; |
688 | 688 | } |
@@ -698,17 +698,17 @@ discard block |
||
698 | 698 | private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) { |
699 | 699 | $size = 0; |
700 | 700 | if (\OCP\App::isEnabled('files_versions')) { |
701 | - if ($view->is_dir('files_trashbin/versions/' . $file)) { |
|
702 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file)); |
|
703 | - $view->unlink('files_trashbin/versions/' . $file); |
|
701 | + if ($view->is_dir('files_trashbin/versions/'.$file)) { |
|
702 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file)); |
|
703 | + $view->unlink('files_trashbin/versions/'.$file); |
|
704 | 704 | } elseif ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) { |
705 | 705 | foreach ($versions as $v) { |
706 | 706 | if ($timestamp) { |
707 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
708 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
707 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
708 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
709 | 709 | } else { |
710 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
711 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
710 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
711 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
712 | 712 | } |
713 | 713 | } |
714 | 714 | } |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | */ |
726 | 726 | public static function file_exists($filename, $timestamp = null) { |
727 | 727 | $user = User::getUser(); |
728 | - $view = new View('/' . $user); |
|
728 | + $view = new View('/'.$user); |
|
729 | 729 | |
730 | 730 | if ($timestamp) { |
731 | - $filename = $filename . '.d' . $timestamp; |
|
731 | + $filename = $filename.'.d'.$timestamp; |
|
732 | 732 | } |
733 | 733 | |
734 | - $target = Filesystem::normalizePath('files_trashbin/files/' . $filename); |
|
734 | + $target = Filesystem::normalizePath('files_trashbin/files/'.$filename); |
|
735 | 735 | return $view->file_exists($target); |
736 | 736 | } |
737 | 737 | |
@@ -757,11 +757,11 @@ discard block |
||
757 | 757 | */ |
758 | 758 | private static function calculateFreeSpace($trashbinSize, $user) { |
759 | 759 | $config = \OC::$server->getConfig(); |
760 | - $userTrashbinSize = (int)$config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1'); |
|
760 | + $userTrashbinSize = (int) $config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1'); |
|
761 | 761 | if ($userTrashbinSize > -1) { |
762 | 762 | return $userTrashbinSize - $trashbinSize; |
763 | 763 | } |
764 | - $systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
764 | + $systemTrashbinSize = (int) $config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
765 | 765 | if ($systemTrashbinSize > -1) { |
766 | 766 | return $systemTrashbinSize - $trashbinSize; |
767 | 767 | } |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | foreach ($files as $file) { |
871 | 871 | if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) { |
872 | 872 | $tmp = self::delete($file['name'], $user, $file['mtime']); |
873 | - \OC::$server->getLogger()->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']); |
|
873 | + \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 | 874 | $availableSpace += $tmp; |
875 | 875 | $size += $tmp; |
876 | 876 | } else { |
@@ -901,10 +901,10 @@ discard block |
||
901 | 901 | $size += self::delete($filename, $user, $timestamp); |
902 | 902 | $count++; |
903 | 903 | } catch (\OCP\Files\NotPermittedException $e) { |
904 | - \OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "' . $filename . '" from trashbin failed.']); |
|
904 | + \OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "'.$filename.'" from trashbin failed.']); |
|
905 | 905 | } |
906 | 906 | \OC::$server->getLogger()->info( |
907 | - 'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.', |
|
907 | + 'Remove "'.$filename.'" from trashbin because it exceeds max retention obligation term.', |
|
908 | 908 | ['app' => 'files_trashbin'] |
909 | 909 | ); |
910 | 910 | } else { |
@@ -930,16 +930,16 @@ discard block |
||
930 | 930 | $view->mkdir($destination); |
931 | 931 | $view->touch($destination, $view->filemtime($source)); |
932 | 932 | foreach ($view->getDirectoryContent($source) as $i) { |
933 | - $pathDir = $source . '/' . $i['name']; |
|
933 | + $pathDir = $source.'/'.$i['name']; |
|
934 | 934 | if ($view->is_dir($pathDir)) { |
935 | - $size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view); |
|
935 | + $size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view); |
|
936 | 936 | } else { |
937 | 937 | $size += $view->filesize($pathDir); |
938 | - $result = $view->copy($pathDir, $destination . '/' . $i['name']); |
|
938 | + $result = $view->copy($pathDir, $destination.'/'.$i['name']); |
|
939 | 939 | if (!$result) { |
940 | 940 | throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException(); |
941 | 941 | } |
942 | - $view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir)); |
|
942 | + $view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir)); |
|
943 | 943 | } |
944 | 944 | } |
945 | 945 | } else { |
@@ -961,11 +961,11 @@ discard block |
||
961 | 961 | * @return array |
962 | 962 | */ |
963 | 963 | private static function getVersionsFromTrash($filename, $timestamp, $user) { |
964 | - $view = new View('/' . $user . '/files_trashbin/versions'); |
|
964 | + $view = new View('/'.$user.'/files_trashbin/versions'); |
|
965 | 965 | $versions = []; |
966 | 966 | |
967 | 967 | /** @var \OC\Files\Storage\Storage $storage */ |
968 | - [$storage,] = $view->resolvePath('/'); |
|
968 | + [$storage, ] = $view->resolvePath('/'); |
|
969 | 969 | |
970 | 970 | //force rescan of versions, local storage may not have updated the cache |
971 | 971 | if (!self::$scannedVersions) { |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | if ($timestamp) { |
978 | 978 | // fetch for old versions |
979 | 979 | $escapedTimestamp = \OC::$server->getDatabaseConnection()->escapeLikeParameter($timestamp); |
980 | - $pattern .= '.v%.d' . $escapedTimestamp; |
|
980 | + $pattern .= '.v%.d'.$escapedTimestamp; |
|
981 | 981 | $offset = -strlen($escapedTimestamp) - 2; |
982 | 982 | } else { |
983 | 983 | $pattern .= '.v%'; |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | \OC::$server->getLogger(), |
992 | 992 | $cache |
993 | 993 | ); |
994 | - $normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'. $filename)), '/'); |
|
994 | + $normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'.$filename)), '/'); |
|
995 | 995 | $parentId = $cache->getId($normalizedParentPath); |
996 | 996 | if ($parentId === -1) { |
997 | 997 | return []; |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | $result->closeCursor(); |
1008 | 1008 | |
1009 | 1009 | /** @var CacheEntry[] $matches */ |
1010 | - $matches = array_map(function (array $data) { |
|
1010 | + $matches = array_map(function(array $data) { |
|
1011 | 1011 | return Cache::cacheEntryFromData($data, \OC::$server->getMimeTypeLoader()); |
1012 | 1012 | }, $entries); |
1013 | 1013 | |
@@ -1037,18 +1037,18 @@ discard block |
||
1037 | 1037 | $name = pathinfo($filename, PATHINFO_FILENAME); |
1038 | 1038 | $l = \OC::$server->getL10N('files_trashbin'); |
1039 | 1039 | |
1040 | - $location = '/' . trim($location, '/'); |
|
1040 | + $location = '/'.trim($location, '/'); |
|
1041 | 1041 | |
1042 | 1042 | // if extension is not empty we set a dot in front of it |
1043 | 1043 | if ($ext !== '') { |
1044 | - $ext = '.' . $ext; |
|
1044 | + $ext = '.'.$ext; |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | - if ($view->file_exists('files' . $location . '/' . $filename)) { |
|
1047 | + if ($view->file_exists('files'.$location.'/'.$filename)) { |
|
1048 | 1048 | $i = 2; |
1049 | - $uniqueName = $name . " (" . $l->t("restored") . ")" . $ext; |
|
1050 | - while ($view->file_exists('files' . $location . '/' . $uniqueName)) { |
|
1051 | - $uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext; |
|
1049 | + $uniqueName = $name." (".$l->t("restored").")".$ext; |
|
1050 | + while ($view->file_exists('files'.$location.'/'.$uniqueName)) { |
|
1051 | + $uniqueName = $name." (".$l->t("restored")." ".$i.")".$ext; |
|
1052 | 1052 | $i++; |
1053 | 1053 | } |
1054 | 1054 | |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | * @return integer size of the folder |
1066 | 1066 | */ |
1067 | 1067 | private static function calculateSize($view) { |
1068 | - $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath(''); |
|
1068 | + $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath(''); |
|
1069 | 1069 | if (!file_exists($root)) { |
1070 | 1070 | return 0; |
1071 | 1071 | } |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | * @return integer trash bin size |
1097 | 1097 | */ |
1098 | 1098 | private static function getTrashbinSize($user) { |
1099 | - $view = new View('/' . $user); |
|
1099 | + $view = new View('/'.$user); |
|
1100 | 1100 | $fileInfo = $view->getFileInfo('/files_trashbin'); |
1101 | 1101 | return isset($fileInfo['size']) ? $fileInfo['size'] : 0; |
1102 | 1102 | } |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | * @return bool |
1109 | 1109 | */ |
1110 | 1110 | public static function isEmpty($user) { |
1111 | - $view = new View('/' . $user . '/files_trashbin'); |
|
1111 | + $view = new View('/'.$user.'/files_trashbin'); |
|
1112 | 1112 | if ($view->is_dir('/files') && $dh = $view->opendir('/files')) { |
1113 | 1113 | while ($file = readdir($dh)) { |
1114 | 1114 | if (!Filesystem::isIgnoredDir($file)) { |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $result = $query->execute(); |
88 | 88 | |
89 | 89 | if ($result) { |
90 | - return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
90 | + return (int) $this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
91 | 91 | } |
92 | 92 | |
93 | - $message = 'Internal failure, Could not add trusted server: ' . $url; |
|
93 | + $message = 'Internal failure, Could not add trusted server: '.$url; |
|
94 | 94 | $message_t = $this->IL10N->t('Could not add server'); |
95 | 95 | throw new HintException($message, $message_t); |
96 | 96 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $qResult->closeCursor(); |
127 | 127 | |
128 | 128 | if (empty($result)) { |
129 | - throw new \Exception('No Server found with ID: ' . $id); |
|
129 | + throw new \Exception('No Server found with ID: '.$id); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $result[0]; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $statement->closeCursor(); |
204 | 204 | |
205 | 205 | if (!isset($result['token'])) { |
206 | - throw new \Exception('No token found for: ' . $url); |
|
206 | + throw new \Exception('No token found for: '.$url); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | return $result['token']; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $statement = $query->execute(); |
281 | 281 | $result = $statement->fetch(); |
282 | 282 | $statement->closeCursor(); |
283 | - return (int)$result['status']; |
|
283 | + return (int) $result['status']; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |