ijob.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * @author Morris Jobke <hey@morrisjobke.de>
  4. * @author Robin Appelman <icewind@owncloud.com>
  5. * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>
  6. *
  7. * @copyright Copyright (c) 2015, ownCloud, Inc.
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OCP\BackgroundJob;
  24. use OCP\ILogger;
  25. /**
  26. * Interface IJob
  27. *
  28. * @package OCP\BackgroundJob
  29. * @since 7.0.0
  30. */
  31. interface IJob {
  32. /**
  33. * Run the background job with the registered argument
  34. *
  35. * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job
  36. * @param ILogger $logger
  37. * @return void
  38. * @since 7.0.0
  39. */
  40. public function execute($jobList, ILogger $logger = null);
  41. /**
  42. * Get the id of the background job
  43. * This id is determined by the job list when a job is added to the list
  44. *
  45. * @return int
  46. * @since 7.0.0
  47. */
  48. public function getId();
  49. /**
  50. * Get the last time this job was run as unix timestamp
  51. *
  52. * @return int
  53. * @since 7.0.0
  54. */
  55. public function getLastRun();
  56. /**
  57. * Get the argument associated with the background job
  58. * This is the argument that will be passed to the background job
  59. *
  60. * @return mixed
  61. * @since 7.0.0
  62. */
  63. public function getArgument();
  64. }