Skip to content

Commit 3ac03ec

Browse files
committed
feat(jobs): add cleanup job for job run history
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
1 parent 2a0be84 commit 3ac03ec

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

lib/composer/composer/autoload_classmap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,7 @@
13101310
'OC\\Core\\AppInfo\\ConfigLexicon' => $baseDir . '/core/AppInfo/ConfigLexicon.php',
13111311
'OC\\Core\\BackgroundJobs\\BackgroundCleanupUpdaterBackupsJob' => $baseDir . '/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php',
13121312
'OC\\Core\\BackgroundJobs\\CheckForUserCertificates' => $baseDir . '/core/BackgroundJobs/CheckForUserCertificates.php',
1313+
'OC\\Core\\BackgroundJobs\\CleanupBackgroundJobsJob' => $baseDir . '/core/BackgroundJobs/CleanupBackgroundJobsJob.php',
13131314
'OC\\Core\\BackgroundJobs\\CleanupLoginFlowV2' => $baseDir . '/core/BackgroundJobs/CleanupLoginFlowV2.php',
13141315
'OC\\Core\\BackgroundJobs\\ExpirePreviewsJob' => $baseDir . '/core/BackgroundJobs/ExpirePreviewsJob.php',
13151316
'OC\\Core\\BackgroundJobs\\GenerateMetadataJob' => $baseDir . '/core/BackgroundJobs/GenerateMetadataJob.php',
@@ -2045,6 +2046,7 @@
20452046
'OC\\Repair' => $baseDir . '/lib/private/Repair.php',
20462047
'OC\\RepairException' => $baseDir . '/lib/private/RepairException.php',
20472048
'OC\\Repair\\AddBruteForceCleanupJob' => $baseDir . '/lib/private/Repair/AddBruteForceCleanupJob.php',
2049+
'OC\\Repair\\AddCleanupBackgroundJobsJob' => $baseDir . '/lib/private/Repair/AddCleanupBackgroundJobsJob.php',
20482050
'OC\\Repair\\AddCleanupDeletedUsersBackgroundJob' => $baseDir . '/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php',
20492051
'OC\\Repair\\AddCleanupUpdaterBackupsJob' => $baseDir . '/lib/private/Repair/AddCleanupUpdaterBackupsJob.php',
20502052
'OC\\Repair\\AddMetadataGenerationJob' => $baseDir . '/lib/private/Repair/AddMetadataGenerationJob.php',

lib/composer/composer/autoload_static.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
13511351
'OC\\Core\\AppInfo\\ConfigLexicon' => __DIR__ . '/../../..' . '/core/AppInfo/ConfigLexicon.php',
13521352
'OC\\Core\\BackgroundJobs\\BackgroundCleanupUpdaterBackupsJob' => __DIR__ . '/../../..' . '/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php',
13531353
'OC\\Core\\BackgroundJobs\\CheckForUserCertificates' => __DIR__ . '/../../..' . '/core/BackgroundJobs/CheckForUserCertificates.php',
1354+
'OC\\Core\\BackgroundJobs\\CleanupBackgroundJobsJob' => __DIR__ . '/../../..' . '/core/BackgroundJobs/CleanupBackgroundJobsJob.php',
13541355
'OC\\Core\\BackgroundJobs\\CleanupLoginFlowV2' => __DIR__ . '/../../..' . '/core/BackgroundJobs/CleanupLoginFlowV2.php',
13551356
'OC\\Core\\BackgroundJobs\\ExpirePreviewsJob' => __DIR__ . '/../../..' . '/core/BackgroundJobs/ExpirePreviewsJob.php',
13561357
'OC\\Core\\BackgroundJobs\\GenerateMetadataJob' => __DIR__ . '/../../..' . '/core/BackgroundJobs/GenerateMetadataJob.php',
@@ -2086,6 +2087,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
20862087
'OC\\Repair' => __DIR__ . '/../../..' . '/lib/private/Repair.php',
20872088
'OC\\RepairException' => __DIR__ . '/../../..' . '/lib/private/RepairException.php',
20882089
'OC\\Repair\\AddBruteForceCleanupJob' => __DIR__ . '/../../..' . '/lib/private/Repair/AddBruteForceCleanupJob.php',
2090+
'OC\\Repair\\AddCleanupBackgroundJobsJob' => __DIR__ . '/../../..' . '/lib/private/Repair/AddCleanupBackgroundJobsJob.php',
20892091
'OC\\Repair\\AddCleanupDeletedUsersBackgroundJob' => __DIR__ . '/../../..' . '/lib/private/Repair/AddCleanupDeletedUsersBackgroundJob.php',
20902092
'OC\\Repair\\AddCleanupUpdaterBackupsJob' => __DIR__ . '/../../..' . '/lib/private/Repair/AddCleanupUpdaterBackupsJob.php',
20912093
'OC\\Repair\\AddMetadataGenerationJob' => __DIR__ . '/../../..' . '/lib/private/Repair/AddMetadataGenerationJob.php',

lib/private/Repair.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace OC;
1010

1111
use OC\Repair\AddBruteForceCleanupJob;
12+
use OC\Repair\AddCleanupBackgroundJobsJob;
1213
use OC\Repair\AddCleanupDeletedUsersBackgroundJob;
1314
use OC\Repair\AddCleanupUpdaterBackupsJob;
1415
use OC\Repair\AddMetadataGenerationJob;
@@ -134,14 +135,14 @@ public function addStep(IRepairStep|string $repairStep, bool $includeExpensive =
134135
}
135136
}
136137

137-
if (!($s instanceof IRepairStep)) {
138+
if (!$s instanceof IRepairStep) {
138139
throw new \Exception("Repair step '$repairStep' is not of type \\OCP\\Migration\\IRepairStep");
139140
}
140141

141142
$repairStep = $s;
142143
}
143144

144-
if (($repairStep instanceof IRepairStepExpensive) && !$includeExpensive) {
145+
if ($repairStep instanceof IRepairStepExpensive && !$includeExpensive) {
145146
$this->debug("Skipping expensive repair step '" . $repairStep::class . "'");
146147
} else {
147148
$this->repairSteps[] = $repairStep;
@@ -195,6 +196,7 @@ public static function getRepairSteps(bool $includeExpensive = false): array {
195196
Server::get(SanitizeAccountProperties::class),
196197
Server::get(AddMovePreviewJob::class),
197198
Server::get(ConfigKeyMigration::class),
199+
Server::get(AddCleanupBackgroundJobsJob::class),
198200
];
199201

200202
if ($includeExpensive) {

lib/private/Setup.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use OC\AppFramework\Bootstrap\Coordinator;
1717
use OC\Authentication\Token\PublicKeyTokenProvider;
1818
use OC\Authentication\Token\TokenCleanupJob;
19+
use OC\Core\BackgroundJobs\CleanupBackgroundJobsJob;
1920
use OC\Core\BackgroundJobs\ExpirePreviewsJob;
2021
use OC\Core\BackgroundJobs\GenerateMetadataJob;
2122
use OC\Core\BackgroundJobs\PreviewMigrationJob;
@@ -532,6 +533,7 @@ public static function installBackgroundJobs(): void {
532533
$jobList->add(GenerateMetadataJob::class);
533534
$jobList->add(PreviewMigrationJob::class);
534535
$jobList->add(ExpirePreviewsJob::class);
536+
$jobList->add(CleanupBackgroundJobsJob::class);
535537
}
536538

537539
/**

0 commit comments

Comments
 (0)