Merge pull request #46563 from nextcloud/backport/46450/stable28

[stable28] fix(files_metadata): Don't run generation job on every upgrade
This commit is contained in:
Joas Schilling 2024-07-25 08:49:47 +02:00 committed by GitHub
commit 12a672fbfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,9 +53,14 @@ class GenerateMetadataJob extends TimedJob {
}
protected function run(mixed $argument): void {
$users = $this->userManager->search('');
if ($this->config->getAppValue('core', 'metadataGenerationDone', 'false') !== 'false') {
return;
}
$lastHandledUser = $this->config->getAppValue('core', 'metadataGenerationLastHandledUser', '');
$users = $this->userManager->search('');
// we'll only start timer once we have found a valid user to handle
// meaning NOW if we have not handled any user from a previous run
$startTime = ($lastHandledUser === '') ? time() : null;
@ -79,8 +84,8 @@ class GenerateMetadataJob extends TimedJob {
}
}
$this->jobList->remove(GenerateMetadataJob::class);
$this->config->deleteAppValue('core', 'metadataGenerationLastHandledUser');
$this->config->setAppValue('core', 'metadataGenerationDone', 'true');
}
private function scanFilesForUser(string $userId): void {