[3rdparty] Migrate to Opis/Closure

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2020-11-28 14:58:47 +01:00
parent 6f4d3edb5e
commit 04c037ebfd
No known key found for this signature in database
GPG Key ID: F941078878347C0C
4 changed files with 5 additions and 9 deletions

@ -1 +1 @@
Subproject commit 8d7a96cde06a0357ce5805e00773b576d7595ef8
Subproject commit 8f03ccac97331ff781340d76a3f4a49a017d6ae1

View File

@ -23,12 +23,10 @@
namespace OC\Command;
use OC\BackgroundJob\QueuedJob;
use SuperClosure\Serializer;
class ClosureJob extends QueuedJob {
protected function run($serializedCallable) {
$serializer = new Serializer();
$callable = $serializer->unserialize($serializedCallable);
$callable = \Opis\Closure\unserialize($serializedCallable);
if (is_callable($callable)) {
$callable();
} else {

View File

@ -30,7 +30,7 @@ use OCP\Command\ICommand;
*/
class CommandJob extends QueuedJob {
protected function run($serializedCommand) {
$command = unserialize($serializedCommand);
$command = \Opis\Closure\unserialize($serializedCommand);
if ($command instanceof ICommand) {
$command->handle();
} else {

View File

@ -26,7 +26,6 @@
namespace OC\Command;
use OCP\Command\ICommand;
use SuperClosure\Serializer;
class CronBus extends AsyncBus {
/**
@ -68,10 +67,9 @@ class CronBus extends AsyncBus {
*/
private function serializeCommand($command) {
if ($command instanceof \Closure) {
$serializer = new Serializer();
return $serializer->serialize($command);
return \Opis\Closure\serialize($command);
} elseif (is_callable($command) or $command instanceof ICommand) {
return serialize($command);
return \Opis\Closure\serialize($command);
} else {
throw new \InvalidArgumentException('Invalid command');
}