@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | Filesystem::initMountPoints($uid); |
107 | 107 | if ($uid !== User::getUser()) { |
108 | 108 | $info = Filesystem::getFileInfo($filename); |
109 | - $ownerView = new View('/' . $uid . '/files'); |
|
109 | + $ownerView = new View('/'.$uid.'/files'); |
|
110 | 110 | try { |
111 | 111 | $filename = $ownerView->getPath($info['fileid']); |
112 | 112 | } catch (NotFoundException $e) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | private static function setUpTrash($user) { |
160 | - $view = new View('/' . $user); |
|
160 | + $view = new View('/'.$user); |
|
161 | 161 | if (!$view->is_dir('files_trashbin')) { |
162 | 162 | $view->mkdir('files_trashbin'); |
163 | 163 | } |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | |
193 | 193 | $view = new View('/'); |
194 | 194 | |
195 | - $target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp; |
|
196 | - $source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp; |
|
195 | + $target = $user.'/files_trashbin/files/'.$targetFilename.'.d'.$timestamp; |
|
196 | + $source = $owner.'/files_trashbin/files/'.$sourceFilename.'.d'.$timestamp; |
|
197 | 197 | $free = $view->free_space($target); |
198 | 198 | $isUnknownOrUnlimitedFreeSpace = $free < 0; |
199 | 199 | $isEnoughFreeSpaceLeft = $view->filesize($source) < $free; |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | $ownerPath = $file_path; |
233 | 233 | } |
234 | 234 | |
235 | - $ownerView = new View('/' . $owner); |
|
235 | + $ownerView = new View('/'.$owner); |
|
236 | 236 | // file has been deleted in between |
237 | - if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) { |
|
237 | + if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/'.$ownerPath)) { |
|
238 | 238 | return true; |
239 | 239 | } |
240 | 240 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $lockingProvider = \OC::$server->getLockingProvider(); |
256 | 256 | |
257 | 257 | // disable proxy to prevent recursive calls |
258 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
258 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
259 | 259 | $gotLock = false; |
260 | 260 | |
261 | 261 | while (!$gotLock) { |
@@ -271,12 +271,12 @@ discard block |
||
271 | 271 | |
272 | 272 | $timestamp = $timestamp + 1; |
273 | 273 | |
274 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
274 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
278 | 278 | /** @var \OC\Files\Storage\Storage $sourceStorage */ |
279 | - [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/' . $ownerPath); |
|
279 | + [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/'.$ownerPath); |
|
280 | 280 | |
281 | 281 | try { |
282 | 282 | $moveSuccessful = true; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | if ($trashStorage->file_exists($trashInternalPath)) { |
290 | 290 | $trashStorage->unlink($trashInternalPath); |
291 | 291 | } |
292 | - \OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']); |
|
292 | + \OC::$server->getLogger()->error('Couldn\'t move '.$file_path.' to the trash bin', ['app' => 'files_trashbin']); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | \OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']); |
311 | 311 | } |
312 | 312 | \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path), |
313 | - 'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)]); |
|
313 | + 'trashPath' => Filesystem::normalizePath($filename.'.d'.$timestamp)]); |
|
314 | 314 | |
315 | 315 | self::retainVersions($filename, $owner, $ownerPath, $timestamp); |
316 | 316 | |
@@ -345,17 +345,17 @@ discard block |
||
345 | 345 | $user = User::getUser(); |
346 | 346 | $rootView = new View('/'); |
347 | 347 | |
348 | - if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) { |
|
348 | + if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) { |
|
349 | 349 | if ($owner !== $user) { |
350 | - self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView); |
|
350 | + self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.basename($ownerPath).'.d'.$timestamp, $rootView); |
|
351 | 351 | } |
352 | - self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp); |
|
352 | + self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.$filename.'.d'.$timestamp); |
|
353 | 353 | } elseif ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) { |
354 | 354 | foreach ($versions as $v) { |
355 | 355 | if ($owner !== $user) { |
356 | - self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp); |
|
356 | + self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.$v['name'].'.v'.$v['version'].'.d'.$timestamp); |
|
357 | 357 | } |
358 | - self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp); |
|
358 | + self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.$filename.'.v'.$v['version'].'.d'.$timestamp); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | } |
@@ -417,18 +417,18 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public static function restore($file, $filename, $timestamp) { |
419 | 419 | $user = User::getUser(); |
420 | - $view = new View('/' . $user); |
|
420 | + $view = new View('/'.$user); |
|
421 | 421 | |
422 | 422 | $location = ''; |
423 | 423 | if ($timestamp) { |
424 | 424 | $location = self::getLocation($user, $filename, $timestamp); |
425 | 425 | if ($location === false) { |
426 | - \OC::$server->getLogger()->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']); |
|
426 | + \OC::$server->getLogger()->error('trash bin database inconsistent! ($user: '.$user.' $filename: '.$filename.', $timestamp: '.$timestamp.')', ['app' => 'files_trashbin']); |
|
427 | 427 | } else { |
428 | 428 | // if location no longer exists, restore file in the root directory |
429 | 429 | if ($location !== '/' && |
430 | - (!$view->is_dir('files/' . $location) || |
|
431 | - !$view->isCreatable('files/' . $location)) |
|
430 | + (!$view->is_dir('files/'.$location) || |
|
431 | + !$view->isCreatable('files/'.$location)) |
|
432 | 432 | ) { |
433 | 433 | $location = ''; |
434 | 434 | } |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | // we need a extension in case a file/dir with the same name already exists |
439 | 439 | $uniqueFilename = self::getUniqueFilename($location, $filename, $view); |
440 | 440 | |
441 | - $source = Filesystem::normalizePath('files_trashbin/files/' . $file); |
|
442 | - $target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename); |
|
441 | + $source = Filesystem::normalizePath('files_trashbin/files/'.$file); |
|
442 | + $target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename); |
|
443 | 443 | if (!$view->file_exists($source)) { |
444 | 444 | return false; |
445 | 445 | } |
@@ -454,10 +454,10 @@ discard block |
||
454 | 454 | // handle the restore result |
455 | 455 | if ($restoreResult) { |
456 | 456 | $fakeRoot = $view->getRoot(); |
457 | - $view->chroot('/' . $user . '/files'); |
|
458 | - $view->touch('/' . $location . '/' . $uniqueFilename, $mtime); |
|
457 | + $view->chroot('/'.$user.'/files'); |
|
458 | + $view->touch('/'.$location.'/'.$uniqueFilename, $mtime); |
|
459 | 459 | $view->chroot($fakeRoot); |
460 | - \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename), |
|
460 | + \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename), |
|
461 | 461 | 'trashPath' => Filesystem::normalizePath($file)]); |
462 | 462 | |
463 | 463 | self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $user = User::getUser(); |
490 | 490 | $rootView = new View('/'); |
491 | 491 | |
492 | - $target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename); |
|
492 | + $target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename); |
|
493 | 493 | |
494 | 494 | [$owner, $ownerPath] = self::getUidAndFilename($target); |
495 | 495 | |
@@ -504,14 +504,14 @@ discard block |
||
504 | 504 | $versionedFile = $file; |
505 | 505 | } |
506 | 506 | |
507 | - if ($view->is_dir('/files_trashbin/versions/' . $file)) { |
|
508 | - $rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath)); |
|
507 | + if ($view->is_dir('/files_trashbin/versions/'.$file)) { |
|
508 | + $rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath)); |
|
509 | 509 | } elseif ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) { |
510 | 510 | foreach ($versions as $v) { |
511 | 511 | if ($timestamp) { |
512 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
512 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
513 | 513 | } else { |
514 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
514 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
515 | 515 | } |
516 | 516 | } |
517 | 517 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | public static function deleteAll() { |
525 | 525 | $user = User::getUser(); |
526 | 526 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
527 | - $view = new View('/' . $user); |
|
527 | + $view = new View('/'.$user); |
|
528 | 528 | $fileInfos = $view->getDirectoryContent('files_trashbin/files'); |
529 | 529 | |
530 | 530 | try { |
@@ -594,13 +594,13 @@ discard block |
||
594 | 594 | */ |
595 | 595 | public static function delete($filename, $user, $timestamp = null) { |
596 | 596 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
597 | - $view = new View('/' . $user); |
|
597 | + $view = new View('/'.$user); |
|
598 | 598 | $size = 0; |
599 | 599 | |
600 | 600 | if ($timestamp) { |
601 | 601 | $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?'); |
602 | 602 | $query->execute([$user, $filename, $timestamp]); |
603 | - $file = $filename . '.d' . $timestamp; |
|
603 | + $file = $filename.'.d'.$timestamp; |
|
604 | 604 | } else { |
605 | 605 | $file = $filename; |
606 | 606 | } |
@@ -608,20 +608,20 @@ discard block |
||
608 | 608 | $size += self::deleteVersions($view, $file, $filename, $timestamp, $user); |
609 | 609 | |
610 | 610 | try { |
611 | - $node = $userRoot->get('/files_trashbin/files/' . $file); |
|
611 | + $node = $userRoot->get('/files_trashbin/files/'.$file); |
|
612 | 612 | } catch (NotFoundException $e) { |
613 | 613 | return $size; |
614 | 614 | } |
615 | 615 | |
616 | 616 | if ($node instanceof Folder) { |
617 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file)); |
|
617 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file)); |
|
618 | 618 | } elseif ($node instanceof File) { |
619 | - $size += $view->filesize('/files_trashbin/files/' . $file); |
|
619 | + $size += $view->filesize('/files_trashbin/files/'.$file); |
|
620 | 620 | } |
621 | 621 | |
622 | - self::emitTrashbinPreDelete('/files_trashbin/files/' . $file); |
|
622 | + self::emitTrashbinPreDelete('/files_trashbin/files/'.$file); |
|
623 | 623 | $node->delete(); |
624 | - self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); |
|
624 | + self::emitTrashbinPostDelete('/files_trashbin/files/'.$file); |
|
625 | 625 | |
626 | 626 | return $size; |
627 | 627 | } |
@@ -637,17 +637,17 @@ discard block |
||
637 | 637 | private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) { |
638 | 638 | $size = 0; |
639 | 639 | if (\OCP\App::isEnabled('files_versions')) { |
640 | - if ($view->is_dir('files_trashbin/versions/' . $file)) { |
|
641 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file)); |
|
642 | - $view->unlink('files_trashbin/versions/' . $file); |
|
640 | + if ($view->is_dir('files_trashbin/versions/'.$file)) { |
|
641 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file)); |
|
642 | + $view->unlink('files_trashbin/versions/'.$file); |
|
643 | 643 | } elseif ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) { |
644 | 644 | foreach ($versions as $v) { |
645 | 645 | if ($timestamp) { |
646 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
647 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
646 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
647 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
648 | 648 | } else { |
649 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
650 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
649 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
650 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
651 | 651 | } |
652 | 652 | } |
653 | 653 | } |
@@ -664,13 +664,13 @@ discard block |
||
664 | 664 | */ |
665 | 665 | public static function file_exists($filename, $timestamp = null) { |
666 | 666 | $user = User::getUser(); |
667 | - $view = new View('/' . $user); |
|
667 | + $view = new View('/'.$user); |
|
668 | 668 | |
669 | 669 | if ($timestamp) { |
670 | - $filename = $filename . '.d' . $timestamp; |
|
670 | + $filename = $filename.'.d'.$timestamp; |
|
671 | 671 | } |
672 | 672 | |
673 | - $target = Filesystem::normalizePath('files_trashbin/files/' . $filename); |
|
673 | + $target = Filesystem::normalizePath('files_trashbin/files/'.$filename); |
|
674 | 674 | return $view->file_exists($target); |
675 | 675 | } |
676 | 676 | |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | foreach ($files as $file) { |
798 | 798 | if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) { |
799 | 799 | $tmp = self::delete($file['name'], $user, $file['mtime']); |
800 | - \OC::$server->getLogger()->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']); |
|
800 | + \OC::$server->getLogger()->info('remove "'.$file['name'].'" ('.$tmp.'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']); |
|
801 | 801 | $availableSpace += $tmp; |
802 | 802 | $size += $tmp; |
803 | 803 | } else { |
@@ -828,10 +828,10 @@ discard block |
||
828 | 828 | $size += self::delete($filename, $user, $timestamp); |
829 | 829 | $count++; |
830 | 830 | } catch (\OCP\Files\NotPermittedException $e) { |
831 | - \OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "' . $filename . '" from trashbin failed.']); |
|
831 | + \OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "'.$filename.'" from trashbin failed.']); |
|
832 | 832 | } |
833 | 833 | \OC::$server->getLogger()->info( |
834 | - 'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.', |
|
834 | + 'Remove "'.$filename.'" from trashbin because it exceeds max retention obligation term.', |
|
835 | 835 | ['app' => 'files_trashbin'] |
836 | 836 | ); |
837 | 837 | } else { |
@@ -857,16 +857,16 @@ discard block |
||
857 | 857 | $view->mkdir($destination); |
858 | 858 | $view->touch($destination, $view->filemtime($source)); |
859 | 859 | foreach ($view->getDirectoryContent($source) as $i) { |
860 | - $pathDir = $source . '/' . $i['name']; |
|
860 | + $pathDir = $source.'/'.$i['name']; |
|
861 | 861 | if ($view->is_dir($pathDir)) { |
862 | - $size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view); |
|
862 | + $size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view); |
|
863 | 863 | } else { |
864 | 864 | $size += $view->filesize($pathDir); |
865 | - $result = $view->copy($pathDir, $destination . '/' . $i['name']); |
|
865 | + $result = $view->copy($pathDir, $destination.'/'.$i['name']); |
|
866 | 866 | if (!$result) { |
867 | 867 | throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException(); |
868 | 868 | } |
869 | - $view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir)); |
|
869 | + $view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir)); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | } else { |
@@ -888,23 +888,23 @@ discard block |
||
888 | 888 | * @return array |
889 | 889 | */ |
890 | 890 | private static function getVersionsFromTrash($filename, $timestamp, $user) { |
891 | - $view = new View('/' . $user . '/files_trashbin/versions'); |
|
891 | + $view = new View('/'.$user.'/files_trashbin/versions'); |
|
892 | 892 | $versions = []; |
893 | 893 | |
894 | 894 | //force rescan of versions, local storage may not have updated the cache |
895 | 895 | if (!self::$scannedVersions) { |
896 | 896 | /** @var \OC\Files\Storage\Storage $storage */ |
897 | - [$storage,] = $view->resolvePath('/'); |
|
897 | + [$storage, ] = $view->resolvePath('/'); |
|
898 | 898 | $storage->getScanner()->scan('files_trashbin/versions'); |
899 | 899 | self::$scannedVersions = true; |
900 | 900 | } |
901 | 901 | |
902 | 902 | if ($timestamp) { |
903 | 903 | // fetch for old versions |
904 | - $matches = $view->searchRaw($filename . '.v%.d' . $timestamp); |
|
904 | + $matches = $view->searchRaw($filename.'.v%.d'.$timestamp); |
|
905 | 905 | $offset = -strlen($timestamp) - 2; |
906 | 906 | } else { |
907 | - $matches = $view->searchRaw($filename . '.v%'); |
|
907 | + $matches = $view->searchRaw($filename.'.v%'); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | if (is_array($matches)) { |
@@ -934,18 +934,18 @@ discard block |
||
934 | 934 | $name = pathinfo($filename, PATHINFO_FILENAME); |
935 | 935 | $l = \OC::$server->getL10N('files_trashbin'); |
936 | 936 | |
937 | - $location = '/' . trim($location, '/'); |
|
937 | + $location = '/'.trim($location, '/'); |
|
938 | 938 | |
939 | 939 | // if extension is not empty we set a dot in front of it |
940 | 940 | if ($ext !== '') { |
941 | - $ext = '.' . $ext; |
|
941 | + $ext = '.'.$ext; |
|
942 | 942 | } |
943 | 943 | |
944 | - if ($view->file_exists('files' . $location . '/' . $filename)) { |
|
944 | + if ($view->file_exists('files'.$location.'/'.$filename)) { |
|
945 | 945 | $i = 2; |
946 | - $uniqueName = $name . " (" . $l->t("restored") . ")" . $ext; |
|
947 | - while ($view->file_exists('files' . $location . '/' . $uniqueName)) { |
|
948 | - $uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext; |
|
946 | + $uniqueName = $name." (".$l->t("restored").")".$ext; |
|
947 | + while ($view->file_exists('files'.$location.'/'.$uniqueName)) { |
|
948 | + $uniqueName = $name." (".$l->t("restored")." ".$i.")".$ext; |
|
949 | 949 | $i++; |
950 | 950 | } |
951 | 951 | |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | * @return integer size of the folder |
963 | 963 | */ |
964 | 964 | private static function calculateSize($view) { |
965 | - $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath(''); |
|
965 | + $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath(''); |
|
966 | 966 | if (!file_exists($root)) { |
967 | 967 | return 0; |
968 | 968 | } |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | * @return integer trash bin size |
994 | 994 | */ |
995 | 995 | private static function getTrashbinSize($user) { |
996 | - $view = new View('/' . $user); |
|
996 | + $view = new View('/'.$user); |
|
997 | 997 | $fileInfo = $view->getFileInfo('/files_trashbin'); |
998 | 998 | return isset($fileInfo['size']) ? $fileInfo['size'] : 0; |
999 | 999 | } |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | * @return bool |
1020 | 1020 | */ |
1021 | 1021 | public static function isEmpty($user) { |
1022 | - $view = new View('/' . $user . '/files_trashbin'); |
|
1022 | + $view = new View('/'.$user.'/files_trashbin'); |
|
1023 | 1023 | if ($view->is_dir('/files') && $dh = $view->opendir('/files')) { |
1024 | 1024 | while ($file = readdir($dh)) { |
1025 | 1025 | if (!Filesystem::isIgnoredDir($file)) { |