diff options
author | Marcel Klehr <mklehr@gmx.net> | 2024-05-15 09:30:05 +0200 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2024-05-15 09:30:05 +0200 |
commit | 6c4992de54d7ce78ff19f588d403162b0c8f580a (patch) | |
tree | 2152ffef3a6b50cc4945143d10ffd56b128a360b /lib/public | |
parent | cac812dc580079f2772623641ba70985714ad7b2 (diff) | |
download | nextcloud-server-6c4992de54d7ce78ff19f588d403162b0c8f580a.tar.gz nextcloud-server-6c4992de54d7ce78ff19f588d403162b0c8f580a.zip |
fix: expose lastUpdated in OCS API
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/TaskProcessing/Task.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/public/TaskProcessing/Task.php b/lib/public/TaskProcessing/Task.php index b6aa6376279..ee00446865e 100644 --- a/lib/public/TaskProcessing/Task.php +++ b/lib/public/TaskProcessing/Task.php @@ -44,6 +44,8 @@ final class Task implements \JsonSerializable { protected ?float $progress = null; + protected int $lastUpdated; + /** * @since 30.0.0 */ @@ -89,6 +91,7 @@ final class Task implements \JsonSerializable { protected readonly ?string $userId, protected readonly ?string $customId = '', ) { + $this->lastUpdated = time(); } /** @@ -195,13 +198,30 @@ final class Task implements \JsonSerializable { } /** - * @psalm-return array{id: ?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 + * @since 30.0.0 + */ + final public function getLastUpdated(): int { + return $this->lastUpdated; + } + + /** + * @param int $lastUpdated + * @since 30.0.0 + */ + final public function setLastUpdated(int $lastUpdated): void { + $this->lastUpdated = $lastUpdated; + } + + /** + * @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} * @since 30.0.0 */ final public function jsonSerialize(): array { return [ 'id' => $this->getId(), 'type' => $this->getTaskTypeId(), + 'lastUpdated' => $this->getLastUpdated(), 'status' => self::statusToString($this->getStatus()), 'userId' => $this->getUserId(), 'appId' => $this->getAppId(), |