Skip to content

Commit 8a072e7

Browse files
author
wyrie
committed
Fixed: FS#1034 - Gentoo portage sync too frequent
1 parent 6d80f55 commit 8a072e7

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

server/mods-available/monitor_core_module.inc.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,27 @@ function monitorSystemUpdate(){
533533
/*
534534
* first update the portage tree
535535
*/
536-
shell_exec('emerge --sync --quiet');
536+
537+
// 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)
538+
$do_update = true;
539+
if (file_exists('/usr/portage/metadata/timestamp.chk'))
540+
{
541+
$datetime = file_get_contents('/usr/portage/metadata/timestamp.chk');
542+
$datetime = trim($datetime);
543+
544+
$dstamp = strtotime($datetime);
545+
if ($dstamp)
546+
{
547+
$checkat = $dstamp + 14400; // + 4hours
548+
if (mktime() < $checkat) {
549+
$do_update = false;
550+
}
551+
}
552+
}
553+
554+
if ($do_update) {
555+
shell_exec('emerge --sync --quiet');
556+
}
537557

538558
/*
539559
* Then test the upgrade.

0 commit comments

Comments
 (0)