From 8c4bcd36ead869e1154a4528d7a0e2ac8a4e41b2 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Tue, 29 Aug 2017 21:04:28 +0200 Subject: [PATCH] check that replication URL points to a repo of OSM diffs Also check that pyosmium does not return None to work around a bad return code in the current release of pyosmium-get-changes. Fixes #784. --- utils/update.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/utils/update.php b/utils/update.php index d8611715..3cc9cdd6 100755 --- a/utils/update.php +++ b/utils/update.php @@ -59,6 +59,13 @@ if (!is_null(CONST_Osm2pgsql_Flatnode_File)) { } if ($aResult['init-updates']) { + // sanity check that the replication URL is correct + $sBaseState = file_get_contents(CONST_Replication_Url.'/state.txt'); + if ($sBaseState === false) { + echo "\nCannot find state.txt file at the configured replication URL.\n"; + echo "Does the URL point to a directory containing OSM update data?\n\n"; + fail("replication URL not reachable."); + } $sSetup = CONST_InstallPath.'/utils/setup.php'; $iRet = -1; passthru($sSetup.' --create-functions --enable-diff-updates', $iRet); @@ -75,9 +82,9 @@ if ($aResult['init-updates']) { // get the appropriate state id $aOutput = 0; - exec(CONST_Pyosmium_Binary.' -D '.$sWindBack.' --server '.CONST_Replication_Url, - $aOutput, $iRet); - if ($iRet != 0) { + $sCmd = CONST_Pyosmium_Binary.' -D '.$sWindBack.' --server '.CONST_Replication_Url; + exec($sCmd, $aOutput, $iRet); + if ($iRet != 0 || $aOutput[0] == 'None') { fail('Error running pyosmium tools'); } -- 2.45.1