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