]> git.openstreetmap.org Git - nominatim.git/blobdiff - utils/update.php
set start time for indexing step
[nominatim.git] / utils / update.php
index fd6acdbbfd69d0497655cb7d1bd240c379ade4fa..ac7b5be842912ffd7c77dd7ecc48bd1606b217d1 100755 (executable)
                        echo "Error: Update interval too low for download.geofabrik.de.  Please check install documentation (http://wiki.openstreetmap.org/wiki/Nominatim/Installation#Updates)\n";
                        exit;
                }
-exit;
 
                $sImportFile = CONST_BasePath.'/data/osmosischange.osc';
                $sOsmosisCMD = CONST_Osmosis_Binary;
@@ -447,7 +446,7 @@ exit;
                                if ($iErrorLevel)
                                {
                                        echo "Error: $iErrorLevel\n";
-                                       exit;
+                                       exit($iErrorLevel);
                                }
                                echo "Completed for $sBatchEnd in ".round((time()-$fCMDStartTime)/60,2)." minutes\n";
                                $sSQL = "INSERT INTO import_osmosis_log values ('$sBatchEnd',$iFileSize,'".date('Y-m-d H:i:s',$fCMDStartTime)."','".date('Y-m-d H:i:s')."','osm2pgsql')";
@@ -462,6 +461,7 @@ exit;
 
                        // Index file
                        $sThisIndexCmd = $sCMDIndex;
+                        $fCMDStartTime = time();
 
                        if (!$aResult['no-npi'])
                        {
@@ -470,7 +470,7 @@ exit;
                                if (PEAR::isError($iFileID))
                                {
                                        echo $iFileID->getMessage()."\n";
-                                       exit;
+                                       exit(-1);
                                } 
                                $sFileDir = CONST_BasePath.'/export/diff/';
                                $sFileDir .= str_pad(floor($iFileID/1000000), 3, '0', STR_PAD_LEFT);
@@ -496,7 +496,7 @@ exit;
                                if ($iErrorLevel)
                                {
                                        echo "Error: $iErrorLevel\n";
-                                       exit;
+                                       exit($iErrorLevel);
                                }
 
                                if (!$aResult['no-npi'])
@@ -511,7 +511,7 @@ exit;
                                        if ($iErrorLevel)
                                        {
                                                echo "Error: $iErrorLevel\n";
-                                               exit;
+                                               exit($iErrorLevel);
                                        }
 
                                        rename($sFileDir.'/'.str_pad($iFileID % 1000, 3, '0', STR_PAD_LEFT).".npi.out.bz2",
@@ -532,7 +532,7 @@ exit;
 
                        if ( CONST_Replication_Update_Interval > 60 )
                        {
-                               $iSleep = round(CONST_Replication_Update_Interval*0.8);
+                               $iSleep = max(0,(strtotime($sBatchEnd)+CONST_Replication_Update_Interval-time()));
                        }
                        else
                        {