changeset 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 89d1c1b7e29d
files index.php
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Tue Mar 22 22:43:44 2011 +0200
+++ b/index.php	Wed Mar 23 00:28:54 2011 +0200
@@ -291,15 +291,14 @@
 <div id="info">
 <?
 
-alch_matrix_clear();
 
 // Check if we have a non-stale cache of the matrix data
-#if (1)
-if (filemtime($dataFile) > filemtime($cacheFile))
+if (!file_exists($cacheFile) || filemtime($dataFile) > filemtime($cacheFile))
 {
+  alch_matrix_clear();
+
   $nline = 0;
   $file = fopen($dataFile, "r");
-
   while (($rawline = fgets($file)) !== FALSE) {
     $nline++;
     $line = trim($rawline);