]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge branch 'master' of github.com:twain47/Nominatim
authorBrian Quinion <openstreetmap@brian.quinion.co.uk>
Wed, 23 May 2012 23:43:23 +0000 (01:43 +0200)
committerBrian Quinion <openstreetmap@brian.quinion.co.uk>
Wed, 23 May 2012 23:43:23 +0000 (01:43 +0200)
1  2 
utils/setup.php

diff --combined utils/setup.php
index c655eac053e11ecc0d4bff5df4e59b95b9a83f75,1deb060a433cc6b8b8df9885ad2bb794a5ad732a..4de5953f7a0e935298e8d760e55ad00a83407be8
                $bDidSomething = true;
  
                $osm2pgsql = CONST_Osm2pgsql_Binary;
-               if (!file_exists($osm2pgsql)) fail("please download and build osm2pgsql");
+               if (!file_exists($osm2pgsql))
+               {
+                       echo "Please download and build osm2pgsql.\nIf it is already installed, check the path in your local settings (settings/local.php) file.\n";
+                       fail("osm2pgsql not found in '$osm2pgsql'");
+               }
                $osm2pgsql .= ' -lsc -O gazetteer --hstore';
                $osm2pgsql .= ' -C '.$iCacheMemory;
                $osm2pgsql .= ' -d '.$aDSNInfo['database'].' '.$aCMDResult['osm-file'];
                if (!pg_query($oDB->connection, 'CREATE SEQUENCE seq_place start 100000')) fail(pg_last_error($oDB->connection));
                echo '.';
  
 +              $sSQL = 'select partition from country_name order by country_code';
 +              $aPartitions = $oDB->getCol($sSQL);
 +              if (PEAR::isError($aPartitions))
 +              {
 +                      fail($aPartitions->getMessage());
 +              }
 +              $aPartitions[] = 0;
 +              foreach($aPartitions as $sPartition)
 +              {
 +                      if (!pg_query($oDB->connection, 'TRUNCATE location_road_'.$sPartition)) fail(pg_last_error($oDB->connection));
 +                      echo '.';
 +              }
 +
                // pre-create the word list
                if (!$aCMDResult['disable-token-precalc'])
                {
        {
                $bDidSomething = true;
                $sTargetDir = $aCMDResult['create-website'];
-               if (!is_dir($sTargetDir)) fail('please specify a directory to setup');
+               if (!is_dir($sTargetDir))
+               {
+                       echo "You must create the website directory before calling this function.\n";
+                       fail("Target directory does not exist.");
+               }
                @symlink(CONST_BasePath.'/website/details.php', $sTargetDir.'/details.php');
                @symlink(CONST_BasePath.'/website/reverse.php', $sTargetDir.'/reverse.php');
                @symlink(CONST_BasePath.'/website/search.php', $sTargetDir.'/search.php');