mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
feat: Added reverse-only-search validation
This commit is contained in:
@@ -94,6 +94,6 @@ class UpdateRefresh:
|
||||
if args.website:
|
||||
webdir = args.project_dir / 'website'
|
||||
LOG.warning('Setting up website directory at %s', webdir)
|
||||
refresh.setup_website(webdir, args.config)
|
||||
|
||||
with connect(args.config.get_libpq_dsn()) as conn:
|
||||
refresh.setup_website(webdir, args.config, conn)
|
||||
return 0
|
||||
|
||||
@@ -139,7 +139,8 @@ class SetupAll:
|
||||
|
||||
webdir = args.project_dir / 'website'
|
||||
LOG.warning('Setup website at %s', webdir)
|
||||
refresh.setup_website(webdir, args.config)
|
||||
with connect(args.config.get_libpq_dsn()) as conn:
|
||||
refresh.setup_website(webdir, args.config, conn)
|
||||
|
||||
with connect(args.config.get_libpq_dsn()) as conn:
|
||||
try:
|
||||
|
||||
@@ -155,7 +155,7 @@ def recompute_importance(conn):
|
||||
conn.commit()
|
||||
|
||||
|
||||
def setup_website(basedir, config):
|
||||
def setup_website(basedir, config, conn):
|
||||
""" Create the website script stubs.
|
||||
"""
|
||||
if not basedir.exists():
|
||||
@@ -187,5 +187,10 @@ def setup_website(basedir, config):
|
||||
|
||||
template += "\nrequire_once('{}/website/{{}}');\n".format(config.lib_dir.php)
|
||||
|
||||
search_name_table_exists = bool(conn and conn.table_exists('search_name'))
|
||||
|
||||
for script in WEBSITE_SCRIPTS:
|
||||
(basedir / script).write_text(template.format(script), 'utf-8')
|
||||
if not search_name_table_exists and script == 'search.php':
|
||||
(basedir / script).write_text(template.format('reverse-only-search.php'), 'utf-8')
|
||||
else:
|
||||
(basedir / script).write_text(template.format(script), 'utf-8')
|
||||
|
||||
Reference in New Issue
Block a user