Mercurial > hg > index.fcgi > www > www-1
changeset 13:b1038ce571d3
add myrss/index.php; add <div.debug> to index.css
author | paulo@twcdns.fastsearch.net |
---|---|
date | Wed, 15 Sep 2010 01:30:07 -0700 |
parents | 2e8351e61e8f |
children | 3affc32b1647 5a0c2ee709f8 |
files | index.css myrss/index.php |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- a/index.css Wed Sep 15 01:25:20 2010 -0700 1.2 +++ b/index.css Wed Sep 15 01:30:07 2010 -0700 1.3 @@ -29,3 +29,9 @@ 1.4 { 1.5 font-size: small; 1.6 } 1.7 + 1.8 +div.debug 1.9 +{ 1.10 + font-family: monospace; 1.11 + font-size: x-small; 1.12 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/myrss/index.php Wed Sep 15 01:30:07 2010 -0700 2.3 @@ -0,0 +1,25 @@ 2.4 +<?php 2.5 +$start_time = microtime(true); 2.6 + 2.7 +$cache_fn = "__cache__.html"; 2.8 +$cache_life = "1200"; 2.9 + 2.10 +$cache_mtime = "0"; 2.11 +if (file_exists($cache_fn)) 2.12 + $cache_mtime = filemtime($cache_fn); 2.13 + 2.14 +$newbody = ''; 2.15 + 2.16 +if ((time() - $cache_mtime >= $cache_life)) { 2.17 + $newbody = shell_exec('./myrss_update.sh'); 2.18 + file_put_contents($cache_fn, $newbody); 2.19 +} else { 2.20 + $newbody = file_get_contents($cache_fn); 2.21 +} 2.22 + 2.23 +$end_time = microtime(true); 2.24 +$elapsed_time = $end_time - $start_time; 2.25 + 2.26 +$newbody = preg_replace("/<\/BODY>/", "<DIV class=\"debug\">Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.</DIV>\n</BODY>", $newbody); 2.27 +echo $newbody; 2.28 +?>