wyrie
2010-01-20 8a072e707ee4e5bbf0ac3b77eb426428f2d6b308
Fixed: FS#1034 - Gentoo portage sync too frequent 
1 files modified
22 ■■■■■ changed files
server/mods-available/monitor_core_module.inc.php 22 ●●●●● patch | view | raw | blame | history
server/mods-available/monitor_core_module.inc.php
@@ -533,7 +533,27 @@
            /*
             * 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.