]> git.openstreetmap.org Git - nominatim.git/commitdiff
probe for php_cgi in cmake to be used for querying
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 17 Jan 2021 21:03:54 +0000 (22:03 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 19 Jan 2021 18:38:46 +0000 (19:38 +0100)
CMakeLists.txt
cmake/tool.tmpl
nominatim/cli.py

index 3a9ceed91a66e7e56600d01eef3e23a95395ab29..c6f63a8b4366e146570ad2b34d33e486087886b4 100644 (file)
@@ -86,8 +86,19 @@ if (BUILD_API OR BUILD_IMPORTER)
     # sanity check if PHP binary exists
     if (NOT EXISTS ${PHP_BIN})
         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()
-    message (STATUS "Using PHP binary " ${PHP_BIN})
 endif()
 
 #-----------------------------------------------------------------------------
index 43646792d19d8824753a331f39b3111fa1d6f357..3bba72c3a585e81d2b44539e64f4a6ff47bf3eab 100755 (executable)
@@ -11,4 +11,5 @@ from nominatim import cli
 exit(cli.nominatim(module_dir='@CMAKE_BINARY_DIR@/module',
                    osm2pgsql_path='@CMAKE_BINARY_DIR@/osm2pgsql/osm2pgsql',
                    phplib_dir='@CMAKE_SOURCE_DIR@/lib',
-                   data_dir='@CMAKE_SOURCE_DIR@'))
+                   data_dir='@CMAKE_SOURCE_DIR@',
+                   phpcgi_path='@PHPCGI_BIN@'))
index 65ea90bbc3534b4421558e883ecaf31796e5b0b5..4fadaa9f76c64cc3f4123912191006eab2d2b9c0 100644 (file)
@@ -435,7 +435,7 @@ class AdminWarm:
 
 class QueryExport:
     """\
-    Export addresses as CSV file from a Nominatim database.
+    Export addresses as CSV file from the database.
     """
 
     @staticmethod
@@ -522,10 +522,14 @@ def nominatim(**kwargs):
     parser.add_subcommand('refresh', UpdateRefresh)
 
     parser.add_subcommand('export', QueryExport)
-    parser.add_subcommand('search', QueryTodo)
-    parser.add_subcommand('reverse', QueryTodo)
-    parser.add_subcommand('lookup', QueryTodo)
-    parser.add_subcommand('details', QueryTodo)
-    parser.add_subcommand('status', QueryTodo)
+
+    if kwargs.get('phpcgi_path'):
+        parser.add_subcommand('search', QueryTodo)
+        parser.add_subcommand('reverse', 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)