Skip to content

Commit 47ffee2

Browse files
committed
feat(taskprocessing): rename cleanup column to allow_cleanup
Signed-off-by: Julien Veyssier <[email protected]>
1 parent fa673f9 commit 47ffee2

File tree

9 files changed

+32
-32
lines changed

9 files changed

+32
-32
lines changed

core/Migrations/Version32000Date20250806110519.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
*
2121
*/
22-
#[AddColumn(table: 'taskprocessing_tasks', name: 'cleanup', type: ColumnType::SMALLINT)]
22+
#[AddColumn(table: 'taskprocessing_tasks', name: 'allow_cleanup', type: ColumnType::SMALLINT)]
2323
class Version32000Date20250806110519 extends SimpleMigrationStep {
2424

2525
/**
@@ -34,8 +34,8 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3434

3535
if ($schema->hasTable('taskprocessing_tasks')) {
3636
$table = $schema->getTable('taskprocessing_tasks');
37-
if (!$table->hasColumn('cleanup')) {
38-
$table->addColumn('cleanup', Types::SMALLINT, [
37+
if (!$table->hasColumn('allow_cleanup')) {
38+
$table->addColumn('allow_cleanup', Types::SMALLINT, [
3939
'notnull' => true,
4040
'default' => 1,
4141
'unsigned' => true,

core/ResponseDefinitions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
* scheduledAt: ?int,
201201
* startedAt: ?int,
202202
* endedAt: ?int,
203-
* cleanup: bool,
203+
* allowCleanup: bool,
204204
* }
205205
*
206206
* @psalm-type CoreProfileAction = array{

core/openapi-ex_app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"scheduledAt",
147147
"startedAt",
148148
"endedAt",
149-
"cleanup"
149+
"allowCleanup"
150150
],
151151
"properties": {
152152
"id": {
@@ -218,7 +218,7 @@
218218
"format": "int64",
219219
"nullable": true
220220
},
221-
"cleanup": {
221+
"allowCleanup": {
222222
"type": "boolean"
223223
}
224224
}

core/openapi-full.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@
640640
"scheduledAt",
641641
"startedAt",
642642
"endedAt",
643-
"cleanup"
643+
"allowCleanup"
644644
],
645645
"properties": {
646646
"id": {
@@ -712,7 +712,7 @@
712712
"format": "int64",
713713
"nullable": true
714714
},
715-
"cleanup": {
715+
"allowCleanup": {
716716
"type": "boolean"
717717
}
718718
}

core/openapi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@
640640
"scheduledAt",
641641
"startedAt",
642642
"endedAt",
643-
"cleanup"
643+
"allowCleanup"
644644
],
645645
"properties": {
646646
"id": {
@@ -712,7 +712,7 @@
712712
"format": "int64",
713713
"nullable": true
714714
},
715-
"cleanup": {
715+
"allowCleanup": {
716716
"type": "boolean"
717717
}
718718
}

lib/private/TaskProcessing/Db/Task.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
* @method int getStartedAt()
4646
* @method setEndedAt(int $endedAt)
4747
* @method int getEndedAt()
48-
* @method setCleanup(int $cleanup)
49-
* @method int getCleanup()
48+
* @method setAllowCleanup(int $allowCleanup)
49+
* @method int getAllowCleanup()
5050
*/
5151
class Task extends Entity {
5252
protected $lastUpdated;
@@ -65,17 +65,17 @@ class Task extends Entity {
6565
protected $scheduledAt;
6666
protected $startedAt;
6767
protected $endedAt;
68-
protected $cleanup;
68+
protected $allowCleanup;
6969

7070
/**
7171
* @var string[]
7272
*/
73-
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'];
73+
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'];
7474

7575
/**
7676
* @var string[]
7777
*/
78-
public static array $fields = ['id', 'lastUpdated', 'type', 'input', 'output', 'status', 'userId', 'appId', 'customId', 'completionExpectedAt', 'errorMessage', 'progress', 'webhookUri', 'webhookMethod', 'scheduledAt', 'startedAt', 'endedAt', 'cleanup'];
78+
public static array $fields = ['id', 'lastUpdated', 'type', 'input', 'output', 'status', 'userId', 'appId', 'customId', 'completionExpectedAt', 'errorMessage', 'progress', 'webhookUri', 'webhookMethod', 'scheduledAt', 'startedAt', 'endedAt', 'allowCleanup'];
7979

8080

8181
public function __construct() {
@@ -97,7 +97,7 @@ public function __construct() {
9797
$this->addType('scheduledAt', 'integer');
9898
$this->addType('startedAt', 'integer');
9999
$this->addType('endedAt', 'integer');
100-
$this->addType('cleanup', 'integer');
100+
$this->addType('allowCleanup', 'integer');
101101
}
102102

103103
public function toRow(): array {
@@ -126,7 +126,7 @@ public static function fromPublicTask(OCPTask $task): self {
126126
'scheduledAt' => $task->getScheduledAt(),
127127
'startedAt' => $task->getStartedAt(),
128128
'endedAt' => $task->getEndedAt(),
129-
'cleanup' => $task->getCleanup(),
129+
'allowCleanup' => $task->getAllowCleanup(),
130130
]);
131131
return $taskEntity;
132132
}
@@ -149,7 +149,7 @@ public function toPublicTask(): OCPTask {
149149
$task->setScheduledAt($this->getScheduledAt());
150150
$task->setStartedAt($this->getStartedAt());
151151
$task->setEndedAt($this->getEndedAt());
152-
$task->setCleanup($this->getCleanup() !== 0);
152+
$task->setAllowCleanup($this->getAllowCleanup() !== 0);
153153
return $task;
154154
}
155155
}

lib/private/TaskProcessing/Db/TaskMapper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function findTasks(
183183

184184
/**
185185
* @param int $timeout
186-
* @param bool $force If true, ignore the cleanup flag
186+
* @param bool $force If true, ignore the allow_cleanup flag
187187
* @return int the number of deleted tasks
188188
* @throws Exception
189189
*/
@@ -192,14 +192,14 @@ public function deleteOlderThan(int $timeout, bool $force = false): int {
192192
$qb->delete($this->tableName)
193193
->where($qb->expr()->lt('last_updated', $qb->createPositionalParameter($this->timeFactory->getDateTime()->getTimestamp() - $timeout)));
194194
if (!$force) {
195-
$qb->andWhere($qb->expr()->eq('cleanup', $qb->createPositionalParameter(1, IQueryBuilder::PARAM_INT)));
195+
$qb->andWhere($qb->expr()->eq('allow_cleanup', $qb->createPositionalParameter(1, IQueryBuilder::PARAM_INT)));
196196
}
197197
return $qb->executeStatement();
198198
}
199199

200200
/**
201201
* @param int $timeout
202-
* @param bool $force If true, ignore the cleanup flag
202+
* @param bool $force If true, ignore the allow_cleanup flag
203203
* @return \Generator<Task>
204204
* @throws Exception
205205
*/
@@ -209,7 +209,7 @@ public function getTasksToCleanup(int $timeout, bool $force = false): \Generator
209209
->from($this->tableName)
210210
->where($qb->expr()->lt('last_updated', $qb->createPositionalParameter($this->timeFactory->getDateTime()->getTimestamp() - $timeout)));
211211
if (!$force) {
212-
$qb->andWhere($qb->expr()->eq('cleanup', $qb->createPositionalParameter(1, IQueryBuilder::PARAM_INT)));
212+
$qb->andWhere($qb->expr()->eq('allow_cleanup', $qb->createPositionalParameter(1, IQueryBuilder::PARAM_INT)));
213213
}
214214
foreach ($this->yieldEntities($qb) as $entity) {
215215
yield $entity;

lib/public/TaskProcessing/Task.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ final class Task implements \JsonSerializable {
6666
protected ?int $scheduledAt = null;
6767
protected ?int $startedAt = null;
6868
protected ?int $endedAt = null;
69-
protected bool $cleanup = true;
69+
protected bool $allowCleanup = true;
7070

7171
/**
7272
* @param string $taskTypeId
@@ -257,20 +257,20 @@ final public function setEndedAt(?int $endedAt): void {
257257
* @return bool
258258
* @since 32.0.0
259259
*/
260-
final public function getCleanup(): bool {
261-
return $this->cleanup;
260+
final public function getAllowCleanup(): bool {
261+
return $this->allowCleanup;
262262
}
263263

264264
/**
265-
* @param bool $cleanup
265+
* @param bool $allowCleanup
266266
* @since 32.0.0
267267
*/
268-
final public function setCleanup(bool $cleanup): void {
269-
$this->cleanup = $cleanup;
268+
final public function setAllowCleanup(bool $allowCleanup): void {
269+
$this->allowCleanup = $allowCleanup;
270270
}
271271

272272
/**
273-
* @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<string, list<numeric|string>|numeric|string>, output: ?array<string, list<numeric|string>|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float, scheduledAt: ?int, startedAt: ?int, endedAt: ?int, cleanup: bool}
273+
* @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<string, list<numeric|string>|numeric|string>, output: ?array<string, list<numeric|string>|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float, scheduledAt: ?int, startedAt: ?int, endedAt: ?int, allowCleanup: bool}
274274
* @since 30.0.0
275275
*/
276276
final public function jsonSerialize(): array {
@@ -289,7 +289,7 @@ final public function jsonSerialize(): array {
289289
'scheduledAt' => $this->getScheduledAt(),
290290
'startedAt' => $this->getStartedAt(),
291291
'endedAt' => $this->getEndedAt(),
292-
'cleanup' => $this->getCleanup(),
292+
'allowCleanup' => $this->getAllowCleanup(),
293293
];
294294
}
295295

openapi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@
678678
"scheduledAt",
679679
"startedAt",
680680
"endedAt",
681-
"cleanup"
681+
"allowCleanup"
682682
],
683683
"properties": {
684684
"id": {
@@ -750,7 +750,7 @@
750750
"format": "int64",
751751
"nullable": true
752752
},
753-
"cleanup": {
753+
"allowCleanup": {
754754
"type": "boolean"
755755
}
756756
}

0 commit comments

Comments
 (0)