From: Sarah Hoffmann Date: Wed, 20 Apr 2016 22:00:15 +0000 (+0200) Subject: apply marker filtering to functions.sql also after table creation X-Git-Tag: v3.0.0~178 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/b4f0b8b72834d13f093672c144507d589fdd87f8 apply marker filtering to functions.sql also after table creation fixes #430 --- diff --git a/utils/setup.php b/utils/setup.php index cfe7f560..4a2bc64f 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -217,29 +217,7 @@ echo "Functions\n"; $bDidSomething = true; if (!file_exists(CONST_InstallPath.'/module/nominatim.so')) fail("nominatim module not built"); - $sTemplate = file_get_contents(CONST_BasePath.'/sql/functions.sql'); - $sTemplate = str_replace('{modulepath}', CONST_InstallPath.'/module', $sTemplate); - if ($aCMDResult['enable-diff-updates']) - { - $sTemplate = str_replace('RETURN NEW; -- %DIFFUPDATES%', '--', $sTemplate); - } - if ($aCMDResult['enable-debug-statements']) - { - $sTemplate = str_replace('--DEBUG:', '', $sTemplate); - } - if (CONST_Limit_Reindexing) - { - $sTemplate = str_replace('--LIMIT INDEXING:', '', $sTemplate); - } - if (!CONST_Use_US_Tiger_Data) - { - $sTemplate = str_replace('-- %NOTIGERDATA% ', '', $sTemplate); - } - if (!CONST_Use_Aux_Location_data) - { - $sTemplate = str_replace('-- %NOAUXDATA% ', '', $sTemplate); - } - pgsqlRunScript($sTemplate); + create_sql_functions(); } if ($aCMDResult['create-tables'] || $aCMDResult['all']) @@ -265,10 +243,7 @@ // re-run the functions echo "Functions\n"; - $sTemplate = file_get_contents(CONST_BasePath.'/sql/functions.sql'); - $sTemplate = str_replace('{modulepath}', - CONST_InstallPath.'/module', $sTemplate); - pgsqlRunScript($sTemplate); + create_sql_functions(); } if ($aCMDResult['create-partition-tables'] || $aCMDResult['all']) @@ -943,3 +918,31 @@ return $sSql; } + function create_sql_functions() + { + $sTemplate = file_get_contents(CONST_BasePath.'/sql/functions.sql'); + $sTemplate = str_replace('{modulepath}', CONST_InstallPath.'/module', $sTemplate); + if ($aCMDResult['enable-diff-updates']) + { + $sTemplate = str_replace('RETURN NEW; -- %DIFFUPDATES%', '--', $sTemplate); + } + if ($aCMDResult['enable-debug-statements']) + { + $sTemplate = str_replace('--DEBUG:', '', $sTemplate); + } + if (CONST_Limit_Reindexing) + { + $sTemplate = str_replace('--LIMIT INDEXING:', '', $sTemplate); + } + if (!CONST_Use_US_Tiger_Data) + { + $sTemplate = str_replace('-- %NOTIGERDATA% ', '', $sTemplate); + } + if (!CONST_Use_Aux_Location_data) + { + $sTemplate = str_replace('-- %NOAUXDATA% ', '', $sTemplate); + } + pgsqlRunScript($sTemplate); + + } +