CallableJob.php 512 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\Command;
  8. use OCP\BackgroundJob\QueuedJob;
  9. class CallableJob extends QueuedJob {
  10. protected function run($serializedCallable) {
  11. $callable = unserialize($serializedCallable);
  12. if (is_callable($callable)) {
  13. $callable();
  14. } else {
  15. throw new \InvalidArgumentException('Invalid serialized callable');
  16. }
  17. }
  18. }