view myrss/index.php @ 125:d216dd8e63da

pics3: implement thumbs page
author paulo
date Sat, 01 May 2021 01:59:08 -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 ?>