From bad9b2eb88919f46b771a4b152f5b478f83185d6 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 17 Feb 2007 19:29:54 +0000 Subject: [PATCH] Check that database caching is enabled before we run off and try to insert templates into the database... --- TemplateFs.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/TemplateFs.php b/TemplateFs.php index f9ed091..1d80941 100644 --- a/TemplateFs.php +++ b/TemplateFs.php @@ -139,15 +139,23 @@ class BSTemplateFs extends BSTemplate } foreach ($namearray AS $name) { - if (isset($dbCache["$name"])) + if ($this->dbCacheTable) { - $template = $dbCache["$name"]; + if (isset($dbCache["$name"])) + { + $template = $dbCache["$name"]; + } + else + { + $template = $this->_parseTemplate($this->_loadTemplate($name)); + $db->query("INSERT INTO {$this->dbCacheTable} (filename, template, timestamp) VALUES ('$name', '" . $db->escapeString($template) . "', " . TIMENOW . ")"); + } } else { $template = $this->_parseTemplate($this->_loadTemplate($name)); - $db->query("INSERT INTO {$this->dbCacheTable} (filename, template, timestamp) VALUES ('$name', '" . $db->escapeString($template) . "', " . TIMENOW . ")"); } + $this->cache["$name"] = $template; $this->usage["$name"] = 0; } -- 2.43.5