From 222b19b80562638be6241bb1a4029b086ec97c3f Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Thu, 7 Aug 2025 10:57:39 +0200 Subject: [PATCH] feat(taskprocessing): rename cleanup column to allow_cleanup Signed-off-by: Julien Veyssier --- .../Version32000Date20250806110519.php | 6 +++--- core/ResponseDefinitions.php | 2 +- core/openapi-ex_app.json | 4 ++-- core/openapi-full.json | 4 ++-- core/openapi.json | 4 ++-- lib/private/TaskProcessing/Db/Task.php | 16 ++++++++-------- lib/private/TaskProcessing/Db/TaskMapper.php | 8 ++++---- lib/public/TaskProcessing/Task.php | 16 ++++++++-------- openapi.json | 4 ++-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/core/Migrations/Version32000Date20250806110519.php b/core/Migrations/Version32000Date20250806110519.php index fdfaeb7bd30..c498a1cc820 100644 --- a/core/Migrations/Version32000Date20250806110519.php +++ b/core/Migrations/Version32000Date20250806110519.php @@ -19,7 +19,7 @@ use OCP\Migration\SimpleMigrationStep; /** * */ -#[AddColumn(table: 'taskprocessing_tasks', name: 'cleanup', type: ColumnType::SMALLINT)] +#[AddColumn(table: 'taskprocessing_tasks', name: 'allow_cleanup', type: ColumnType::SMALLINT)] class Version32000Date20250806110519 extends SimpleMigrationStep { /** @@ -34,8 +34,8 @@ class Version32000Date20250806110519 extends SimpleMigrationStep { if ($schema->hasTable('taskprocessing_tasks')) { $table = $schema->getTable('taskprocessing_tasks'); - if (!$table->hasColumn('cleanup')) { - $table->addColumn('cleanup', Types::SMALLINT, [ + if (!$table->hasColumn('allow_cleanup')) { + $table->addColumn('allow_cleanup', Types::SMALLINT, [ 'notnull' => true, 'default' => 1, 'unsigned' => true, diff --git a/core/ResponseDefinitions.php b/core/ResponseDefinitions.php index da1d18809e8..1d3992369c6 100644 --- a/core/ResponseDefinitions.php +++ b/core/ResponseDefinitions.php @@ -200,7 +200,7 @@ namespace OC\Core; * scheduledAt: ?int, * startedAt: ?int, * endedAt: ?int, - * cleanup: bool, + * allowCleanup: bool, * } * * @psalm-type CoreProfileAction = array{ diff --git a/core/openapi-ex_app.json b/core/openapi-ex_app.json index 12f5b159dd8..21e349ffbd0 100644 --- a/core/openapi-ex_app.json +++ b/core/openapi-ex_app.json @@ -146,7 +146,7 @@ "scheduledAt", "startedAt", "endedAt", - "cleanup" + "allowCleanup" ], "properties": { "id": { @@ -218,7 +218,7 @@ "format": "int64", "nullable": true }, - "cleanup": { + "allowCleanup": { "type": "boolean" } } diff --git a/core/openapi-full.json b/core/openapi-full.json index 4b292addab0..fd606e01966 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -640,7 +640,7 @@ "scheduledAt", "startedAt", "endedAt", - "cleanup" + "allowCleanup" ], "properties": { "id": { @@ -712,7 +712,7 @@ "format": "int64", "nullable": true }, - "cleanup": { + "allowCleanup": { "type": "boolean" } } diff --git a/core/openapi.json b/core/openapi.json index d609488891d..c5b9263e393 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -640,7 +640,7 @@ "scheduledAt", "startedAt", "endedAt", - "cleanup" + "allowCleanup" ], "properties": { "id": { @@ -712,7 +712,7 @@ "format": "int64", "nullable": true }, - "cleanup": { + "allowCleanup": { "type": "boolean" } } diff --git a/lib/private/TaskProcessing/Db/Task.php b/lib/private/TaskProcessing/Db/Task.php index 14b8ead2756..11f90c133ed 100644 --- a/lib/private/TaskProcessing/Db/Task.php +++ b/lib/private/TaskProcessing/Db/Task.php @@ -45,8 +45,8 @@ use OCP\TaskProcessing\Task as OCPTask; * @method int getStartedAt() * @method setEndedAt(int $endedAt) * @method int getEndedAt() - * @method setCleanup(int $cleanup) - * @method int getCleanup() + * @method setAllowCleanup(int $allowCleanup) + * @method int getAllowCleanup() */ class Task extends Entity { protected $lastUpdated; @@ -65,17 +65,17 @@ class Task extends Entity { protected $scheduledAt; protected $startedAt; protected $endedAt; - protected $cleanup; + protected $allowCleanup; /** * @var string[] */ - public static array $columns = ['id', 'last_updated', 'type', 'input', 'output', 'status', 'user_id', 'app_id', 'custom_id', 'completion_expected_at', 'error_message', 'progress', 'webhook_uri', 'webhook_method', 'scheduled_at', 'started_at', 'ended_at', 'cleanup']; + public static array $columns = ['id', 'last_updated', 'type', 'input', 'output', 'status', 'user_id', 'app_id', 'custom_id', 'completion_expected_at', 'error_message', 'progress', 'webhook_uri', 'webhook_method', 'scheduled_at', 'started_at', 'ended_at', 'allow_cleanup']; /** * @var string[] */ - public static array $fields = ['id', 'lastUpdated', 'type', 'input', 'output', 'status', 'userId', 'appId', 'customId', 'completionExpectedAt', 'errorMessage', 'progress', 'webhookUri', 'webhookMethod', 'scheduledAt', 'startedAt', 'endedAt', 'cleanup']; + public static array $fields = ['id', 'lastUpdated', 'type', 'input', 'output', 'status', 'userId', 'appId', 'customId', 'completionExpectedAt', 'errorMessage', 'progress', 'webhookUri', 'webhookMethod', 'scheduledAt', 'startedAt', 'endedAt', 'allowCleanup']; public function __construct() { @@ -97,7 +97,7 @@ class Task extends Entity { $this->addType('scheduledAt', 'integer'); $this->addType('startedAt', 'integer'); $this->addType('endedAt', 'integer'); - $this->addType('cleanup', 'integer'); + $this->addType('allowCleanup', 'integer'); } public function toRow(): array { @@ -126,7 +126,7 @@ class Task extends Entity { 'scheduledAt' => $task->getScheduledAt(), 'startedAt' => $task->getStartedAt(), 'endedAt' => $task->getEndedAt(), - 'cleanup' => $task->getCleanup(), + 'allowCleanup' => $task->getAllowCleanup(), ]); return $taskEntity; } @@ -149,7 +149,7 @@ class Task extends Entity { $task->setScheduledAt($this->getScheduledAt()); $task->setStartedAt($this->getStartedAt()); $task->setEndedAt($this->getEndedAt()); - $task->setCleanup($this->getCleanup() !== 0); + $task->setAllowCleanup($this->getAllowCleanup() !== 0); return $task; } } diff --git a/lib/private/TaskProcessing/Db/TaskMapper.php b/lib/private/TaskProcessing/Db/TaskMapper.php index c95f4dd4335..fee96534633 100644 --- a/lib/private/TaskProcessing/Db/TaskMapper.php +++ b/lib/private/TaskProcessing/Db/TaskMapper.php @@ -183,7 +183,7 @@ class TaskMapper extends QBMapper { /** * @param int $timeout - * @param bool $force If true, ignore the cleanup flag + * @param bool $force If true, ignore the allow_cleanup flag * @return int the number of deleted tasks * @throws Exception */ @@ -192,14 +192,14 @@ class TaskMapper extends QBMapper { $qb->delete($this->tableName) ->where($qb->expr()->lt('last_updated', $qb->createPositionalParameter($this->timeFactory->getDateTime()->getTimestamp() - $timeout))); if (!$force) { - $qb->andWhere($qb->expr()->eq('cleanup', $qb->createPositionalParameter(1, IQueryBuilder::PARAM_INT))); + $qb->andWhere($qb->expr()->eq('allow_cleanup', $qb->createPositionalParameter(1, IQueryBuilder::PARAM_INT))); } return $qb->executeStatement(); } /** * @param int $timeout - * @param bool $force If true, ignore the cleanup flag + * @param bool $force If true, ignore the allow_cleanup flag * @return \Generator * @throws Exception */ @@ -209,7 +209,7 @@ class TaskMapper extends QBMapper { ->from($this->tableName) ->where($qb->expr()->lt('last_updated', $qb->createPositionalParameter($this->timeFactory->getDateTime()->getTimestamp() - $timeout))); if (!$force) { - $qb->andWhere($qb->expr()->eq('cleanup', $qb->createPositionalParameter(1, IQueryBuilder::PARAM_INT))); + $qb->andWhere($qb->expr()->eq('allow_cleanup', $qb->createPositionalParameter(1, IQueryBuilder::PARAM_INT))); } foreach ($this->yieldEntities($qb) as $entity) { yield $entity; diff --git a/lib/public/TaskProcessing/Task.php b/lib/public/TaskProcessing/Task.php index be3e8f84790..06dc84d59ff 100644 --- a/lib/public/TaskProcessing/Task.php +++ b/lib/public/TaskProcessing/Task.php @@ -66,7 +66,7 @@ final class Task implements \JsonSerializable { protected ?int $scheduledAt = null; protected ?int $startedAt = null; protected ?int $endedAt = null; - protected bool $cleanup = true; + protected bool $allowCleanup = true; /** * @param string $taskTypeId @@ -257,20 +257,20 @@ final class Task implements \JsonSerializable { * @return bool * @since 32.0.0 */ - final public function getCleanup(): bool { - return $this->cleanup; + final public function getAllowCleanup(): bool { + return $this->allowCleanup; } /** - * @param bool $cleanup + * @param bool $allowCleanup * @since 32.0.0 */ - final public function setCleanup(bool $cleanup): void { - $this->cleanup = $cleanup; + final public function setAllowCleanup(bool $allowCleanup): void { + $this->allowCleanup = $allowCleanup; } /** - * @psalm-return array{id: int, lastUpdated: int, type: string, status: 'STATUS_CANCELLED'|'STATUS_FAILED'|'STATUS_SUCCESSFUL'|'STATUS_RUNNING'|'STATUS_SCHEDULED'|'STATUS_UNKNOWN', userId: ?string, appId: string, input: array|numeric|string>, output: ?array|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float, scheduledAt: ?int, startedAt: ?int, endedAt: ?int, cleanup: bool} + * @psalm-return array{id: int, lastUpdated: int, type: string, status: 'STATUS_CANCELLED'|'STATUS_FAILED'|'STATUS_SUCCESSFUL'|'STATUS_RUNNING'|'STATUS_SCHEDULED'|'STATUS_UNKNOWN', userId: ?string, appId: string, input: array|numeric|string>, output: ?array|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float, scheduledAt: ?int, startedAt: ?int, endedAt: ?int, allowCleanup: bool} * @since 30.0.0 */ final public function jsonSerialize(): array { @@ -289,7 +289,7 @@ final class Task implements \JsonSerializable { 'scheduledAt' => $this->getScheduledAt(), 'startedAt' => $this->getStartedAt(), 'endedAt' => $this->getEndedAt(), - 'cleanup' => $this->getCleanup(), + 'allowCleanup' => $this->getAllowCleanup(), ]; } diff --git a/openapi.json b/openapi.json index 1cec4340b99..af0c627d39f 100644 --- a/openapi.json +++ b/openapi.json @@ -678,7 +678,7 @@ "scheduledAt", "startedAt", "endedAt", - "cleanup" + "allowCleanup" ], "properties": { "id": { @@ -750,7 +750,7 @@ "format": "int64", "nullable": true }, - "cleanup": { + "allowCleanup": { "type": "boolean" } }