Replace opis/closure with laravel/serializable-closure in code

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/32868/head
Côme Chilliet 4 years ago
parent d80dad42a3
commit a810b21373
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
  1. 2
      lib/private/Command/ClosureJob.php
  2. 2
      lib/private/Command/CommandJob.php
  3. 5
      lib/private/Command/CronBus.php

@ -26,7 +26,7 @@ use OC\BackgroundJob\QueuedJob;
class ClosureJob extends QueuedJob {
protected function run($serializedCallable) {
$callable = \Opis\Closure\unserialize($serializedCallable);
$callable = unserialize($serializedCallable)->getClosure();
if (is_callable($callable)) {
$callable();
} else {

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

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

Loading…
Cancel
Save