зеркало из https://github.com/mozilla/pjs.git
Caching touch-up.
This commit is contained in:
Родитель
270e61179c
Коммит
20f2984d44
|
@ -10,13 +10,9 @@
|
|||
$clean['ID'] = intval($_GET['id']);
|
||||
$sql['ID'] =& $clean['ID'];
|
||||
|
||||
// Set the cachId so we have a unique cache for each AddOn ID.
|
||||
$cacheId = $clean['ID'];
|
||||
|
||||
startProcessing('addon.tpl',$cacheId,$compileId);
|
||||
startProcessing('addon.tpl',$clean['ID'],$compileId);
|
||||
require_once('includes.php');
|
||||
|
||||
|
||||
// Create our AddOn object using the ID.
|
||||
$addon = new AddOn($sql['ID']);
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
$clean['UserID'] = intval($_GET['id']);
|
||||
$sql['UserID'] =& $clean['UserID'];
|
||||
|
||||
$cacheId = $clean['UserID'];
|
||||
|
||||
startProcessing('author.tpl',$cacheId,$compileId);
|
||||
startProcessing('author.tpl',$clean['UserID'],$compileId);
|
||||
require_once('includes.php');
|
||||
|
||||
$user = new User($sql['UserID']);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
$currentTab = 'extensions';
|
||||
|
||||
startProcessing('extensions.tpl', null, $compileId);
|
||||
startProcessing('extensions.tpl', 'extensions', $compileId);
|
||||
require_once('includes.php');
|
||||
|
||||
// If app is not set or empty, set it to null for our switch.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* @todo FAQ search?
|
||||
*/
|
||||
|
||||
startProcessing('faq.tpl',null,$compileId);
|
||||
startProcessing('faq.tpl','faq',$compileId);
|
||||
require_once('includes.php');
|
||||
|
||||
$db->query("
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
$clean['ID'] = intval($_GET['id']);
|
||||
$sql['ID'] =& $clean['ID'];
|
||||
|
||||
$cacheId = $clean['ID'];
|
||||
|
||||
startProcessing('history.tpl',$cacheId,$compileId);
|
||||
startProcessing('history.tpl',$clean['ID'],$compileId);
|
||||
require_once('includes.php');
|
||||
|
||||
$addon = new AddOn($sql['ID']);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
$currentTab = 'home';
|
||||
|
||||
startProcessing('index.tpl', null, $compileId, 'nonav');
|
||||
startProcessing('index.tpl', 'home', $compileId, 'nonav');
|
||||
require_once('includes.php');
|
||||
|
||||
// If app is not set or empty, set it to null for our switch.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* @todo talk to cbeard and rebron about establishing the policy document.
|
||||
*/
|
||||
|
||||
startProcessing('policy.tpl',null,$compileId);
|
||||
startProcessing('policy.tpl','policy',$compileId);
|
||||
require_once('includes.php');
|
||||
|
||||
$links = array(
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
$clean['ID'] = intval($_GET['id']);
|
||||
$sql['ID'] =& $clean['ID'];
|
||||
|
||||
startProcessing('previews.tpl',$cacheId,$compileId);
|
||||
startProcessing('previews.tpl',$clean['ID'],$compileId);
|
||||
require_once('includes.php');
|
||||
|
||||
$addon = new AddOn($sql['ID']);
|
||||
|
|
|
@ -6,6 +6,33 @@
|
|||
* @subpackage docs
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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 2 hours, which is reasonable.
|
||||
$tpl->caching = 1;
|
||||
$tpl->cache_timeout = 7200;
|
||||
|
||||
// Determine our cacheId based on the RSS feed's arguments.
|
||||
|
||||
if ($tpl->is_cached('rss.tpl',$cacheId)) {
|
||||
header('Content-Type: text/xml; charset=utf-8');
|
||||
$tpl->display('rss.tpl',$cacheId);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Pull our input params.
|
||||
*/
|
||||
|
@ -56,35 +83,12 @@ switch (strtolower($rsslist)) {
|
|||
break;
|
||||
}
|
||||
|
||||
// Generate our cache_id.
|
||||
$cache_id = md5($rssapp.$rsstype.$rsslist);
|
||||
|
||||
unset($rssapp);
|
||||
unset($rsstype);
|
||||
unset($rsslist);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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 2 hours, which is reasonable.
|
||||
$tpl->caching = 1;
|
||||
$tpl->cache_timeout = 7200;
|
||||
|
||||
// Determine our cache_id based on the RSS feed's arguments.
|
||||
|
||||
if ($tpl->is_cached('rss.tpl',$cache_id)) {
|
||||
header('Content-Type: text/xml; charset=utf-8');
|
||||
$tpl->display('rss.tpl',$cache_id);
|
||||
exit;
|
||||
}
|
||||
|
||||
// If we get here, we're going to have to pull DB contents.
|
||||
require_once('includes.php');
|
||||
|
||||
|
@ -93,7 +97,7 @@ $sql['app'] = $clean['app']; // Already ok for sql, type was checked (alpha).
|
|||
$sql['type'] = $clean['type']; // Already ok for sql, type was checked (alpha).
|
||||
|
||||
$_rssSql = "
|
||||
SELECT DISTINCT
|
||||
SELECT
|
||||
m.id,
|
||||
m.name as title,
|
||||
m.type,
|
||||
|
@ -104,20 +108,13 @@ $_rssSql = "
|
|||
a.appname
|
||||
FROM
|
||||
main m
|
||||
INNER JOIN
|
||||
version v
|
||||
ON
|
||||
v.id = m.id
|
||||
INNER JOIN
|
||||
applications a
|
||||
ON
|
||||
a.appid = v.appid
|
||||
INNER JOIN version v ON v.id = m.id
|
||||
INNER JOIN applications a ON a.appid = v.appid
|
||||
WHERE
|
||||
v.approved = 'yes' AND
|
||||
a.appname = '{$sql['app']}' AND
|
||||
m.type = '{$sql['type']}'
|
||||
GROUP BY
|
||||
m.id
|
||||
m.type = '{$sql['type']}' AND
|
||||
v.vid = (SELECT max(vid) FROM version WHERE id=m.id AND approved='YES')
|
||||
ORDER BY
|
||||
{$rssOrderBy}
|
||||
LIMIT 0,10
|
||||
|
@ -130,6 +127,6 @@ $tpl->assign('data',$_rssData);
|
|||
|
||||
// Set our content-type and spit it out.
|
||||
header('Content-Type: text/xml; charset=utf-8');
|
||||
$tpl->display('rss.tpl',$cache_id);
|
||||
$tpl->display('rss.tpl',$cacheId);
|
||||
exit;
|
||||
?>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
$currentTab = 'search-engines';
|
||||
|
||||
startProcessing('search-engines.tpl',null,$compileId,'nonav');
|
||||
startProcessing('search-engines.tpl','searchEngines',$compileId,'nonav');
|
||||
require_once('includes.php');
|
||||
|
||||
// Assign template variables.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
$currentTab = 'themes';
|
||||
|
||||
startProcessing('themes.tpl', null, $compileId);
|
||||
startProcessing('themes.tpl', 'themes', $compileId);
|
||||
require_once('includes.php');
|
||||
|
||||
// If app is not set or empty, set it to null for our switch.
|
||||
|
|
Загрузка…
Ссылка в новой задаче