From a6de17c0e01ffc29992c789da42ea1fe68370296 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Fri, 1 Jan 2016 13:46:43 +0000 Subject: [PATCH] Fix planet mirror script run before new year planetdump --- .../templates/default/planet-mirror-redirect-update.erb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cookbooks/planet/templates/default/planet-mirror-redirect-update.erb b/cookbooks/planet/templates/default/planet-mirror-redirect-update.erb index c673998e6..2644889ad 100644 --- a/cookbooks/planet/templates/default/planet-mirror-redirect-update.erb +++ b/cookbooks/planet/templates/default/planet-mirror-redirect-update.erb @@ -11,7 +11,7 @@ $_YEAR = date('Y'); $_PLANET_FOLDER = '<%= node[:planet][:dump][:xml_directory] %>/'.$_YEAR.'/'; $_PLANET_REGEX = "/^(planet|changesets)\-\d{6}(\-nolt)?\.osm\.(bz2|gz)$/"; $_MIRROR = 'http://ftp.heanet.ie/mirrors/openstreetmap.org/planet/'.$_YEAR.'/'; -$_PLANET_HTACCESS = realpath($_PLANET_FOLDER.'../..').'/.htaccess'; +$_PLANET_HTACCESS = realpath('<%= node[:planet][:dump][:xml_directory] %>/..').'/.htaccess'; function _MIRROR_FILE_SIZE($url) { $ch = @curl_init(); @@ -34,9 +34,7 @@ if (is_dir($_PLANET_FOLDER)) { if (preg_match($_PLANET_REGEX,$file)) { $file_slashed = 'planet/'.$_YEAR.'/'.str_replace(array('.','-'), array('\.','\-'), $file); if (strpos($htaccess_contents,$file_slashed) === false) { - //PHP IS BRAINDEAD filesize borked >4GB - //$file_size = $file_stats['size']; - $file_size = trim(`stat -c%s $_PLANET_FOLDER$file`); + $file_size = filesize($_PLANET_FOLDER$file); sleep(rand(2,5)); $file_mirror_size = _MIRROR_FILE_SIZE($_MIRROR.$file); if ($file_size==$file_mirror_size) { -- 2.39.5