summaryrefslogtreecommitdiffstats
path: root/lib/private/Command
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Command')
-rw-r--r--lib/private/Command/ClosureJob.php5
-rw-r--r--lib/private/Command/CommandJob.php2
-rw-r--r--lib/private/Command/CronBus.php5
3 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/Command/ClosureJob.php b/lib/private/Command/ClosureJob.php
index 498fe6d1d96..5639852e4db 100644
--- a/lib/private/Command/ClosureJob.php
+++ b/lib/private/Command/ClosureJob.php
@@ -23,10 +23,13 @@
namespace OC\Command;
use OC\BackgroundJob\QueuedJob;
+use Laravel\SerializableClosure\SerializableClosure as LaravelClosure;
+use Opis\Closure\SerializableClosure as OpisClosure;
class ClosureJob extends QueuedJob {
protected function run($serializedCallable) {
- $callable = \Opis\Closure\unserialize($serializedCallable);
+ $callable = unserialize($serializedCallable, [LaravelClosure::class, OpisClosure::class]);
+ $callable = $callable->getClosure();
if (is_callable($callable)) {
$callable();
} else {
diff --git a/lib/private/Command/CommandJob.php b/lib/private/Command/CommandJob.php
index 6fa0c6d7ceb..5b267162c81 100644
--- a/lib/private/Command/CommandJob.php
+++ b/lib/private/Command/CommandJob.php
@@ -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 {
diff --git a/lib/private/Command/CronBus.php b/lib/private/Command/CronBus.php
index 89a739617d0..8749ad0bff5 100644
--- a/lib/private/Command/CronBus.php
+++ b/lib/private/Command/CronBus.php
@@ -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');
}