Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/groupfolders.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Command/Trashbin/Cleanup.php12
-rw-r--r--lib/Trash/TrashBackend.php4
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/Command/Trashbin/Cleanup.php b/lib/Command/Trashbin/Cleanup.php
index da47eb41..2d16369c 100644
--- a/lib/Command/Trashbin/Cleanup.php
+++ b/lib/Command/Trashbin/Cleanup.php
@@ -46,10 +46,12 @@ class Cleanup extends Base {
*/
private $folderManager;
- public function __construct(TrashBackend $trashBackend, FolderManager $folderManager, IRootFolder $rootFolder) {
+ public function __construct(FolderManager $folderManager, IRootFolder $rootFolder) {
parent::__construct();
- $this->trashBackend = $trashBackend;
- $this->folderManager = $folderManager;
+ if (\OC::$server->getAppManager()->isEnabledForUser('files_trashbin')) {
+ $this->trashBackend = \OC::$server->get(TrashBackend::class);
+ $this->folderManager = $folderManager;
+ }
}
protected function configure() {
@@ -62,6 +64,10 @@ class Cleanup extends Base {
}
protected function execute(InputInterface $input, OutputInterface $output) {
+ if (!$this->trashBackend) {
+ $output->writeln('<error>files_trashbin is disabled: group folders trashbin is not available</error>');
+ return -1;
+ }
$helper = $this->getHelper('question');
$folders = $this->folderManager->getAllFolders();
diff --git a/lib/Trash/TrashBackend.php b/lib/Trash/TrashBackend.php
index b278955e..78c438d8 100644
--- a/lib/Trash/TrashBackend.php
+++ b/lib/Trash/TrashBackend.php
@@ -178,7 +178,9 @@ class TrashBackend implements ITrashBackend {
$targetInternalPath = $trashFolder->getInternalPath() . '/' . $trashName;
if ($trashStorage->moveFromStorage($unJailedStorage, $unJailedInternalPath, $targetInternalPath)) {
$this->trashManager->addTrashItem($folderId, $name, $time, $internalPath, $fileEntry->getId());
- $trashStorage->getCache()->moveFromCache($unJailedStorage->getCache(), $unJailedInternalPath, $targetInternalPath);
+ if ($trashStorage->getCache()->getId($targetInternalPath) !== $fileEntry->getId()) {
+ $trashStorage->getCache()->moveFromCache($unJailedStorage->getCache(), $unJailedInternalPath, $targetInternalPath);
+ }
} else {
throw new \Exception("Failed to move groupfolder item to trash");
}