probe for php_cgi in cmake to be used for querying

This commit is contained in:
Sarah Hoffmann
2021-01-17 22:03:54 +01:00
parent 3475e1dfd6
commit 5d95a72758
3 changed files with 24 additions and 8 deletions

View File

@@ -86,8 +86,19 @@ if (BUILD_API OR BUILD_IMPORTER)
# sanity check if PHP binary exists # sanity check if PHP binary exists
if (NOT EXISTS ${PHP_BIN}) if (NOT EXISTS ${PHP_BIN})
message(FATAL_ERROR "PHP binary not found. Install php or provide location with -DPHP_BIN=/path/php ") message(FATAL_ERROR "PHP binary not found. Install php or provide location with -DPHP_BIN=/path/php ")
else()
message (STATUS "Using PHP binary " ${PHP_BIN})
endif()
if (NOT PHPCGI_BIN)
find_program (PHPCGI_BIN php-cgi)
endif()
# sanity check if PHP binary exists
if (NOT EXISTS ${PHPCGI_BIN})
message(WARNING "php-cgi binary not found. nominatim tool will not provide query functions.")
set (PHPCGI_BIN "")
else()
message (STATUS "Using php-cgi binary " ${PHPCGI_BIN})
endif() endif()
message (STATUS "Using PHP binary " ${PHP_BIN})
endif() endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

View File

@@ -11,4 +11,5 @@ from nominatim import cli
exit(cli.nominatim(module_dir='@CMAKE_BINARY_DIR@/module', exit(cli.nominatim(module_dir='@CMAKE_BINARY_DIR@/module',
osm2pgsql_path='@CMAKE_BINARY_DIR@/osm2pgsql/osm2pgsql', osm2pgsql_path='@CMAKE_BINARY_DIR@/osm2pgsql/osm2pgsql',
phplib_dir='@CMAKE_SOURCE_DIR@/lib', phplib_dir='@CMAKE_SOURCE_DIR@/lib',
data_dir='@CMAKE_SOURCE_DIR@')) data_dir='@CMAKE_SOURCE_DIR@',
phpcgi_path='@PHPCGI_BIN@'))

View File

@@ -435,7 +435,7 @@ class AdminWarm:
class QueryExport: class QueryExport:
"""\ """\
Export addresses as CSV file from a Nominatim database. Export addresses as CSV file from the database.
""" """
@staticmethod @staticmethod
@@ -522,10 +522,14 @@ def nominatim(**kwargs):
parser.add_subcommand('refresh', UpdateRefresh) parser.add_subcommand('refresh', UpdateRefresh)
parser.add_subcommand('export', QueryExport) parser.add_subcommand('export', QueryExport)
parser.add_subcommand('search', QueryTodo)
parser.add_subcommand('reverse', QueryTodo) if kwargs.get('phpcgi_path'):
parser.add_subcommand('lookup', QueryTodo) parser.add_subcommand('search', QueryTodo)
parser.add_subcommand('details', QueryTodo) parser.add_subcommand('reverse', QueryTodo)
parser.add_subcommand('status', QueryTodo) parser.add_subcommand('lookup', QueryTodo)
parser.add_subcommand('details', QueryTodo)
parser.add_subcommand('status', QueryTodo)
else:
parser.parser.epilog = 'php-cgi not found. Query commands not available.'
return parser.run(**kwargs) return parser.run(**kwargs)