diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-04-21 13:43:50 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-04-21 13:43:50 +0000 |
commit | 211458079c1c3f3204eb163159775f86d7ff0836 (patch) | |
tree | c547bbfd19ee59fcc51e7778ef0e7106443e7daa | |
parent | cb3022eb0014459cbbe24064630c9430cad3f7ec (diff) | |
download | website-211458079c1c3f3204eb163159775f86d7ff0836.tar.gz website-211458079c1c3f3204eb163159775f86d7ff0836.tar.bz2 website-211458079c1c3f3204eb163159775f86d7ff0836.tar.xz website-211458079c1c3f3204eb163159775f86d7ff0836.zip |
Fetching news every hour using cronjob. I hope it works.
-rwxr-xr-x | includes/fetch-news.sh | 8 | ||||
-rw-r--r-- | includes/news.php | 11 |
2 files changed, 17 insertions, 2 deletions
diff --git a/includes/fetch-news.sh b/includes/fetch-news.sh new file mode 100755 index 0000000..02c11b2 --- /dev/null +++ b/includes/fetch-news.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# Fetches project news and saves it for local use. +# + +/usr/bin/wget -q -O /home/groups/t/th/themanaworld/htdocs/includes/rss2_projnews.tmp 'http://sourceforge.net/export/rss2_projnews.php?group_id=106790&rss_fulltext=1' > /dev/null +/bin/mv -f /home/groups/t/th/themanaworld/htdocs/includes/rss2_projnews.tmp \ + /home/groups/t/th/themanaworld/htdocs/includes/rss2_projnews.cache diff --git a/includes/news.php b/includes/news.php index 52ad91e..f064b62 100644 --- a/includes/news.php +++ b/includes/news.php @@ -3,11 +3,18 @@ // This code uses the "DOM XML" extension, which is only available with PHP 4. // Be sure to update it to use the "XML", "DOM" or "XMLReader" extensions when // SF upgrades to PHP 5. +// +// The news is cached locally using a cronjob which runs in the 9th minute of +// every hour: +// +// 9 * * * * /home/groups/t/th/themanaworld/htdocs/includes/fetch-news.sh +// -$feedurl = "http://sourceforge.net/export/rss2_projnews.php?group_id=106790&rss_fulltext=1"; +//$feedurl = "http://sourceforge.net/export/rss2_projnews.php?group_id=106790&rss_fulltext=1"; +$feedurl = "includes/rss2_projnews.cache"; if (!$dom = domxml_open_file($feedurl)) { - echo "Error while fetching news feed.\n"; + echo "Error while opening news feed.\n"; exit; } |