2013-11-20 20:20:42 +00:00
|
|
|
<?php
|
2013-11-20 22:03:40 +00:00
|
|
|
/**
|
|
|
|
* GNU social cronish plugin, to imitate cron actions
|
|
|
|
*
|
|
|
|
* @category Cron
|
|
|
|
* @package GNUsocial
|
|
|
|
* @author Mikael Nordfeldth <mmn@hethane.se>
|
|
|
|
* @copyright 2013 Free Software Foundation, Inc.
|
|
|
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
2014-07-21 08:51:28 +01:00
|
|
|
* @link http://gnu.io/social/
|
2013-11-20 22:03:40 +00:00
|
|
|
*/
|
2013-11-20 20:20:42 +00:00
|
|
|
|
2014-07-21 08:51:28 +01:00
|
|
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
|
|
|
|
2013-11-20 20:20:42 +00:00
|
|
|
class CronishPlugin extends Plugin {
|
2013-11-20 22:03:40 +00:00
|
|
|
public function onCronMinutely()
|
|
|
|
{
|
2014-07-21 08:51:28 +01:00
|
|
|
common_debug('CRON: Running near-minutely cron job!');
|
2013-11-20 22:03:40 +00:00
|
|
|
}
|
|
|
|
|
2013-11-20 20:20:42 +00:00
|
|
|
public function onCronHourly()
|
|
|
|
{
|
2014-07-21 08:51:28 +01:00
|
|
|
common_debug('CRON: Running near-hourly cron job!');
|
2013-11-20 20:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function onCronDaily()
|
|
|
|
{
|
2014-07-21 08:51:28 +01:00
|
|
|
common_debug('CRON: Running near-daily cron job!');
|
2013-11-20 20:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function onCronWeekly()
|
|
|
|
{
|
2014-07-21 08:51:28 +01:00
|
|
|
common_debug('CRON: Running near-weekly cron job!');
|
2013-11-20 20:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When the page has finished rendering, let's do some cron jobs
|
|
|
|
* if we have the time.
|
|
|
|
*/
|
2015-02-27 11:11:43 +00:00
|
|
|
public function onEndActionExecute(Action $action)
|
2013-11-20 20:20:42 +00:00
|
|
|
{
|
|
|
|
$cron = new Cronish();
|
|
|
|
$cron->callTimedEvents();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-06 21:04:01 +01:00
|
|
|
public function onPluginVersion(array &$versions)
|
2013-11-20 20:20:42 +00:00
|
|
|
{
|
|
|
|
$versions[] = array('name' => 'Cronish',
|
|
|
|
'version' => GNUSOCIAL_VERSION,
|
|
|
|
'author' => 'Mikael Nordfeldth',
|
|
|
|
'homepage' => 'http://www.gnu.org/software/social/',
|
|
|
|
'description' =>
|
|
|
|
// TRANS: Plugin description.
|
2014-07-21 08:51:28 +01:00
|
|
|
_m('Cronish plugin that executes events on a near-minutely/hour/day/week basis.'));
|
2013-11-20 20:20:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|