mirror of
https://github.com/nextcloud/server.git
synced 2026-03-21 18:11:02 -04:00
Replace opis/closure with laravel/serializable-closure in code
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
d80dad42a3
commit
a810b21373
3 changed files with 5 additions and 4 deletions
|
|
@ -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…
Reference in a new issue