From acde7a345ef6d867fcb68ec81ceff2f3e8152da7 Mon Sep 17 00:00:00 2001 From: "mike.morgan%oregonstate.edu" Date: Tue, 21 Feb 2006 01:02:28 +0000 Subject: [PATCH] Fixed cache problems in recommended.php, search.php, update.php. git-svn-id: svn://10.0.0.236/trunk@190635 18797224-902f-48f8-a5cc-f745e15eee43 --- .../addons/public/htdocs/recommended.php | 2 +- .../webtools/addons/public/htdocs/search.php | 5 +- .../webtools/addons/public/htdocs/update.php | 52 +++++++++---------- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/mozilla/webtools/addons/public/htdocs/recommended.php b/mozilla/webtools/addons/public/htdocs/recommended.php index 8c131a907e9..2ef22ca2be8 100644 --- a/mozilla/webtools/addons/public/htdocs/recommended.php +++ b/mozilla/webtools/addons/public/htdocs/recommended.php @@ -7,7 +7,7 @@ * @todo make this dynamic based on an SQL field (recommended) */ -startProcessing('recommended.tpl', $cacheId, $compileId, 'nonav'); +startProcessing('recommended.tpl', 'recommended', $compileId, 'nonav'); require_once('includes.php'); // If app is not set or empty, set it to null for our switch. diff --git a/mozilla/webtools/addons/public/htdocs/search.php b/mozilla/webtools/addons/public/htdocs/search.php index 0de59a7daab..dba9d7641ff 100644 --- a/mozilla/webtools/addons/public/htdocs/search.php +++ b/mozilla/webtools/addons/public/htdocs/search.php @@ -12,7 +12,10 @@ * @todo fix CSS so the pull-downs look symmetrical before design freaks start crying. */ -startProcessing('search.tpl',null,null,'nonav'); +// Get our cache_id based on what we have in our query string. +$cacheId = md5($_SERVER['QUERY_STRING']); + +startProcessing('search.tpl',$cacheId,$compileId,'nonav'); require_once('includes.php'); // Array to store our page information. diff --git a/mozilla/webtools/addons/public/htdocs/update.php b/mozilla/webtools/addons/public/htdocs/update.php index 067bde2de5f..2c163c9b218 100644 --- a/mozilla/webtools/addons/public/htdocs/update.php +++ b/mozilla/webtools/addons/public/htdocs/update.php @@ -13,14 +13,37 @@ + +/** + * CHECK CACHE + * + * Check to see if we already have a matching cacheId. + * If it exists, we can pull from it and exit; and avoid recompiling. + */ +// Determine a cacheId based on params. +$cacheId = md5($_SERVER['QUERY_STRING']); + +$tpl = new AMO_Smarty(); + +// Set our cache timeout to 1 hour. +$tpl->caching = true; +$tpl->cache_timeout = 3600; + +if ($tpl->is_cached('update.tpl',$cacheId)) { + header("Content-type: text/xml"); + $tpl->display('update.tpl',$cacheId); + exit; +} + + + + /* * VARIABLES * * Initialize, set up and clean variables. */ - - // Map the mysql main.type enum into the right type. $ext_typemap = array('T' => 'theme', 'E' => 'extension', @@ -51,29 +74,6 @@ foreach ($required_vars as $var) { } } -// Determine a cache_id based on params. -$cache_id = $sql['os_id'] . implode('',$sql); - - - -/** - * CHECK CACHE - * - * Check to see if we already have a matching cache_id. - * If it exists, we can pull from it and exit; and avoid recompiling. - */ -$tpl = new AMO_Smarty(); - -// Set our cache timeout to 1 hour. -$tpl->caching = true; -$tpl->cache_timeout = 3600; - -if ($tpl->is_cached('update.tpl',$cache_id)) { - header("Content-type: text/xml"); - $tpl->display('update.tpl',$cache_id); - exit; -} - // If we have all of our data, clean it up for our queries. @@ -160,7 +160,7 @@ if (empty($errors)) { */ if ($debug!=true) { header("Content-type: text/xml"); - $tpl->display('update.tpl',$cache_id); + $tpl->display('update.tpl',$cacheId); exit; }