2013-11-21 05:20:42 +09:00
|
|
|
<?php
|
2013-11-21 07:03:40 +09: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 16:51:28 +09:00
|
|
|
* @link http://gnu.io/social/
|
2013-11-21 07:03:40 +09:00
|
|
|
*/
|
2013-11-21 05:20:42 +09:00
|
|
|
|
2014-07-21 16:51:28 +09:00
|
|
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
|
|
|
|
2013-11-21 05:20:42 +09:00
|
|
|
class CronishPlugin extends Plugin {
|
2019-06-03 09:56:52 +09:00
|
|
|
const PLUGIN_VERSION = '2.0.0';
|
|
|
|
|
2013-11-21 07:03:40 +09:00
|
|
|
public function onCronMinutely()
|
|
|
|
{
|
2014-07-21 16:51:28 +09:00
|
|
|
common_debug('CRON: Running near-minutely cron job!');
|
2013-11-21 07:03:40 +09:00
|
|
|
}
|
|
|
|
|
2013-11-21 05:20:42 +09:00
|
|
|
public function onCronHourly()
|
|
|
|
{
|
2014-07-21 16:51:28 +09:00
|
|
|
common_debug('CRON: Running near-hourly cron job!');
|
2013-11-21 05:20:42 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
public function onCronDaily()
|
|
|
|
{
|
2014-07-21 16:51:28 +09:00
|
|
|
common_debug('CRON: Running near-daily cron job!');
|
2013-11-21 05:20:42 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
public function onCronWeekly()
|
|
|
|
{
|
2014-07-21 16:51:28 +09:00
|
|
|
common_debug('CRON: Running near-weekly cron job!');
|
2013-11-21 05:20:42 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When the page has finished rendering, let's do some cron jobs
|
|
|
|
* if we have the time.
|
|
|
|
*/
|
2015-02-27 20:11:43 +09:00
|
|
|
public function onEndActionExecute(Action $action)
|
2013-11-21 05:20:42 +09:00
|
|
|
{
|
|
|
|
$cron = new Cronish();
|
|
|
|
$cron->callTimedEvents();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-08-12 23:03:30 +09:00
|
|
|
public function onPluginVersion(array &$versions): bool
|
2013-11-21 05:20:42 +09:00
|
|
|
{
|
|
|
|
$versions[] = array('name' => 'Cronish',
|
2019-06-03 09:56:52 +09:00
|
|
|
'version' => self::PLUGIN_VERSION,
|
2013-11-21 05:20:42 +09:00
|
|
|
'author' => 'Mikael Nordfeldth',
|
|
|
|
'homepage' => 'http://www.gnu.org/software/social/',
|
|
|
|
'description' =>
|
|
|
|
// TRANS: Plugin description.
|
2014-07-21 16:51:28 +09:00
|
|
|
_m('Cronish plugin that executes events on a near-minutely/hour/day/week basis.'));
|
2013-11-21 05:20:42 +09:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|