Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2021-03-18 15:09:22 +0300
committerGitHub <noreply@github.com>2021-03-18 15:09:22 +0300
commit939db1f46619d7236e1126ca8e519b03ddc29aa1 (patch)
tree6e2508b5102610ea74d33479dd990605727a82cc /apps/files_sharing/lib
parent7dfb3afdac37b9340ec2d38154d1913577d88018 (diff)
parentec454e7c2ba342c246cd5b039eda3a269f99fe2c (diff)
Merge pull request #26190 from nextcloud/backport/25331/stable20
[stable20] Fix valid storages removed when cleaning remote storages
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/Command/CleanupRemoteStorages.php16
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 259e55ff620..ab63df4559c 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;