# # # rename "rss_feeds.inc.php" # to "config.inc.php-dist" # # patch "config.inc.php-dist" # from [56645780f393c06f168f7a7232d31cae2698b6a1] # to [d819c2da2b5b73de6e53312a8fb4170d99a4950a] # # patch "downloads.php" # from [a2a7c55e8d426804a8b5faf87060156c353623f6] # to [c9b7fe46150ba619f74164e65a6092a141151142] # # patch "index.php" # from [b86a7dae10c1676c3afb5ad1bb476a53f7671d8d] # to [e554e31b2103838a45c7cfdf996147d4eca24963] # # patch "intheblogs.php" # from [f68ffc2b735fec71754ae6d91348e7962ee51db9] # to [898c3065df85332e9883ab87ea8dfa08354f6caa] # ============================================================ --- rss_feeds.inc.php 56645780f393c06f168f7a7232d31cae2698b6a1 +++ config.inc.php-dist d819c2da2b5b73de6e53312a8fb4170d99a4950a @@ -1,6 +1,28 @@ "/monotone-%version%\.tar\.gz/", + "Linux x86/glibc 2.3" => "/mtn-%version%-linux-x86\.bz2/", + "Windows Installer" => "/monotone-%version%-setup\.exe/", + "Mac OS X Installer" => "/monotone-%version%\.dmg/", + "Mac OS X Binary" => "/mtn-%version%-osx(-univ)?\.bz2/", + "Solaris Package" => "/PMmonotone-%version%\.(i386|sparc)\.pkg/", +); ============================================================ --- downloads.php a2a7c55e8d426804a8b5faf87060156c353623f6 +++ downloads.php c9b7fe46150ba619f74164e65a6092a141151142 @@ -1,45 +1,32 @@ "/monotone-%version%\.tar\.gz/", - "Linux x86/glibc 2.3" => "/mtn-%version%-linux-x86\.bz2/", - "Windows Installer" => "/monotone-%version%-setup\.exe/", - "Mac OS X Installer" => "/monotone-%version%\.dmg/", - "Mac OS X Binary" => "/mtn-%version%-osx(-univ)?\.bz2/", - "Solaris Package" => "/PMmonotone-%version%\.(i386|sparc)\.pkg/", -); +require_once("config.inc.php"); -$webdir = "/downloads"; -$basedir = dirname(__FILE__) . "/downloads"; -$cachedir = "/data/monotone.ca/cache"; -$releaseDirs = scandir($basedir, 1); - function getLatestFiles() { - global $matchers, $webdir, $basedir, $releaseDirs; + global $CFG; + $releaseDirs = scandir($CFG['download_dir'], 1); + $latestFiles = array(); $matchedTypes = array(); foreach ($releaseDirs as $dir) { - if (!is_dir("$basedir/$dir") || $dir == "." || $dir == "..") + if (!is_dir("{$CFG['download_dir']}/$dir") || $dir == "." || $dir == "..") continue; // a little optimization - if (count($matchedTypes) == count($matchers)) + if (count($matchedTypes) == count($CFG['download_matchers'])) break; - $files = scandir("$basedir/$dir", 1); + $files = scandir("{$CFG['download_dir']}/$dir", 1); $release = $dir; $newlyMatchedTypes = array(); foreach ($files as $file) { - foreach ($matchers as $type => $matcher) + foreach ($CFG['download_matchers'] as $type => $matcher) { if (preg_match(str_replace("%version%", $release, $matcher), $file) && !in_array($type, $matchedTypes)) @@ -61,17 +48,19 @@ function getAllFiles($type) function getAllFiles($type) { - global $matchers, $webdir, $basedir, $releaseDirs; + global $CFG; - $matcher = $matchers[$type]; + $matcher = $CFG['download_matchers'][$type]; $allFiles = array(); + $releaseDirs = scandir($CFG['download_dir'], 1); + foreach ($releaseDirs as $dir) { - if (!is_dir("$basedir/$dir") || $dir == "." || $dir == "..") + if (!is_dir("{$CFG['download_dir']}/$dir") || $dir == "." || $dir == "..") continue; - $files = scandir("$basedir/$dir", 1); + $files = scandir("{$CFG['download_dir']}/$dir", 1); $release = $dir; foreach ($files as $file) @@ -138,7 +127,7 @@ $type = isset($_GET['type']) && No files found

get($file); + list($size, $sha1) = + cache::instance($CFG['download_dir'], $CFG['cache_dir']) + ->get($file); $size = round($size / (1024*1024), 2)."MB"; echo << - $name ($size, SHA1 $sha1)
+ $name ($size, SHA1 $sha1)
» all downloads of this type END; @@ -184,11 +175,13 @@ END; foreach ($allFiles as $file): $name = basename($file); $release = dirname($file); - list($size, $sha1) = cache::instance($basedir, $cachedir)->get($file); + list($size, $sha1) = + cache::instance($CFG['download_dir'], $CFG['cache_dir']) + ->get($file); $size = round($size / (1024*1024), 2)."MB"; echo << - $name ($size, SHA1 $sha1)
+ $name ($size, SHA1 $sha1)
END; endforeach; ============================================================ --- index.php b86a7dae10c1676c3afb5ad1bb476a53f7671d8d +++ index.php e554e31b2103838a45c7cfdf996147d4eca24963 @@ -1,5 +1,7 @@
@@ -72,10 +74,9 @@ require_once("header.inc.php");

Monotone in the blogs

set_feed_url(require_once("rss_feeds.inc.php")); + $feed->set_cache_location($CFG['cache_dir']); + $feed->set_feed_url($CFG['aggregated_feeds']); $feed->set_item_limit(3); $feed->init(); $feed->handle_content_type(); ============================================================ --- intheblogs.php f68ffc2b735fec71754ae6d91348e7962ee51db9 +++ intheblogs.php 898c3065df85332e9883ab87ea8dfa08354f6caa @@ -1,17 +1,17 @@

Monotone in the blogs

set_feed_url(require_once("rss_feeds.inc.php")); + $feed->set_cache_location($CFG['cache_dir']); + $feed->set_feed_url($CFG['aggregated_feeds']); $feed->init(); $feed->handle_content_type();