diff options
-rw-r--r-- | mod/crontrigger/start.php | 169 | ||||
-rw-r--r-- | mod/garbagecollector/languages/en.php | 53 | ||||
-rw-r--r-- | mod/garbagecollector/start.php | 101 | ||||
-rw-r--r-- | mod/garbagecollector/views/default/settings/garbagecollector/edit.php | 12 | ||||
-rw-r--r-- | mod/logrotate/languages/en.php | 35 | ||||
-rw-r--r-- | mod/logrotate/start.php | 101 | ||||
-rw-r--r-- | mod/logrotate/views/default/settings/logrotate/edit.php | 12 | ||||
-rw-r--r-- | mod/tinymce/languages/en.php | 8 | ||||
-rw-r--r-- | mod/tinymce/start.php | 6 |
9 files changed, 253 insertions, 244 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(); +} diff --git a/mod/garbagecollector/languages/en.php b/mod/garbagecollector/languages/en.php index fbebf54b4..b32670a0c 100644 --- a/mod/garbagecollector/languages/en.php +++ b/mod/garbagecollector/languages/en.php @@ -1,32 +1,25 @@ <?php - /** - * Elgg garbage collector language pack. - * - * @package ElggGarbageCollector - */ +/** + * Elgg garbage collector language pack. + * + * @package ElggGarbageCollector + */ - $english = array( - - /** - * Menu items and titles - */ - - 'garbagecollector:period' => 'How often should the Elgg garbage collector run?', - - 'garbagecollector:weekly' => 'Once a week', - 'garbagecollector:monthly' => 'Once a month', - 'garbagecollector:yearly' => 'Once a year', - - 'garbagecollector' => "GARBAGE COLLECTOR\n", - 'garbagecollector:done' => "DONE\n", - 'garbagecollector:optimize' => "Optimizing %s ", - - 'garbagecollector:error' => "ERROR", - 'garbagecollector:ok' => "OK", - - 'garbagecollector:gc:metastrings' => 'Cleaning up unlinked metastrings: ', - - ); - - add_translation("en",$english); -?>
\ No newline at end of file +$english = array( + 'garbagecollector:period' => 'How often should the Elgg garbage collector run?', + + 'garbagecollector:weekly' => 'Once a week', + 'garbagecollector:monthly' => 'Once a month', + 'garbagecollector:yearly' => 'Once a year', + + 'garbagecollector' => "GARBAGE COLLECTOR\n", + 'garbagecollector:done' => "DONE\n", + 'garbagecollector:optimize' => "Optimizing %s ", + + 'garbagecollector:error' => "ERROR", + 'garbagecollector:ok' => "OK", + + 'garbagecollector:gc:metastrings' => 'Cleaning up unlinked metastrings: ', +); + +add_translation("en", $english);
\ No newline at end of file diff --git a/mod/garbagecollector/start.php b/mod/garbagecollector/start.php index 26a462207..6267ab1ba 100644 --- a/mod/garbagecollector/start.php +++ b/mod/garbagecollector/start.php @@ -1,71 +1,64 @@ <?php - /** - * Elgg garbage collector. - * - * @package ElggGarbageCollector - */ +/** + * Elgg garbage collector. + * + * @package ElggGarbageCollector + */ - /** - * Initialise the plugin. - * - */ - function garbagecollector_init() - { - $period = get_plugin_setting('period','garbagecollector'); - switch ($period) - { - case 'weekly': - case 'monthly' : - case 'yearly' : - break; - default: $period = 'monthly'; - } +elgg_register_event_handler('init', 'system', 'garbagecollector_init'); - // Register cron hook - elgg_register_plugin_hook_handler('cron', $period, 'garbagecollector_cron'); +function garbagecollector_init() { + $period = get_plugin_setting('period', 'garbagecollector'); + switch ($period) { + case 'weekly': + case 'monthly': + case 'yearly': + break; + default: + $period = 'monthly'; } - /** - * Cron job - * - */ - function garbagecollector_cron($hook, $entity_type, $returnvalue, $params) - { - global $CONFIG; + // Register cron hook + elgg_register_plugin_hook_handler('cron', $period, 'garbagecollector_cron'); +} - echo elgg_echo('garbagecollector'); +/** + * Cron job + */ +function garbagecollector_cron($hook, $entity_type, $returnvalue, $params) { + global $CONFIG; - // Garbage collect metastrings - echo elgg_echo('garbagecollector:gc:metastrings'); + echo elgg_echo('garbagecollector'); - if (delete_orphaned_metastrings()!==false) { - echo elgg_echo('garbagecollector:ok'); - } else - echo elgg_echo('garbagecollector:error'); + // Garbage collect metastrings + echo elgg_echo('garbagecollector:gc:metastrings'); - echo "\n"; + if (delete_orphaned_metastrings() !== false) { + echo elgg_echo('garbagecollector:ok'); + } else { + echo elgg_echo('garbagecollector:error'); + } - // Now, because we are nice, trigger a plugin hook to let other plugins do some GC - $rv = true; - $period = get_plugin_setting('period','garbagecollector'); - elgg_trigger_plugin_hook('gc', 'system', array('period' => $period)); + echo "\n"; - // Now we optimize all tables - $tables = get_db_tables(); - foreach ($tables as $table) { - echo elgg_echo('garbagecollector:optimize', array($table)); + // Now, because we are nice, trigger a plugin hook to let other plugins do some GC + $rv = true; + $period = get_plugin_setting('period','garbagecollector'); + elgg_trigger_plugin_hook('gc', 'system', array('period' => $period)); - if (optimize_table($table)!==false) - echo elgg_echo('garbagecollector:ok'); - else - echo elgg_echo('garbagecollector:error'); + // Now we optimize all tables + $tables = get_db_tables(); + foreach ($tables as $table) { + echo elgg_echo('garbagecollector:optimize', array($table)); - echo "\n"; + if (optimize_table($table) !== false) { + echo elgg_echo('garbagecollector:ok'); + } else { + echo elgg_echo('garbagecollector:error'); } - echo elgg_echo('garbagecollector:done'); + echo "\n"; } - // Initialise plugin - elgg_register_event_handler('init','system','garbagecollector_init'); -?>
\ No newline at end of file + echo elgg_echo('garbagecollector:done'); +} diff --git a/mod/garbagecollector/views/default/settings/garbagecollector/edit.php b/mod/garbagecollector/views/default/settings/garbagecollector/edit.php index 19ae3d245..e05b5d778 100644 --- a/mod/garbagecollector/views/default/settings/garbagecollector/edit.php +++ b/mod/garbagecollector/views/default/settings/garbagecollector/edit.php @@ -1,6 +1,14 @@ <?php - $period = $vars['entity']->period; - if (!$period) $period = 'monthly'; +/** + * Elgg garbage collector plugin settings. + * + * @package ElggGarbageCollector + */ + +$period = $vars['entity']->period; +if (!$period) { + $period = 'monthly'; +} ?> <p> diff --git a/mod/logrotate/languages/en.php b/mod/logrotate/languages/en.php index 5efb51639..e60d1b841 100644 --- a/mod/logrotate/languages/en.php +++ b/mod/logrotate/languages/en.php @@ -1,20 +1,19 @@ <?php - /** - * Elgg log rotator language pack. - * - * @package ElggLogRotate - */ +/** + * Elgg log rotator language pack. + * + * @package ElggLogRotate + */ - $english = array( - 'logrotate:period' => 'How often should the system log be archived?', - - 'logrotate:weekly' => 'Once a week', - 'logrotate:monthly' => 'Once a month', - 'logrotate:yearly' => 'Once a year', - - 'logrotate:logrotated' => "Log rotated\n", - 'logrotate:lognotrotated' => "Error rotating log\n", - ); - - add_translation("en",$english); -?>
\ No newline at end of file +$english = array( + 'logrotate:period' => 'How often should the system log be archived?', + + 'logrotate:weekly' => 'Once a week', + 'logrotate:monthly' => 'Once a month', + 'logrotate:yearly' => 'Once a year', + + 'logrotate:logrotated' => "Log rotated\n", + 'logrotate:lognotrotated' => "Error rotating log\n", +); + +add_translation("en", $english);
\ No newline at end of file diff --git a/mod/logrotate/start.php b/mod/logrotate/start.php index 485f53f49..28c1694eb 100644 --- a/mod/logrotate/start.php +++ b/mod/logrotate/start.php @@ -1,56 +1,53 @@ <?php - /** - * Elgg log rotator. - * - * @package ElggLogRotate - */ - - /** - * Initialise the plugin. - * - */ - function logrotate_init() - { - $period = get_plugin_setting('period','logrotate'); - switch ($period) - { - case 'weekly': - case 'monthly' : - case 'yearly' : +/** + * Elgg log rotator. + * + * @package ElggLogRotate + */ + +elgg_register_event_handler('init', 'system', 'logrotate_init'); + +function logrotate_init() { + $period = get_plugin_setting('period', 'logrotate'); + switch ($period) { + case 'weekly': + case 'monthly' : + case 'yearly' : break; - default: $period = 'monthly'; - } - - // Register cron hook - elgg_register_plugin_hook_handler('cron', $period, 'logrotate_cron'); + default: + $period = 'monthly'; } - - /** - * Trigger the log rotation. - * - */ - function logrotate_cron($hook, $entity_type, $returnvalue, $params) - { - $resulttext = elgg_echo("logrotate:logrotated"); - - $day = 86400; - - $offset = 0; - $period = get_plugin_setting('period','logrotate'); - switch ($period) - { - case 'weekly': $offset = $day * 7; break; - case 'yearly' : $offset = $day * 365; break; - case 'monthly' : // assume 28 days even if a month is longer. Won't cause data loss. - default: $offset = $day * 28;; - } - - if (!archive_log($offset)) - $resulttext = elgg_echo("logrotate:lognotrotated"); - - return $returnvalue . $resulttext; + + // Register cron hook + elgg_register_plugin_hook_handler('cron', $period, 'logrotate_cron'); +} + +/** + * Trigger the log rotation. + */ +function logrotate_cron($hook, $entity_type, $returnvalue, $params) { + $resulttext = elgg_echo("logrotate:logrotated"); + + $day = 86400; + + $offset = 0; + $period = get_plugin_setting('period', 'logrotate'); + switch ($period) { + case 'weekly': + $offset = $day * 7; + break; + case 'yearly': + $offset = $day * 365; + break; + case 'monthly': + default: + // assume 28 days even if a month is longer. Won't cause data loss. + $offset = $day * 28; } - - // Initialise plugin - elgg_register_event_handler('init','system','logrotate_init'); -?>
\ No newline at end of file + + if (!archive_log($offset)) { + $resulttext = elgg_echo("logrotate:lognotrotated"); + } + + return $returnvalue . $resulttext; +} diff --git a/mod/logrotate/views/default/settings/logrotate/edit.php b/mod/logrotate/views/default/settings/logrotate/edit.php index 19b92c320..db439eaa0 100644 --- a/mod/logrotate/views/default/settings/logrotate/edit.php +++ b/mod/logrotate/views/default/settings/logrotate/edit.php @@ -1,6 +1,14 @@ <?php - $period = $vars['entity']->period; - if (!$period) $period = 'monthly'; +/** + * Elgg log rotator plugin settings. + * + * @package ElggLogRotate + */ + +$period = $vars['entity']->period; +if (!$period) { + $period = 'monthly'; +} ?> <p> diff --git a/mod/tinymce/languages/en.php b/mod/tinymce/languages/en.php index f5d6550dd..811e93492 100644 --- a/mod/tinymce/languages/en.php +++ b/mod/tinymce/languages/en.php @@ -1,9 +1,11 @@ <?php +/** + * TinyMCE language pack. + * + * @package ElggTinyMCE + */ $english = array( - /** - * Menu items and titles - */ 'tinymce:remove' => "Remove editor", 'tinymce:add' => "Add editor", 'tinymce:word_count' => 'Word count: ', diff --git a/mod/tinymce/start.php b/mod/tinymce/start.php index b605f92f6..bc54c36a0 100644 --- a/mod/tinymce/start.php +++ b/mod/tinymce/start.php @@ -2,12 +2,10 @@ /** * TinyMCE wysiwyg editor * - * @package TinyMCE - **/ + * @package ElggTinyMCE + */ function tinymce_init() { - global $CONFIG; - elgg_extend_view('css', 'tinymce/css'); elgg_extend_view('embed/custom_insert_js', 'tinymce/embed_custom_insert_js'); } |