view myrss/index.php @ 61:16bcb4ae6985

add laterlinks2/index.fcgi
author paulo
date Fri, 18 Jul 2014 23:03:53 -0700
parents f93693980ead
children
line source
1 <?php
2 umask(0037);
4 $start_time = microtime(true);
6 $cache_fn = "__cache__.html";
7 $cache_life = "1200";
9 $cache_mtime = "0";
10 if (file_exists($cache_fn) && filesize($cache_fn) > 0)
11 $cache_mtime = filemtime($cache_fn);
13 $newbody = '';
15 if ((time() - $cache_mtime >= $cache_life)) {
16 $newbody = shell_exec('./myrss_update.sh 2>&1');
17 file_put_contents($cache_fn, $newbody);
18 } else {
19 $newbody = file_get_contents($cache_fn);
20 }
22 $end_time = microtime(true);
23 $elapsed_time = $end_time - $start_time;
25 $newbody = preg_replace("/<\/BODY>/", "<DIV class=\"debug\">Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.</DIV>\n</BODY>", $newbody);
26 echo $newbody;
27 ?>