index : archweb32 | |
Archlinux32 website | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-10-31 20:39:40 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-10-31 20:40:17 +0100 |
commit | a674e136827d1d2a6459402ce634080011127ee7 (patch) | |
tree | 25149af5c1aacb7f99009ea43188e38b2e893b4c | |
parent | 580e190f5b2ee47178af454e638730ad98dea7d1 (diff) |
-rw-r--r-- | index.php | 27 |
@@ -4,6 +4,7 @@ require_once "init.php"; require_once BASE . "/lib/mysql.php"; require_once BASE . "/lib/style.php"; require_once BASE . "/lib/format.php"; +require_once BASE . "/lib/helper.php"; $result = mysql_run_query( 'SELECT `binary_packages`.`pkgname`,' . @@ -72,13 +73,25 @@ print_header("", "home"); <a href="https://news.archlinux32.org/rss.php" title="Arch 32 News RSS Feed" class="rss-icon"><img width="16" height="16" src="/static/rss.c5ebdc5318d6.png" alt="RSS Feed" /></a> <?php -$ch = curl_init("https://news.archlinux32.org/rss.php"); -curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); -curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); -curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); -$news32 = curl_exec($ch); -curl_close($ch); -$news32 = simplexml_load_string($news32); +$news_reachable = apcu_fetch('news_reachable', $apcu_success); +if ($apcu_success == false) { + if (site_is_reachable('https://news.archlinux32.org/rss.php')) + $news_reachable = 'YES'; + else + $news_reachable = 'NO'; + apcu_store('news_reachable', $news_reachable, 300); +} +if ($news_reachable == 'YES') { + $ch = curl_init('https://news.archlinux32.org/rss.php'); + curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); + $news32 = curl_exec($ch); + curl_close($ch); + $news32 = simplexml_load_string($news32); +} else { + $news32 = false; +} $ch = curl_init("https://www.archlinux.org/feeds/news/"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |