Merge pull request #58446 from nextcloud/backport/58414/stable30
Some checks failed
Integration sqlite / changes (push) Has been cancelled
Psalm static code analysis / static-code-analysis (push) Has been cancelled
Psalm static code analysis / static-code-analysis-security (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ocp (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, --tags ~@large files_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, capabilities_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, collaboration_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, comments_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, dav_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, federation_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, filesdrop_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, ldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, openldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, openldap_numerical_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, remoteapi_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, setup_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, sharees_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, sharing_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, theming_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, videoverification_features) (push) Has been cancelled
Integration sqlite / integration-sqlite-summary (push) Has been cancelled

[stable30] fix(TransferOwnershipService): Remove groupfolders size
This commit is contained in:
Andy Scherzinger 2026-02-20 23:16:33 +01:00 committed by GitHub
commit 45cf1db466
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View file

@ -15,6 +15,7 @@ use OC\Encryption\Manager as EncryptionManager;
use OC\Files\Filesystem;
use OC\Files\View;
use OCA\Files\Exception\TransferOwnershipException;
use OCA\GroupFolders\Mount\GroupMountPoint;
use OCP\Encryption\IManager as IEncryptionManager;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\File;
@ -27,6 +28,7 @@ use OCP\Files\NotFoundException;
use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\Server;
use OCP\Share\IManager as IShareManager;
use OCP\Share\IShare;
use Symfony\Component\Console\Helper\ProgressBar;
@ -155,6 +157,28 @@ class OwnershipTransferService {
);
$sizeDifference = $sourceSize - $view->getFileInfo($finalTarget)->getSize();
// Files in Team folders are not transferred, so their size needs to be subtracted to avoid warnings about size differences
$mounts = Server::get(IMountManager::class)->getAll();
foreach ($mounts as $mount) {
if (!$mount instanceof GroupMountPoint || !str_starts_with($mount->getMountPoint(), '/' . $sourcePath . '/')) {
continue;
}
$storage = $mount->getStorage();
if ($storage === null) {
$output->writeln('Failed to get storage for mount: ' . $mount->getMountPoint());
continue;
}
$rootCacheEntry = $storage->getCache()->get('');
if ($rootCacheEntry === false) {
$output->writeln('Failed to get root cache entry for storage: ' . $mount->getMountPoint());
continue;
}
$sizeDifference -= $rootCacheEntry->getSize();
}
// transfer the incoming shares
$sourceShares = $this->collectIncomingShares(
$sourceUid,
@ -235,7 +259,7 @@ class OwnershipTransferService {
$progress->start();
if ($this->encryptionManager->isEnabled()) {
$masterKeyEnabled = \OCP\Server::get(\OCA\Encryption\Util::class)->isMasterKeyEnabled();
$masterKeyEnabled = Server::get(\OCA\Encryption\Util::class)->isMasterKeyEnabled();
} else {
$masterKeyEnabled = false;
}

View file

@ -106,6 +106,7 @@
<referencedClass name="OCA\GroupFolders\Mount\GroupFolderStorage"/>
<referencedClass name="OCA\TwoFactorNextcloudNotification\Controller\APIController"/>
<referencedClass name="OCA\GlobalSiteSelector\Service\SlaveService"/>
<referencedClass name="OCA\GroupFolders\Mount\GroupMountPoint"/>
</errorLevel>
</UndefinedClass>
<UndefinedFunction>