2015-02-17 10:49:14 -05:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2015-02-17 10:49:14 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-02-17 10:49:14 -05:00
|
|
|
*/
|
|
|
|
|
namespace OC\Command;
|
|
|
|
|
|
2022-06-21 05:33:46 -04:00
|
|
|
use Laravel\SerializableClosure\SerializableClosure as LaravelClosure;
|
2024-02-08 05:52:40 -05:00
|
|
|
use OCP\BackgroundJob\QueuedJob;
|
2015-02-17 10:49:14 -05:00
|
|
|
|
|
|
|
|
class ClosureJob extends QueuedJob {
|
2023-09-30 16:46:32 -04:00
|
|
|
protected function run($argument) {
|
|
|
|
|
$callable = unserialize($argument, [LaravelClosure::class]);
|
2022-06-21 05:33:46 -04:00
|
|
|
$callable = $callable->getClosure();
|
2015-02-17 10:49:14 -05:00
|
|
|
if (is_callable($callable)) {
|
|
|
|
|
$callable();
|
|
|
|
|
} else {
|
|
|
|
|
throw new \InvalidArgumentException('Invalid serialized callable');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|