]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 25 Sep 2013 21:07:57 +0000 (23:07 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 25 Sep 2013 21:07:57 +0000 (23:07 +0200)
1  2 
utils/update.php

diff --combined utils/update.php
index 270850f93b4cec6197db67f4c326b28d4f9ff3c0,533b48d69cec465dcdf71ad6e90da19939f8f2b1..9a509fdfd00e52e403afc31b6ba1789964afda0e
@@@ -47,6 -47,7 +47,6 @@@
                showUsage($aCMDOptions, true, 'Select either import of hourly or daily');
        }
  
 -      if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
        if (!isset($aResult['index-rank'])) $aResult['index-rank'] = 0;
  
  /*
  
        if ($aResult['index'])
        {
 +              if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
                passthru(CONST_BasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -t '.$aResult['index-instances'].' -r '.$aResult['index-rank']);
        }
  
                $sCMDDownload = $sOsmosisCMD.' --read-replication-interval workingDirectory='.$sOsmosisConfigDirectory.' --simplify-change --write-xml-change '.$sImportFile;
                $sCMDCheckReplicationLag = $sOsmosisCMD.' -q --read-replication-lag workingDirectory='.$sOsmosisConfigDirectory;
                $sCMDImport = $sOsm2pgsqlCmd.' '.$sImportFile;
 -              $sCMDIndex = $sBasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -t '.$aResult['index-instances'];
 +              $sCMDIndex = $sBasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'];
                if (!$aResult['no-npi']) {
                        $sCMDIndex .= '-F ';
                }
                                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')";
                        $sBatchEnd = getosmosistimestamp($sOsmosisConfigDirectory);
  
                        // Index file
 -                      $sThisIndexCmd = $sCMDIndex;
 +                      if (!isset($aResult['index-instances']))
 +                      {
 +                              if (getLoadAverage() < 15)
 +                                      $iIndexInstances = 2;
 +                              else
 +                                      $iIndexInstances = 1;
 +                      } else
 +                              $iIndexInstances = $aResult['index-instances'];
 +
 +                      $sThisIndexCmd = $sCMDIndex.' -t '.$iIndexInstances;
  
                        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",