From aefce16b306505c6cfed8d87e975b2c9680559b4 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 29 Nov 2010 02:53:32 +0000 Subject: cleaned up some of the other smaller plugins git-svn-id: http://code.elgg.org/elgg/trunk@7468 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/garbagecollector/languages/en.php | 53 +++++------ mod/garbagecollector/start.php | 101 ++++++++++----------- .../default/settings/garbagecollector/edit.php | 12 ++- 3 files changed, 80 insertions(+), 86 deletions(-) (limited to 'mod/garbagecollector') 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 @@ '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 @@ $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 @@ period; - if (!$period) $period = 'monthly'; +/** + * Elgg garbage collector plugin settings. + * + * @package ElggGarbageCollector + */ + +$period = $vars['entity']->period; +if (!$period) { + $period = 'monthly'; +} ?>

-- cgit v1.2.3