diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php index 642395eeb5e0de794301f49a57ca68e573b8105b..0e3e6dfa5df6cb71ab1ccbcf45116d7271ad6f75 100644 --- a/server/mods-available/monitor_core_module.inc.php +++ b/server/mods-available/monitor_core_module.inc.php @@ -533,7 +533,27 @@ class monitor_core_module { /* * first update the portage tree */ - shell_exec('emerge --sync --quiet'); + + // In keeping with gentoo's rsync policy, don't update to frequently (every four hours - taken from http://www.gentoo.org/doc/en/source_mirrors.xml) + $do_update = true; + if (file_exists('/usr/portage/metadata/timestamp.chk')) + { + $datetime = file_get_contents('/usr/portage/metadata/timestamp.chk'); + $datetime = trim($datetime); + + $dstamp = strtotime($datetime); + if ($dstamp) + { + $checkat = $dstamp + 14400; // + 4hours + if (mktime() < $checkat) { + $do_update = false; + } + } + } + + if ($do_update) { + shell_exec('emerge --sync --quiet'); + } /* * Then test the upgrade.