mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
make rss.php use the apc cache instead of a cache file
utilize the apc cache functionality in aur.inc to cache the rss feed output. the cache will cache on a per-protocol basis (http/https) so that urls are appropriate regardless of which url people hit. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
af5d05f4ad
commit
023d2a2521
1 changed files with 13 additions and 5 deletions
|
@ -8,6 +8,15 @@ include_once("feedcreator.class.php");
|
||||||
$protocol = isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=='on' ? "https" : "http";
|
$protocol = isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=='on' ? "https" : "http";
|
||||||
$host = $_SERVER['HTTP_HOST'];
|
$host = $_SERVER['HTTP_HOST'];
|
||||||
|
|
||||||
|
$feed_key = 'pkg-feed-' . $protocol;
|
||||||
|
|
||||||
|
$bool = false;
|
||||||
|
$ret = get_cache_value($feed_key, $bool);
|
||||||
|
if ($bool) {
|
||||||
|
echo $ret;
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$rss = new RSSCreator20();
|
$rss = new RSSCreator20();
|
||||||
$rss->cssStyleSheet = false;
|
$rss->cssStyleSheet = false;
|
||||||
$rss->xslStyleSheet = false;
|
$rss->xslStyleSheet = false;
|
||||||
|
@ -15,9 +24,6 @@ $rss->xslStyleSheet = false;
|
||||||
# Use UTF-8 (fixes FS#10706).
|
# Use UTF-8 (fixes FS#10706).
|
||||||
$rss->encoding = "UTF-8";
|
$rss->encoding = "UTF-8";
|
||||||
|
|
||||||
#If there's a cached version <1hr old, won't regenerate now
|
|
||||||
$rss->useCached("/tmp/aur-newestpkg.xml", 1800);
|
|
||||||
|
|
||||||
#All the general RSS setup
|
#All the general RSS setup
|
||||||
$rss->title = "AUR Newest Packages";
|
$rss->title = "AUR Newest Packages";
|
||||||
$rss->description = "The latest and greatest packages in the AUR";
|
$rss->description = "The latest and greatest packages in the AUR";
|
||||||
|
@ -49,5 +55,7 @@ while ($row = mysql_fetch_assoc($result)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#save it so that useCached() can find it
|
#save it so that useCached() can find it
|
||||||
$rss->saveFeed("/tmp/aur-newestpkg.xml",true);
|
$feedContent = $rss->createFeed();
|
||||||
|
set_cache_value($feed_key, $feedContent, 1800);
|
||||||
|
echo $feedContent;
|
||||||
|
?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue