view myrss/index.php @ 82:d7d67887102f

move pinlib to a shared location and have pics use it
author paulo
date Wed, 29 Jun 2016 00:11:55 -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 ?>