aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/TaskProcessing/Task.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/TaskProcessing/Task.php')
-rw-r--r--lib/public/TaskProcessing/Task.php114
1 files changed, 112 insertions, 2 deletions
diff --git a/lib/public/TaskProcessing/Task.php b/lib/public/TaskProcessing/Task.php
index 2ec367e4a0a..06dc84d59ff 100644
--- a/lib/public/TaskProcessing/Task.php
+++ b/lib/public/TaskProcessing/Task.php
@@ -30,6 +30,9 @@ final class Task implements \JsonSerializable {
protected int $lastUpdated;
+ protected ?string $webhookUri = null;
+ protected ?string $webhookMethod = null;
+
/**
* @since 30.0.0
*/
@@ -60,6 +63,11 @@ final class Task implements \JsonSerializable {
*/
protected int $status = self::STATUS_UNKNOWN;
+ protected ?int $scheduledAt = null;
+ protected ?int $startedAt = null;
+ protected ?int $endedAt = null;
+ protected bool $allowCleanup = true;
+
/**
* @param string $taskTypeId
* @param array<string,list<numeric|string>|numeric|string> $input
@@ -198,12 +206,76 @@ final class Task implements \JsonSerializable {
}
/**
- * @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<array-key, list<numeric|string>|numeric|string>, output: ?array<array-key, list<numeric|string>|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float}
+ * @return int|null
+ * @since 30.0.0
+ */
+ final public function getScheduledAt(): ?int {
+ return $this->scheduledAt;
+ }
+
+ /**
+ * @param int|null $scheduledAt
+ * @since 30.0.0
+ */
+ final public function setScheduledAt(?int $scheduledAt): void {
+ $this->scheduledAt = $scheduledAt;
+ }
+
+ /**
+ * @return int|null
+ * @since 30.0.0
+ */
+ final public function getStartedAt(): ?int {
+ return $this->startedAt;
+ }
+
+ /**
+ * @param int|null $startedAt
+ * @since 30.0.0
+ */
+ final public function setStartedAt(?int $startedAt): void {
+ $this->startedAt = $startedAt;
+ }
+
+ /**
+ * @return int|null
+ * @since 30.0.0
+ */
+ final public function getEndedAt(): ?int {
+ return $this->endedAt;
+ }
+
+ /**
+ * @param int|null $endedAt
+ * @since 30.0.0
+ */
+ final public function setEndedAt(?int $endedAt): void {
+ $this->endedAt = $endedAt;
+ }
+
+ /**
+ * @return bool
+ * @since 32.0.0
+ */
+ final public function getAllowCleanup(): bool {
+ return $this->allowCleanup;
+ }
+
+ /**
+ * @param bool $allowCleanup
+ * @since 32.0.0
+ */
+ 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<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}
* @since 30.0.0
*/
final public function jsonSerialize(): array {
return [
- 'id' => $this->getId(),
+ 'id' => (int)$this->getId(),
'type' => $this->getTaskTypeId(),
'lastUpdated' => $this->getLastUpdated(),
'status' => self::statusToString($this->getStatus()),
@@ -214,6 +286,10 @@ final class Task implements \JsonSerializable {
'customId' => $this->getCustomId(),
'completionExpectedAt' => $this->getCompletionExpectedAt()?->getTimestamp(),
'progress' => $this->getProgress(),
+ 'scheduledAt' => $this->getScheduledAt(),
+ 'startedAt' => $this->getStartedAt(),
+ 'endedAt' => $this->getEndedAt(),
+ 'allowCleanup' => $this->getAllowCleanup(),
];
}
@@ -265,6 +341,40 @@ final class Task implements \JsonSerializable {
}
/**
+ * @return null|string
+ * @since 30.0.0
+ */
+ final public function getWebhookUri(): ?string {
+ return $this->webhookUri;
+ }
+
+ /**
+ * @param string|null $webhookUri
+ * @return void
+ * @since 30.0.0
+ */
+ final public function setWebhookUri(?string $webhookUri): void {
+ $this->webhookUri = $webhookUri;
+ }
+
+ /**
+ * @return null|string
+ * @since 30.0.0
+ */
+ final public function getWebhookMethod(): ?string {
+ return $this->webhookMethod;
+ }
+
+ /**
+ * @param string|null $webhookMethod
+ * @return void
+ * @since 30.0.0
+ */
+ final public function setWebhookMethod(?string $webhookMethod): void {
+ $this->webhookMethod = $webhookMethod;
+ }
+
+ /**
* @param int $status
* @return 'STATUS_CANCELLED'|'STATUS_FAILED'|'STATUS_SUCCESSFUL'|'STATUS_RUNNING'|'STATUS_SCHEDULED'|'STATUS_UNKNOWN'
* @since 30.0.0