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

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2022-06-14 10:58:24 +02:00
parent d80dad42a3
commit a810b21373
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A
3 changed files with 5 additions and 4 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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');
}