]> git.openstreetmap.org Git - nominatim.git/commitdiff
Format of replicate-sequence URL has changed
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 15 Apr 2012 15:45:01 +0000 (17:45 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 15 Apr 2012 15:45:01 +0000 (17:45 +0200)
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

index b1c7e5a878dc168fb529fd7f8e0a60b9c508ef06..d7aa3bc7be97cc0ff4bf7dcc2eed6bb4f5354db8 100755 (executable)
        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'])