From 653c05329d17f9adc2e12257238717d8500ecdb6 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 15 Apr 2012 17:45:01 +0200 Subject: [PATCH] Format of replicate-sequence URL has changed Additionally update/init import_status in the DB. If this is not initialized here, subsequent updates of the status won't work. --- utils/setup.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/utils/setup.php b/utils/setup.php index b1c7e5a8..d7aa3bc7 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -360,17 +360,27 @@ if (($aCMDResult['osmosis-init'] || $aCMDResult['all']) && isset($aCMDResult['osmosis-init-date'])) { $bDidSomething = true; + $oDB =& getDB(); if (!file_exists(CONST_Osmosis_Binary)) fail("please download osmosis"); if (file_exists(CONST_BasePath.'/settings/configuration.txt')) echo "settings/configuration.txt already exists\n"; else passthru(CONST_Osmosis_Binary.' --read-replication-interval-init '.CONST_BasePath.'/settings'); $sDate = $aCMDResult['osmosis-init-date']; - $sURL = 'http://toolserver.org/~mazder/replicate-sequences/?'.$sDate; + $aDate = date_parse_from_format("Y-m-d\TH-i", $sDate); + $sURL = 'http://toolserver.org/~mazder/replicate-sequences/?'; + $sURL .= 'Y='.$aDate['year'].'&m='.$aDate['month'].'&d='.$aDate['day']; + $sURL .= '&H='.$aDate['hour'].'&i='.$aDate['minute'].'&s=0'; + $sURL .= '&stream=minute'; echo "Getting state file: $sURL\n"; $sStateFile = file_get_contents($sURL); if (!$sStateFile || strlen($sStateFile) > 1000) fail("unable to obtain state file"); file_put_contents(CONST_BasePath.'/settings/state.txt', $sStateFile); + echo "Updating DB status\n"; + pg_query($oDB->connection, 'TRUNCATE import_status'); + $sSQL = "INSERT INTO import_status VALUES('".$sDate."')"; + pg_query($oDB->connection, $sSQL); + } if ($aCMDResult['index'] || $aCMDResult['all']) -- 2.39.5