Skip to content

Commit

Permalink
Replace jeremeamia/superclosure with opis/closure
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Apr 11, 2020
1 parent cb28395 commit 6a7bf2f
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 175 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/37238
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Change: Replace jeremeamia/superclosure with opis/closure

jeremeamia/superclosure library is no longer maintained.
Replace it with the recommended opis/closure library.

https://github.com/owncloud/core/pull/37238
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"php": ">=7.1",
"doctrine/dbal": "^2.8",
"phpseclib/phpseclib": "^2.0",
"jeremeamia/superclosure": "^2.4",
"opis/closure": "^3.5",
"bantu/ini-get-wrapper": "v1.0.1",
"punic/punic": "^3.1",
"pear/archive_tar": "1.4.9",
Expand Down
230 changes: 62 additions & 168 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions lib/private/Command/AsyncBus.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

use OCP\Command\IBus;
use OCP\Command\ICommand;
use SuperClosure\Serializer;
use Opis\Closure\SerializableClosure;

/**
* Asynchronous command bus that uses the background job system as backend
Expand Down Expand Up @@ -103,8 +103,7 @@ private function getJobClass($command) {
*/
private function serializeCommand($command) {
if ($command instanceof \Closure) {
$serializer = new Serializer();
return $serializer->serialize($command);
return \serialize(new SerializableClosure($command));
} elseif (\is_callable($command) or $command instanceof ICommand) {
return \serialize($command);
} else {
Expand Down
5 changes: 2 additions & 3 deletions lib/private/Command/ClosureJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
namespace OC\Command;

use OC\BackgroundJob\QueuedJob;
use SuperClosure\Serializer;

class ClosureJob extends QueuedJob {
protected function run($serializedCallable) {
$serializer = new Serializer();
$callable = $serializer->unserialize($serializedCallable);
$serializedClosure = \unserialize($serializedCallable);
$callable = $serializedClosure->getClosure();
if (\is_callable($callable)) {
$callable();
} else {
Expand Down

0 comments on commit 6a7bf2f

Please sign in to comment.