r1592: Adding a file that caches all the templates in Bugdar to the database
authorRobert Sesek <rsesek@bluestatic.org>
Fri, 20 Jul 2007 17:00:15 +0000 (17:00 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Fri, 20 Jul 2007 17:00:15 +0000 (17:00 +0000)
docs/cache_templates.php [new file with mode: 0644]

diff --git a/docs/cache_templates.php b/docs/cache_templates.php
new file mode 100644 (file)
index 0000000..3310f60
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+// takes all the templates in Bugdar and moves them to the database
+// SVN $Id$
+
+chdir('..');
+require_once('./global.php');
+
+$files = $funct->scandir('templates');
+
+$db->query("TRUNCATE TABLE " . TABLE_PREFIX . "template");
+
+foreach ($files AS $path => $bits)
+{
+       foreach ($bits AS $file)
+       {
+               if ($funct->fetch_extension($file) == 'tpl')
+               {
+                       $db->query("INSERT INTO " . TABLE_PREFIX . "template (filename, template, timestamp) VALUES ('$path" . substr($file, 0, strlen($file) - 4) . "', '" . $db->escape_string($template->_parse(file_get_contents("templates/$path$file"))) . "', " . time() . ")");
+               }
+       }
+}
+
+?>
\ No newline at end of file