]> git.openstreetmap.org Git - nominatim.git/blobdiff - utils/update.php
set start time for indexing step
[nominatim.git] / utils / update.php
index 93b5ab0919db374dab7da461f830c19d451985bc..ac7b5be842912ffd7c77dd7ecc48bd1606b217d1 100755 (executable)
 
        if ($aResult['import-osmosis'] || $aResult['import-osmosis-all'])
        {
+
+               if (strpos(CONST_Replication_Url, 'download.geofabrik.de') !== false && CONST_Replication_Update_Interval < 86400) {
+                       echo "Error: Update interval too low for download.geofabrik.de.  Please check install documentation (http://wiki.openstreetmap.org/wiki/Nominatim/Installation#Updates)\n";
+                       exit;
+               }
+
                $sImportFile = CONST_BasePath.'/data/osmosischange.osc';
                $sOsmosisCMD = CONST_Osmosis_Binary;
                $sOsmosisConfigDirectory = CONST_BasePath.'/settings';
                                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')";
 
                        // Index file
                        $sThisIndexCmd = $sCMDIndex;
+                        $fCMDStartTime = time();
 
                        if (!$aResult['no-npi'])
                        {
                                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);
                                if ($iErrorLevel)
                                {
                                        echo "Error: $iErrorLevel\n";
-                                       exit;
+                                       exit($iErrorLevel);
                                }
 
                                if (!$aResult['no-npi'])
                                        if ($iErrorLevel)
                                        {
                                                echo "Error: $iErrorLevel\n";
-                                               exit;
+                                               exit($iErrorLevel);
                                        }
 
                                        rename($sFileDir.'/'.str_pad($iFileID % 1000, 3, '0', STR_PAD_LEFT).".npi.out.bz2",
 
                        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
                        {