diff --git a/lib/FileVersions.php b/lib/FileVersions.php index 5c7d7f43..10c1244e 100644 --- a/lib/FileVersions.php +++ b/lib/FileVersions.php @@ -62,6 +62,13 @@ class FileVersions { */ private static $authorExt = "_author.json"; + /** + * Groupfolder name + * + * @var string + */ + private static $groupFolderName = "__groupfolders"; + /** * Split file path and version id * @@ -112,10 +119,15 @@ private static function getView($userId, $fileInfo, $createIfNotExist = false) { $fileId = null; if ($fileInfo !== null) { $fileId = $fileInfo->getId(); + if ($fileInfo->getStorage()->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class)) { + $view = new View("/" . self::$groupFolderName); + } else { + $view = new View("/" . $userId); + } + } else { + $view = new View("/" . $userId); } - $view = new View("/" . $userId); - $path = self::$appName; if (!self::checkFolderExist($view, $path, $createIfNotExist)) { return [null, null]; @@ -369,6 +381,7 @@ public static function clearHistory() { $userIds = $userDatabase->getUsers(); $view = new View("/"); + $groupFolderView = new View("/" . self::$groupFolderName); foreach ($userIds as $userId) { $path = $userId . "/" . self::$appName; @@ -376,6 +389,10 @@ public static function clearHistory() { if ($view->file_exists($path)) { $view->unlink($path); } + + if ($groupFolderView->file_exists($path)) { + $groupFolderView->unlink($path); + } } $logger->debug("clear all history", ["app" => self::$appName]);