paulo@13: <?php paulo@28: umask(0037); paulo@28: paulo@13: $start_time = microtime(true); paulo@13: paulo@13: $cache_fn = "__cache__.html"; paulo@13: $cache_life = "1200"; paulo@13: paulo@13: $cache_mtime = "0"; paulo@20: if (file_exists($cache_fn) && filesize($cache_fn) > 0) paulo@13: $cache_mtime = filemtime($cache_fn); paulo@13: paulo@13: $newbody = ''; paulo@13: paulo@13: if ((time() - $cache_mtime >= $cache_life)) { paulo@27: $newbody = shell_exec('./myrss_update.sh 2>&1'); paulo@13: file_put_contents($cache_fn, $newbody); paulo@13: } else { paulo@13: $newbody = file_get_contents($cache_fn); paulo@13: } paulo@13: paulo@13: $end_time = microtime(true); paulo@13: $elapsed_time = $end_time - $start_time; paulo@13: paulo@13: $newbody = preg_replace("/<\/BODY>/", "<DIV class=\"debug\">Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.</DIV>\n</BODY>", $newbody); paulo@13: echo $newbody; paulo@13: ?>