Skip to content

Commit

Permalink
fix version's author in group folder
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Dec 11, 2023
1 parent 47ee61e commit f108dc7
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions lib/FileVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -369,13 +381,18 @@ public static function clearHistory() {
$userIds = $userDatabase->getUsers();

$view = new View("/");
$groupFolderView = new View("/" . self::$groupFolderName);

foreach ($userIds as $userId) {
$path = $userId . "/" . self::$appName;

if ($view->file_exists($path)) {
$view->unlink($path);
}

if ($groupFolderView->file_exists($path)) {
$groupFolderView->unlink($path);
}
}

$logger->debug("clear all history", ["app" => self::$appName]);
Expand Down

0 comments on commit f108dc7

Please sign in to comment.