nextcloud/lib/private/command/commandjob.php

27 lines
615 B
PHP
Raw Normal View History

<?php
/**
* Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OC\Command;
use OC\BackgroundJob\QueuedJob;
use OCP\Command\ICommand;
/**
* Wrap a command in the background job interface
*/
class CommandJob extends QueuedJob {
protected function run($serializedCommand) {
$command = unserialize($serializedCommand);
if ($command instanceof ICommand) {
$command->handle();
} else {
throw new \InvalidArgumentException('Invalid serialized command');
}
}
}