Mercurial > hg > index.fcgi > www > www-1
comparison myrss/index.php @ 16:114919250f64
update myrss/FEEDS
author | paulo |
---|---|
date | Tue, 18 Dec 2012 03:40:40 -0700 |
parents | |
children | 469b1e6dd364 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:485e0e0fe58c |
---|---|
1 <?php | |
2 $start_time = microtime(true); | |
3 | |
4 $cache_fn = "__cache__.html"; | |
5 $cache_life = "1200"; | |
6 | |
7 $cache_mtime = "0"; | |
8 if (file_exists($cache_fn)) | |
9 $cache_mtime = filemtime($cache_fn); | |
10 | |
11 $newbody = ''; | |
12 | |
13 if ((time() - $cache_mtime >= $cache_life)) { | |
14 $newbody = shell_exec('./myrss_update.sh'); | |
15 file_put_contents($cache_fn, $newbody); | |
16 } else { | |
17 $newbody = file_get_contents($cache_fn); | |
18 } | |
19 | |
20 $end_time = microtime(true); | |
21 $elapsed_time = $end_time - $start_time; | |
22 | |
23 $newbody = preg_replace("/<\/BODY>/", "<DIV class=\"debug\">Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.</DIV>\n</BODY>", $newbody); | |
24 echo $newbody; | |
25 ?> |