CronishPlugin.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * GNU social cronish plugin, to imitate cron actions
  4. *
  5. * @category Cron
  6. * @package GNUsocial
  7. * @author Mikael Nordfeldth <mmn@hethane.se>
  8. * @copyright 2013 Free Software Foundation, Inc.
  9. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  10. * @link http://gnu.io/social/
  11. */
  12. if (!defined('GNUSOCIAL')) { exit(1); }
  13. class CronishPlugin extends Plugin {
  14. public function onCronMinutely()
  15. {
  16. common_debug('CRON: Running near-minutely cron job!');
  17. }
  18. public function onCronHourly()
  19. {
  20. common_debug('CRON: Running near-hourly cron job!');
  21. }
  22. public function onCronDaily()
  23. {
  24. common_debug('CRON: Running near-daily cron job!');
  25. }
  26. public function onCronWeekly()
  27. {
  28. common_debug('CRON: Running near-weekly cron job!');
  29. }
  30. /**
  31. * When the page has finished rendering, let's do some cron jobs
  32. * if we have the time.
  33. */
  34. public function onEndActionExecute($status, Action $action)
  35. {
  36. $cron = new Cronish();
  37. $cron->callTimedEvents();
  38. return true;
  39. }
  40. public function onPluginVersion(&$versions)
  41. {
  42. $versions[] = array('name' => 'Cronish',
  43. 'version' => GNUSOCIAL_VERSION,
  44. 'author' => 'Mikael Nordfeldth',
  45. 'homepage' => 'http://www.gnu.org/software/social/',
  46. 'description' =>
  47. // TRANS: Plugin description.
  48. _m('Cronish plugin that executes events on a near-minutely/hour/day/week basis.'));
  49. return true;
  50. }
  51. }