2015-02-17 10:49:14 -05:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2015-02-17 10:49:14 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-02-17 10:49:14 -05:00
|
|
|
*/
|
|
|
|
|
namespace OC\Command;
|
|
|
|
|
|
2024-02-08 05:52:40 -05:00
|
|
|
use OCP\BackgroundJob\QueuedJob;
|
2015-02-17 10:49:14 -05:00
|
|
|
use OCP\Command\ICommand;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Wrap a command in the background job interface
|
|
|
|
|
*/
|
|
|
|
|
class CommandJob extends QueuedJob {
|
2023-09-30 16:46:32 -04:00
|
|
|
protected function run($argument) {
|
2025-10-14 07:56:42 -04:00
|
|
|
$command = unserialize($argument, ['allowed_classes' => [
|
|
|
|
|
\Test\Command\SimpleCommand::class,
|
|
|
|
|
\Test\Command\StateFullCommand::class,
|
|
|
|
|
\Test\Command\FilesystemCommand::class,
|
|
|
|
|
\OCA\Files_Trashbin\Command\Expire::class,
|
|
|
|
|
\OCA\Files_Versions\Command\Expire::class,
|
|
|
|
|
]]);
|
2015-02-17 10:49:14 -05:00
|
|
|
if ($command instanceof ICommand) {
|
|
|
|
|
$command->handle();
|
|
|
|
|
} else {
|
|
|
|
|
throw new \InvalidArgumentException('Invalid serialized command');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|