From b4f0b8b72834d13f093672c144507d589fdd87f8 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 21 Apr 2016 00:00:15 +0200 Subject: [PATCH] apply marker filtering to functions.sql also after table creation fixes #430 --- utils/setup.php | 57 ++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 27 deletions(-) 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); + + } + -- 2.39.5