summaryrefslogtreecommitdiffstats
path: root/lib/private/command/closurejob.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/command/closurejob.php')
-rw-r--r--lib/private/command/closurejob.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/private/command/closurejob.php b/lib/private/command/closurejob.php
new file mode 100644
index 00000000000..abba120b745
--- /dev/null
+++ b/lib/private/command/closurejob.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+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);
+ if (is_callable($callable)) {
+ $callable();
+ } else {
+ throw new \InvalidArgumentException('Invalid serialized callable');
+ }
+ }
+}