From b4fa782d8e2881dbe98dabc73837a10ae962e78a Mon Sep 17 00:00:00 2001 From: Ludovic Arnaud Date: Wed, 12 Mar 2003 23:20:57 +0000 Subject: [PATCH] D'OH! (sql cache can expire, now) git-svn-id: file:///svn/phpbb/trunk@3637 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/cache_file.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acm/cache_file.php b/phpBB/includes/acm/cache_file.php index 816746e787..7dad56cb31 100644 --- a/phpBB/includes/acm/cache_file.php +++ b/phpBB/includes/acm/cache_file.php @@ -166,16 +166,18 @@ class acm return 'array(' . implode(',', $lines) . ')'; } - function sql_load($query) + function sql_load($query, $expire_time) { global $db, $phpEx; - @include($this->cache_dir . md5($query) . '.' . $phpEx); - if (!isset($rowset)) + $filemtime = intval(@filemtime($this->cache_dir . md5($query) . '.' . $phpEx)); + if (time() - $filemtime > $expire_time) { return FALSE; } + include($this->cache_dir . md5($query) . '.' . $phpEx); + $query_id = 'Cache id #' . count($this->sql_rowset); $this->sql_rowset[$query_id] = $rowset; $db->query_result = $query_id;