mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-30 22:09:31 +03:00
Merge pull request #1258 from lonvia/cleanup-utils
Restructure script and website installation
This commit is contained in:
commit
ec4e3c36af
@ -93,8 +93,7 @@ message (STATUS "Using PHP binary " ${PHP_BIN})
|
|||||||
#
|
#
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
set(CUSTOMFILES
|
set(WEBSITESCRIPTS
|
||||||
settings/phrase_settings.php
|
|
||||||
website/deletable.php
|
website/deletable.php
|
||||||
website/details.php
|
website/details.php
|
||||||
website/hierarchy.php
|
website/hierarchy.php
|
||||||
@ -103,23 +102,31 @@ set(CUSTOMFILES
|
|||||||
website/reverse.php
|
website/reverse.php
|
||||||
website/search.php
|
website/search.php
|
||||||
website/status.php
|
website/status.php
|
||||||
utils/blocks.php
|
)
|
||||||
|
|
||||||
|
set(CUSTOMSCRIPTS
|
||||||
utils/country_languages.php
|
utils/country_languages.php
|
||||||
utils/importWikipedia.php
|
utils/importWikipedia.php
|
||||||
utils/export.php
|
utils/export.php
|
||||||
utils/query.php
|
utils/query.php
|
||||||
utils/server_compare.php
|
|
||||||
utils/setup.php
|
utils/setup.php
|
||||||
utils/specialphrases.php
|
utils/specialphrases.php
|
||||||
utils/update.php
|
utils/update.php
|
||||||
utils/warm.php
|
utils/warm.php
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach (cfile ${CUSTOMFILES})
|
foreach (script_source ${CUSTOMSCRIPTS})
|
||||||
configure_file(${PROJECT_SOURCE_DIR}/${cfile} ${PROJECT_BINARY_DIR}/${cfile})
|
configure_file(${PROJECT_SOURCE_DIR}/cmake/script.tmpl
|
||||||
|
${PROJECT_BINARY_DIR}/${script_source})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php ${PROJECT_BINARY_DIR}/settings/settings.php)
|
foreach (script_source ${WEBSITESCRIPTS})
|
||||||
|
configure_file(${PROJECT_SOURCE_DIR}/cmake/website.tmpl
|
||||||
|
${PROJECT_BINARY_DIR}/${script_source})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php
|
||||||
|
${PROJECT_BINARY_DIR}/settings/settings.php)
|
||||||
|
|
||||||
set(WEBPATHS css images js)
|
set(WEBPATHS css images js)
|
||||||
|
|
||||||
|
4
cmake/script.tmpl
Executable file
4
cmake/script.tmpl
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!@PHP_BIN@ -Cq
|
||||||
|
<?php
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
|
require_once(CONST_BasePath.'/@script_source@');
|
3
cmake/website.tmpl
Executable file
3
cmake/website.tmpl
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
|
require_once(CONST_BasePath.'/@script_source@');
|
@ -49,6 +49,7 @@ if (isset($_GET['debug']) && $_GET['debug']) @define('CONST_Debug', true);
|
|||||||
@define('CONST_Pyosmium_Binary', '@PYOSMIUM_PATH@');
|
@define('CONST_Pyosmium_Binary', '@PYOSMIUM_PATH@');
|
||||||
@define('CONST_Tiger_Data_Path', CONST_ExtraDataPath.'/tiger');
|
@define('CONST_Tiger_Data_Path', CONST_ExtraDataPath.'/tiger');
|
||||||
@define('CONST_Wikipedia_Data_Path', CONST_ExtraDataPath);
|
@define('CONST_Wikipedia_Data_Path', CONST_ExtraDataPath);
|
||||||
|
@define('CONST_Phrase_Config', CONST_BasePath.'/settings/phrase_settings.php');
|
||||||
@define('CONST_Address_Level_Config', CONST_BasePath.'/settings/address-levels.json');
|
@define('CONST_Address_Level_Config', CONST_BasePath.'/settings/address-levels.json');
|
||||||
|
|
||||||
// osm2pgsql settings
|
// osm2pgsql settings
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
echo "ERROR: Scripts must be run from build directory.\n";
|
|
||||||
exit(1);
|
|
@ -1,55 +0,0 @@
|
|||||||
#!@PHP_BIN@ -Cq
|
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
|
||||||
ini_set('memory_limit', '800M');
|
|
||||||
|
|
||||||
$aCMDOptions
|
|
||||||
= array(
|
|
||||||
'Manage service blocks / restrictions',
|
|
||||||
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
|
||||||
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
|
||||||
array('verbose', 'v', 0, 1, 0, 0, 'bool', 'Verbose output'),
|
|
||||||
array('list', 'l', 0, 1, 0, 0, 'bool', 'List recent blocks'),
|
|
||||||
array('delete', 'd', 0, 1, 0, 0, 'bool', 'Clear recent blocks list'),
|
|
||||||
array('flush', '', 0, 1, 0, 0, 'bool', 'Flush all blocks / stats'),
|
|
||||||
);
|
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
|
|
||||||
|
|
||||||
$m = getBucketMemcache();
|
|
||||||
if (!$m) {
|
|
||||||
echo "ERROR: Bucket memcache is not configured\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($aResult['list']) {
|
|
||||||
$iCurrentSleeping = $m->get('sleepCounter');
|
|
||||||
echo "\n Sleeping blocks count: $iCurrentSleeping\n";
|
|
||||||
|
|
||||||
$aBlocks = getBucketBlocks();
|
|
||||||
echo "\n";
|
|
||||||
printf(" %-40s | %12s | %7s | %13s | %31s | %8s\n", 'Key', 'Total Blocks', 'Current', 'Still Blocked', 'Last Block Time', 'Sleeping');
|
|
||||||
printf(" %'--40s-|-%'-12s-|-%'-7s-|-%'-13s-|-%'-31s-|-%'-8s\n", '', '', '', '', '', '');
|
|
||||||
foreach ($aBlocks as $sKey => $aDetails) {
|
|
||||||
printf(
|
|
||||||
" %-40s | %12s | %7s | %13s | %31s | %8s\n",
|
|
||||||
$sKey,
|
|
||||||
$aDetails['totalBlocks'],
|
|
||||||
(int)$aDetails['currentBucketSize'],
|
|
||||||
$aDetails['currentlyBlocked']?'Y':'N',
|
|
||||||
date('r', $aDetails['lastBlockTimestamp']),
|
|
||||||
$aDetails['isSleeping']?'Y':'N'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
echo "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($aResult['delete']) {
|
|
||||||
$m->set('sleepCounter', 0);
|
|
||||||
clearBucketBlocks();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($aResult['flush']) {
|
|
||||||
$m->flush();
|
|
||||||
}
|
|
4
utils/country_languages.php
Executable file → Normal file
4
utils/country_languages.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
#!@PHP_BIN@ -Cq
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
|
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
@ -16,7 +14,7 @@ $aCMDOptions
|
|||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
||||||
|
|
||||||
include(CONST_InstallPath.'/settings/phrase_settings.php');
|
include(CONST_Phrase_Config);
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
$sURL = 'https://wiki.openstreetmap.org/wiki/Special:Export/Nominatim/Country_Codes';
|
$sURL = 'https://wiki.openstreetmap.org/wiki/Special:Export/Nominatim/Country_Codes';
|
||||||
|
2
utils/export.php
Executable file → Normal file
2
utils/export.php
Executable file → Normal file
@ -1,10 +1,8 @@
|
|||||||
#!@PHP_BIN@ -Cq
|
|
||||||
<?php
|
<?php
|
||||||
// Script to extract structured city and street data
|
// Script to extract structured city and street data
|
||||||
// from a running nominatim instance as CSV data
|
// from a running nominatim instance as CSV data
|
||||||
|
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
require_once(CONST_BasePath.'/lib/ParameterParser.php');
|
require_once(CONST_BasePath.'/lib/ParameterParser.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
2
utils/importWikipedia.php
Executable file → Normal file
2
utils/importWikipedia.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/php -Cq
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
|
2
utils/query.php
Executable file → Normal file
2
utils/query.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
#!@PHP_BIN@ -Cq
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
require_once(CONST_BasePath.'/lib/Geocode.php');
|
require_once(CONST_BasePath.'/lib/Geocode.php');
|
||||||
require_once(CONST_BasePath.'/lib/ParameterParser.php');
|
require_once(CONST_BasePath.'/lib/ParameterParser.php');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!@PHP_BIN@ -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sFile = 'sample.log.txt'; // Apache log file
|
$sFile = 'sample.log.txt'; // Apache log file
|
||||||
|
5
utils/setup.php
Executable file → Normal file
5
utils/setup.php
Executable file → Normal file
@ -1,11 +1,6 @@
|
|||||||
#!@PHP_BIN@ -Cq
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
// ->indirect via init-cmd.php->/lib/cmd.php for runWithEnv, getCmdOpt
|
|
||||||
// ->indirect via init-cmd.php->/lib/init.php->db.php for &getDB()
|
|
||||||
|
|
||||||
require_once(CONST_BasePath.'/lib/setup/SetupClass.php');
|
require_once(CONST_BasePath.'/lib/setup/SetupClass.php');
|
||||||
require_once(CONST_BasePath.'/lib/setup_functions.php');
|
require_once(CONST_BasePath.'/lib/setup_functions.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
4
utils/specialphrases.php
Executable file → Normal file
4
utils/specialphrases.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
#!@PHP_BIN@ -Cq
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
ini_set('display_errors', 'stderr');
|
ini_set('display_errors', 'stderr');
|
||||||
@ -16,7 +14,7 @@ $aCMDOptions
|
|||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
||||||
|
|
||||||
include(CONST_InstallPath.'/settings/phrase_settings.php');
|
include(CONST_Phrase_Config);
|
||||||
|
|
||||||
if ($aCMDResult['wiki-import']) {
|
if ($aCMDResult['wiki-import']) {
|
||||||
$oNormalizer = Transliterator::createFromRules(CONST_Term_Normalization_Rules);
|
$oNormalizer = Transliterator::createFromRules(CONST_Term_Normalization_Rules);
|
||||||
|
2
utils/update.php
Executable file → Normal file
2
utils/update.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
#!@PHP_BIN@ -Cq
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
require_once(CONST_BasePath.'/lib/setup_functions.php');
|
require_once(CONST_BasePath.'/lib/setup_functions.php');
|
||||||
require_once(CONST_BasePath.'/lib/setup/SetupClass.php');
|
require_once(CONST_BasePath.'/lib/setup/SetupClass.php');
|
||||||
|
2
utils/warm.php
Executable file → Normal file
2
utils/warm.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
#!@PHP_BIN@ -Cq
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
|
1
website/deletable.php
Executable file → Normal file
1
website/deletable.php
Executable file → Normal file
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/output.php');
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
|
2
website/details.php
Executable file → Normal file
2
website/details.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Details');
|
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/output.php');
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
|
2
website/hierarchy.php
Executable file → Normal file
2
website/hierarchy.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Details');
|
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/AddressDetails.php');
|
require_once(CONST_BasePath.'/lib/AddressDetails.php');
|
||||||
|
2
website/lookup.php
Executable file → Normal file
2
website/lookup.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Reverse');
|
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
||||||
|
1
website/polygons.php
Executable file → Normal file
1
website/polygons.php
Executable file → Normal file
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/output.php');
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
|
2
website/reverse.php
Executable file → Normal file
2
website/reverse.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Reverse');
|
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
||||||
|
2
website/search.php
Executable file → Normal file
2
website/search.php
Executable file → Normal file
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Search');
|
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/Geocode.php');
|
require_once(CONST_BasePath.'/lib/Geocode.php');
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Status');
|
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/ParameterParser.php');
|
require_once(CONST_BasePath.'/lib/ParameterParser.php');
|
||||||
require_once(CONST_BasePath.'/lib/Status.php');
|
require_once(CONST_BasePath.'/lib/Status.php');
|
||||||
|
Loading…
Reference in New Issue
Block a user