diff options
author | Morris Jobke <hey@morrisjobke.de> | 2021-03-18 08:57:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 08:57:09 +0100 |
commit | 6401d882833aeea775d64b70bc8b46c881ea8161 (patch) | |
tree | adc6cfa53079a6c4a5db24c636140d4b66abc932 /apps/files_sharing/lib | |
parent | 5cdc3e9c9da5db8bf98c2786018941c412ffe146 (diff) | |
parent | 9ccabff6ba9a0e89d7128fbdd43d48fe7a68b11e (diff) | |
download | nextcloud-server-6401d882833aeea775d64b70bc8b46c881ea8161.tar.gz nextcloud-server-6401d882833aeea775d64b70bc8b46c881ea8161.zip |
Merge pull request #25331 from nextcloud/fix-valid-storages-removed-when-cleaning-remote-storages
Fix valid storages removed when cleaning remote storages
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/Command/CleanupRemoteStorages.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php index db18e7d2499..cf0550aef7f 100644 --- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php +++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php @@ -25,6 +25,7 @@ namespace OCA\Files_Sharing\Command; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\Federation\ICloudIdManager; use OCP\IDBConnection; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -42,8 +43,14 @@ class CleanupRemoteStorages extends Command { */ protected $connection; - public function __construct(IDBConnection $connection) { + /** + * @var ICloudIdManager + */ + private $cloudIdManager; + + public function __construct(IDBConnection $connection, ICloudIdManager $cloudIdManager) { $this->connection = $connection; + $this->cloudIdManager = $cloudIdManager; parent::__construct(); } @@ -166,14 +173,17 @@ class CleanupRemoteStorages extends Command { public function getRemoteShareIds() { $queryBuilder = $this->connection->getQueryBuilder(); - $queryBuilder->select(['id', 'share_token', 'remote']) + $queryBuilder->select(['id', 'share_token', 'owner', 'remote']) ->from('share_external'); $query = $queryBuilder->execute(); $remoteShareIds = []; while ($row = $query->fetch()) { - $remoteShareIds[$row['id']] = 'shared::' . md5($row['share_token'] . '@' . $row['remote']); + $cloudId = $this->cloudIdManager->getCloudId($row['owner'], $row['remote']); + $remote = $cloudId->getRemote(); + + $remoteShareIds[$row['id']] = 'shared::' . md5($row['share_token'] . '@' . $remote); } return $remoteShareIds; |