diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-29 02:53:32 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-29 02:53:32 +0000 |
commit | aefce16b306505c6cfed8d87e975b2c9680559b4 (patch) | |
tree | d79433a597577196a3d6c7dba08beabc9cea3eb2 /mod/garbagecollector | |
parent | 13a495664c79037557e6c5ea7c3e442be0523139 (diff) | |
download | elgg-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/garbagecollector')
-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 |
3 files changed, 80 insertions, 86 deletions
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> |