]> source.dussan.org Git - nextcloud-server.git/commitdiff
Replace opis/closure with laravel/serializable-closure in code
authorCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 14 Jun 2022 08:58:24 +0000 (10:58 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 14 Jun 2022 08:58:24 +0000 (10:58 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
lib/private/Command/ClosureJob.php
lib/private/Command/CommandJob.php
lib/private/Command/CronBus.php

index 498fe6d1d96314c086ba733ccddcbc0bdff5a0cf..96b0947129e23bba06295c266e9b47182f187aa4 100644 (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 {
index 6fa0c6d7ceb485a126a267866ca4e5f4d36078e8..5b267162c81a179a59cc502cc15ab8c041340906 100644 (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 {
index 89a739617d0aa936607dea17fb8fe5903f7db910..8749ad0bff598ef55ebcd13adc83897f757574d1 100644 (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');
                }