aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-02-01 23:37:26 +0100
committerLouis Chemineau <louis@chmn.me>2024-02-01 23:37:26 +0100
commit17ee5968263a5bb96f4ca1d50845ad06066f8062 (patch)
treeb0ea2a5ab768c585572077e283c238cef0aeaa8b /apps/files_versions/lib
parentb838237f82c627f23c21379d8a899ed70a1790fb (diff)
downloadnextcloud-server-17ee5968263a5bb96f4ca1d50845ad06066f8062.tar.gz
nextcloud-server-17ee5968263a5bb96f4ca1d50845ad06066f8062.zip
Revert "Cleanup versions entity in during versions:clean command"
This reverts commit 1ec9f3e5f9dd84723008137af73cf365beaf4d1b.
Diffstat (limited to 'apps/files_versions/lib')
-rw-r--r--apps/files_versions/lib/Command/CleanUp.php3
-rw-r--r--apps/files_versions/lib/Db/VersionsMapper.php17
2 files changed, 0 insertions, 20 deletions
diff --git a/apps/files_versions/lib/Command/CleanUp.php b/apps/files_versions/lib/Command/CleanUp.php
index be66ce8ffb3..519b3689a58 100644
--- a/apps/files_versions/lib/Command/CleanUp.php
+++ b/apps/files_versions/lib/Command/CleanUp.php
@@ -24,7 +24,6 @@
*/
namespace OCA\Files_Versions\Command;
-use OCA\Files_Versions\Db\VersionsMapper;
use OCP\Files\IRootFolder;
use OCP\IUserBackend;
use OCP\IUserManager;
@@ -38,7 +37,6 @@ class CleanUp extends Command {
public function __construct(
protected IRootFolder $rootFolder,
protected IUserManager $userManager,
- protected VersionsMapper $versionMapper,
) {
parent::__construct();
}
@@ -122,7 +120,6 @@ class CleanUp extends Command {
\OC_Util::setupFS($user);
$fullPath = '/' . $user . '/files_versions' . ($path ? '/' . $path : '');
- $this->versionMapper->deleteAllVersionsForUser($user);
if ($this->rootFolder->nodeExists($fullPath)) {
$this->rootFolder->get($fullPath)->delete();
}
diff --git a/apps/files_versions/lib/Db/VersionsMapper.php b/apps/files_versions/lib/Db/VersionsMapper.php
index 9b5d7a52c13..bc6e8b264de 100644
--- a/apps/files_versions/lib/Db/VersionsMapper.php
+++ b/apps/files_versions/lib/Db/VersionsMapper.php
@@ -27,7 +27,6 @@ declare(strict_types=1);
namespace OCA\Files_Versions\Db;
use OCP\AppFramework\Db\QBMapper;
-use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
/**
@@ -84,20 +83,4 @@ class VersionsMapper extends QBMapper {
->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
->executeStatement();
}
-
- public function deleteAllVersionsForUser(string $userId): int {
- $deleteQuery = $this->db->getQueryBuilder();
- $filesVersionSelect = $this->db->getQueryBuilder();
- $filesVersionSelect->select('fileid')
- ->from('filecache', 'f')
- ->join('f', 'mounts', 'm', $filesVersionSelect->expr()->eq('f.storage', 'm.storage_id'))
- ->where($filesVersionSelect->expr()->like('f.path', $deleteQuery->createNamedParameter('files/%', IQueryBuilder::PARAM_STR)))
- ->andWhere($filesVersionSelect->expr()->eq('m.user_id', $deleteQuery->createNamedParameter($userId, IQueryBuilder::PARAM_STR)))
- ->andWhere($filesVersionSelect->expr()->eq('m.mount_point', $deleteQuery->createNamedParameter("/$userId/", IQueryBuilder::PARAM_STR)));
-
- $deleteQuery->delete($this->getTableName())
- ->where($deleteQuery->expr()->in('file_id', $deleteQuery->createFunction($filesVersionSelect->getSQL()), IQueryBuilder::PARAM_INT_ARRAY));
-
- return $deleteQuery->executeStatement();
- }
}