diff --git a/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php b/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php index 62918dbae5f..fb159bdfb9c 100644 --- a/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php +++ b/lib/private/Repair/AddRemoveOldTasksBackgroundJob.php @@ -25,9 +25,9 @@ declare(strict_types=1); */ namespace OC\Repair; +use OC\TaskProcessing\RemoveOldTasksBackgroundJob; use OC\TextProcessing\RemoveOldTasksBackgroundJob as RemoveOldTextProcessingTasksBackgroundJob; use OC\TextToImage\RemoveOldTasksBackgroundJob as RemoveOldTextToImageTasksBackgroundJob; -use OC\TaskProcessing\RemoveOldTasksBackgroundJob; use OCP\BackgroundJob\IJobList; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; diff --git a/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php b/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php index 76786412059..54b63ac42fb 100644 --- a/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php @@ -4,18 +4,7 @@ namespace OC\TaskProcessing; use OC\TaskProcessing\Db\TaskMapper; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJobList; -use OCP\BackgroundJob\QueuedJob; use OCP\BackgroundJob\TimedJob; -use OCP\Files\GenericFileException; -use OCP\Files\NotPermittedException; -use OCP\Lock\LockedException; -use OCP\TaskProcessing\Exception\Exception; -use OCP\TaskProcessing\Exception\NotFoundException; -use OCP\TaskProcessing\Exception\ProcessingException; -use OCP\TaskProcessing\Exception\ValidationException; -use OCP\TaskProcessing\IManager; -use OCP\TaskProcessing\ISynchronousProvider; use Psr\Log\LoggerInterface; class RemoveOldTasksBackgroundJob extends TimedJob { diff --git a/lib/public/TaskProcessing/ShapeDescriptor.php b/lib/public/TaskProcessing/ShapeDescriptor.php index 58d4b5d8e7f..c84a638862d 100644 --- a/lib/public/TaskProcessing/ShapeDescriptor.php +++ b/lib/public/TaskProcessing/ShapeDescriptor.php @@ -6,7 +6,7 @@ namespace OCP\TaskProcessing; * Data object for input output shape entries * @since 30.0.0 */ -class ShapeDescriptor { +class ShapeDescriptor implements \JsonSerializable { /** * @param string $name * @param string $description @@ -43,4 +43,15 @@ class ShapeDescriptor { public function getShapeType(): EShapeType { return $this->shapeType; } + + /** + * @return array{name: string, description: string, type: int} + */ + public function jsonSerialize(): array { + return [ + 'name' => $this->getName(), + 'description' => $this->getDescription(), + 'type' => $this->getShapeType()->value, + ]; + } } diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index e1ddaf82500..ddf64f23173 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -466,8 +466,8 @@ class TaskProcessingTest extends \Test\TestCase { public function testOldTasksShouldBeCleanedUp() { $currentTime = new \DateTime('now'); $timeFactory = $this->createMock(ITimeFactory::class); - $timeFactory->expects($this->any())->method('getDateTime')->willReturnCallback(fn() => $currentTime); - $timeFactory->expects($this->any())->method('getTime')->willReturnCallback(fn() => $currentTime->getTimestamp()); + $timeFactory->expects($this->any())->method('getDateTime')->willReturnCallback(fn () => $currentTime); + $timeFactory->expects($this->any())->method('getTime')->willReturnCallback(fn () => $currentTime->getTimestamp()); $this->taskMapper = new TaskMapper( \OCP\Server::get(IDBConnection::class),