comparison index.php @ 53:eb847818a3be

Reset matrix only when generating a cache, speeds things up a bit. Also, check if cache file exists before trying filemtime() on it.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 23 Mar 2011 00:28:54 +0200
parents dd39f6bbc4cb
children 29e25b70a403
comparison
equal deleted inserted replaced
52:dd39f6bbc4cb 53:eb847818a3be
289 </script> 289 </script>
290 <body> 290 <body>
291 <div id="info"> 291 <div id="info">
292 <? 292 <?
293 293
294 alch_matrix_clear();
295 294
296 // Check if we have a non-stale cache of the matrix data 295 // Check if we have a non-stale cache of the matrix data
297 #if (1) 296 if (!file_exists($cacheFile) || filemtime($dataFile) > filemtime($cacheFile))
298 if (filemtime($dataFile) > filemtime($cacheFile)) 297 {
299 { 298 alch_matrix_clear();
299
300 $nline = 0; 300 $nline = 0;
301 $file = fopen($dataFile, "r"); 301 $file = fopen($dataFile, "r");
302
303 while (($rawline = fgets($file)) !== FALSE) { 302 while (($rawline = fgets($file)) !== FALSE) {
304 $nline++; 303 $nline++;
305 $line = trim($rawline); 304 $line = trim($rawline);
306 305
307 // Skip empty lines and comments 306 // Skip empty lines and comments