diff --git a/appinfo/info.xml b/appinfo/info.xml index 00edf3c9e..a85c32477 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -43,9 +43,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 2a83a9997..af0d139c1 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 function getStrictness(): Strictness { return Strictness::IGNORE; @@ -33,7 +32,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), ]; } diff --git a/lib/Migration/RemoveShareTokens.php b/lib/Migration/RemoveShareTokens.php deleted file mode 100644 index 5ef28d62b..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 47baf360f..40d7ceb4f 100644 --- a/lib/Model/ShareWrapper.php +++ b/lib/Model/ShareWrapper.php @@ -154,7 +154,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 0ef08b49f..19d539c33 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);