From 633740b75eb27f0e3e85b28dde1093b8c416e52b Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 6 Oct 2026 22:05:57 -0100 Subject: [PATCH] revert #2454 Signed-off-by: Maxence Lange --- appinfo/info.xml | 3 -- lib/ConfigLexicon.php | 2 - lib/Migration/RemoveShareTokens.php | 58 ----------------------------- lib/Model/ShareWrapper.php | 2 +- lib/ShareByCircleProvider.php | 1 + 5 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 lib/Migration/RemoveShareTokens.php diff --git a/appinfo/info.xml b/appinfo/info.xml index 8972d8b80..6bb021b60 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -47,9 +47,6 @@ Those groups of people can then be used by any other app for sharing purpose. OCA\Circles\Migration\Migration OCA\Circles\Migration\SyncGroupCircles - - OCA\Circles\Migration\RemoveShareTokens - diff --git a/lib/ConfigLexicon.php b/lib/ConfigLexicon.php index 815c0f551..493debc90 100644 --- a/lib/ConfigLexicon.php +++ b/lib/ConfigLexicon.php @@ -23,7 +23,6 @@ class ConfigLexicon implements ILexicon { public const USER_SINGLE_ID = 'userSingleId'; public const FEDERATED_TEAMS_ENABLED = 'federated_teams_enabled'; public const FEDERATED_TEAMS_FRONTAL = 'federated_teams_frontal'; - public const REMOVE_SHARE_TOKENS_DONE = 'remove_share_tokens_done'; public const TEAM_FOLDER_AUTO_CREATE = 'team_folder_auto_create'; public const TEAM_FOLDER_DEFAULT_QUOTA = 'team_folder_default_quota'; @@ -56,7 +55,6 @@ public function getAppConfigs(): array { return [ new Entry(key: self::FEDERATED_TEAMS_ENABLED, type: ValueType::BOOL, defaultRaw: false, definition: 'disable/enable Federated Teams', lazy: true), new Entry(key: self::FEDERATED_TEAMS_FRONTAL, type: ValueType::STRING, defaultRaw: '', definition: 'domain name used to auth public request', lazy: true), - new Entry(key: self::REMOVE_SHARE_TOKENS_DONE, type: ValueType::BOOL, defaultRaw: false, definition: 'whether the remove share tokens repair step has already been executed', lazy: true), new Entry(key: self::TEAM_FOLDER_AUTO_CREATE, type: ValueType::BOOL, defaultRaw: true, definition: 'whether Circles auto-creates team folders and allows UI/API upgrade (not exposed in admin UI)', lazy: true), new Entry(key: self::TEAM_FOLDER_DEFAULT_QUOTA, type: ValueType::INT, defaultRaw: 0, definition: 'default quota in bytes for auto-created team folders (0 means unlimited)', lazy: true), // OIDC diff --git a/lib/Migration/RemoveShareTokens.php b/lib/Migration/RemoveShareTokens.php deleted file mode 100644 index b57ea11d3..000000000 --- a/lib/Migration/RemoveShareTokens.php +++ /dev/null @@ -1,58 +0,0 @@ -appConfig->getAppValueBool(ConfigLexicon::REMOVE_SHARE_TOKENS_DONE)) { - return; - } - - $qb = $this->dbConnection->getQueryBuilder(); - $qb->update('share') - ->set('token', $qb->createNamedParameter(null, IQueryBuilder::PARAM_NULL)) - ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_CIRCLE, IQueryBuilder::PARAM_INT))) - ->andWhere($qb->expr()->isNotNull('token')) - ->setMaxResults(1000); - - while (true) { - $updated = $qb->executeStatement(); - if ($updated === 0) { - break; - } - } - - $this->appConfig->setAppValueBool(ConfigLexicon::REMOVE_SHARE_TOKENS_DONE, true); - } -} diff --git a/lib/Model/ShareWrapper.php b/lib/Model/ShareWrapper.php index 29bc6c5ce..24de49370 100644 --- a/lib/Model/ShareWrapper.php +++ b/lib/Model/ShareWrapper.php @@ -152,7 +152,7 @@ public function setToken(string $token): self { } public function getToken(): string { - return $this->shareToken?->getToken() ?? ''; + return $this->token; } public function setStatus(int $status): self { diff --git a/lib/ShareByCircleProvider.php b/lib/ShareByCircleProvider.php index def5af381..f5cfb3c1a 100644 --- a/lib/ShareByCircleProvider.php +++ b/lib/ShareByCircleProvider.php @@ -144,6 +144,7 @@ public function create(IShare $share): IShare { ->add(DataProbe::INITIATOR, [DataProbe::BASED_ON]); $circle = $this->circleService->probeCircle($share->getSharedWith(), $circleProbe, $dataProbe); + $share->setToken($this->token(15)); $share->setMailSend(true); $owner = $circle->getInitiator(); $this->shareWrapperService->save($share);