aboutsummaryrefslogtreecommitdiff
path: root/mod/crontrigger/start.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-29 02:53:32 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-29 02:53:32 +0000
commitaefce16b306505c6cfed8d87e975b2c9680559b4 (patch)
treed79433a597577196a3d6c7dba08beabc9cea3eb2 /mod/crontrigger/start.php
parent13a495664c79037557e6c5ea7c3e442be0523139 (diff)
downloadelgg-aefce16b306505c6cfed8d87e975b2c9680559b4.tar.gz
elgg-aefce16b306505c6cfed8d87e975b2c9680559b4.tar.bz2
cleaned up some of the other smaller plugins
git-svn-id: http://code.elgg.org/elgg/trunk@7468 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/crontrigger/start.php')
-rw-r--r--mod/crontrigger/start.php169
1 files changed, 90 insertions, 79 deletions
diff --git a/mod/crontrigger/start.php b/mod/crontrigger/start.php
index 379fe1978..24f50f33b 100644
--- a/mod/crontrigger/start.php
+++ b/mod/crontrigger/start.php
@@ -1,80 +1,91 @@
<?php
- /**
- * Elgg Cron trigger.
- * When enabled this plugin provides "poor man's cron" functionality to trigger elgg cron scripts without the need
- * to install the cron script.
- *
- * Note, this is a substitute and not a replacement for the cron script. It is recommended that you use the cron script
- * where possible.
- *
- * @package ElggCronTrigger
- */
-
- /**
- * Initialise the plugin.
- *
- */
- function crontrigger_init()
- {
- elgg_register_event_handler('shutdown', 'system', 'crontrigger_shutdownhook');
- }
-
- function crontrigger_trigger($period) { elgg_trigger_plugin_hook('cron', $period); }
-
- function crontrigger_minute() { crontrigger_trigger('minute'); }
-
- function crontrigger_fiveminute() { crontrigger_trigger('fiveminute'); }
-
- function crontrigger_fifteenmin() { crontrigger_trigger('fifteenmin'); }
-
- function crontrigger_halfhour() { crontrigger_trigger('halfhour'); }
-
- function crontrigger_hourly() { crontrigger_trigger('hourly'); }
-
- function crontrigger_daily() { crontrigger_trigger('daily'); }
-
- function crontrigger_weekly() { crontrigger_trigger('weekly'); }
-
- function crontrigger_monthly() { crontrigger_trigger('monthly'); }
-
- function crontrigger_yearly() { crontrigger_trigger('yearly'); }
-
- /**
- * Call cron hooks after a page has been displayed (so user won't notice any slowdown).
- *
- * It uses a mod of now and needs someone to view the page within a certain time period
- *
- */
- function crontrigger_shutdownhook()
- {
- global $CONFIG;
-
- $minute = 60;
- $fiveminute = $minute*5;
- $fifteenmin = $minute*15;
- $halfhour = $minute*30;
- $hour = 3600;
- $day = $hour*24;
- $week = $day * 7;
- $month = $week * 4;
- $year = $month * 12;
-
- $now = time();
-
- ob_start();
- run_function_once('crontrigger_minute', $now - $minute);
- run_function_once('crontrigger_fiveminute', $now - $fiveminute);
- run_function_once('crontrigger_fifteenmin', $now - $fifteenmin);
- run_function_once('crontrigger_halfhour', $now - $halfhour);
- run_function_once('crontrigger_hourly', $now - $hour);
- run_function_once('crontrigger_daily', $now - $day);
- run_function_once('crontrigger_weekly', $now - $week);
- run_function_once('crontrigger_monthly', $now - $month);
- run_function_once('crontrigger_yearly', $now - $year);
- ob_clean();
- }
-
-
- // Initialise plugin
- elgg_register_event_handler('init','system','crontrigger_init');
-?> \ No newline at end of file
+/**
+ * Elgg Cron trigger.
+ * When enabled this plugin provides "poor man's cron" functionality to trigger
+ * elgg cron scripts without the need to install the cron script.
+ *
+ * Note, this is a substitute and not a replacement for the cron script.
+ * It is recommended that you use the cron script where possible.
+ *
+ * @package ElggCronTrigger
+ */
+
+elgg_register_event_handler('init', 'system', 'crontrigger_init');
+
+function crontrigger_init() {
+ elgg_register_event_handler('shutdown', 'system', 'crontrigger_shutdownhook');
+}
+
+function crontrigger_trigger($period) {
+ elgg_trigger_plugin_hook('cron', $period);
+}
+
+function crontrigger_minute() {
+ crontrigger_trigger('minute');
+}
+
+function crontrigger_fiveminute() {
+ crontrigger_trigger('fiveminute');
+}
+
+function crontrigger_fifteenmin() {
+ crontrigger_trigger('fifteenmin');
+}
+
+function crontrigger_halfhour() {
+ crontrigger_trigger('halfhour');
+}
+
+function crontrigger_hourly() {
+ crontrigger_trigger('hourly');
+}
+
+function crontrigger_daily() {
+ crontrigger_trigger('daily');
+}
+
+function crontrigger_weekly() {
+ crontrigger_trigger('weekly');
+}
+
+function crontrigger_monthly() {
+ crontrigger_trigger('monthly');
+}
+
+function crontrigger_yearly() {
+ crontrigger_trigger('yearly');
+}
+
+/**
+ * Call cron hooks after a page has been displayed (so user won't notice any slowdown).
+ *
+ * If people are not viewing pages quickly enough, the scheduled triggers will
+ * not occur.
+ */
+function crontrigger_shutdownhook() {
+ global $CONFIG;
+
+ $minute = 60;
+ $fiveminute = $minute * 5;
+ $fifteenmin = $minute * 15;
+ $halfhour = $minute * 30;
+ $hour = 3600;
+ $day = $hour * 24;
+ $week = $day * 7;
+ $month = $week * 4;
+ $year = $month * 12;
+
+ $now = time();
+
+ ob_start();
+ run_function_once('crontrigger_minute', $now - $minute);
+ run_function_once('crontrigger_fiveminute', $now - $fiveminute);
+ run_function_once('crontrigger_fifteenmin', $now - $fifteenmin);
+ run_function_once('crontrigger_halfhour', $now - $halfhour);
+ run_function_once('crontrigger_hourly', $now - $hour);
+ run_function_once('crontrigger_daily', $now - $day);
+ run_function_once('crontrigger_weekly', $now - $week);
+ run_function_once('crontrigger_monthly', $now - $month);
+ run_function_once('crontrigger_yearly', $now - $year);
+ ob_clean();
+}