Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PHP frontend #3536

Merged
merged 7 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 0 additions & 93 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,99 +131,6 @@ jobs:
working-directory: Nominatim
if: matrix.flavour != 'oldstuff'

legacy-test:
needs: create-archive
runs-on: ubuntu-20.04

strategy:
matrix:
postgresql: ["13", "16"]

steps:
- uses: actions/download-artifact@v4
with:
name: full-source

- name: Unpack Nominatim
run: tar xf nominatim-src.tar.bz2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- uses: ./Nominatim/.github/actions/setup-postgresql
with:
postgresql-version: ${{ matrix.postgresql }}
postgis-version: 3

- name: Install Postgresql server dev
run: sudo apt-get install postgresql-server-dev-$PGVER
env:
PGVER: ${{ matrix.postgresql }}

- uses: ./Nominatim/.github/actions/build-nominatim
with:
cmake-args: -DBUILD_MODULE=on

- name: Install test prerequisites
run: sudo apt-get install -y -qq python3-behave

- name: BDD tests (legacy tokenizer)
run: |
export PATH=$GITHUB_WORKSPACE/build/osm2pgsql:$PATH
python3 -m behave -DREMOVE_TEMPLATE=1 -DSERVER_MODULE_PATH=$GITHUB_WORKSPACE/build/module -DAPI_ENGINE=php -DTOKENIZER=legacy --format=progress3
working-directory: Nominatim/test/bdd


php-test:
needs: create-archive
runs-on: ubuntu-22.04

steps:
- uses: actions/download-artifact@v4
with:
name: full-source

- name: Unpack Nominatim
run: tar xf nominatim-src.tar.bz2

- uses: ./Nominatim/.github/actions/setup-postgresql
with:
postgresql-version: 15
postgis-version: 3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: phpunit:9, phpcs, composer
ini-values: opcache.jit=disable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: PHP linting
run: phpcs --report-width=120 .
working-directory: Nominatim

- name: PHP unit tests
run: phpunit ./
working-directory: Nominatim/test/php

- uses: ./Nominatim/.github/actions/build-nominatim
with:
flavour: 'ubuntu-22'

- name: Install test prerequisites
run: sudo apt-get install -y -qq python3-behave

- name: BDD tests (php)
run: |
export PATH=$GITHUB_WORKSPACE/build/osm2pgsql:$PATH
python3 -m behave -DREMOVE_TEMPLATE=1 -DAPI_ENGINE=php --format=progress3
working-directory: Nominatim/test/bdd


install:
runs-on: ubuntu-latest
needs: create-archive
Expand Down
49 changes: 1 addition & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,6 @@ if (BUILD_IMPORTER OR BUILD_API)
find_package(PythonInterp 3.7 REQUIRED)
endif()

#-----------------------------------------------------------------------------
# PHP
#-----------------------------------------------------------------------------

# Setting PHP binary variable as to command line (prevailing) or auto detect

if (BUILD_API)
if (NOT PHP_BIN)
find_program (PHP_BIN php)
endif()
# sanity check if PHP binary exists
if (NOT EXISTS ${PHP_BIN})
message(WARNING "PHP binary not found. Only Python frontend can be used.")
set(PHP_BIN "")
else()
message (STATUS "Using PHP binary " ${PHP_BIN})
endif()
endif()

#-----------------------------------------------------------------------------
# import scripts and utilities (importer only)
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -125,8 +106,6 @@ if (BUILD_TESTS)
find_program(PYTHON_BEHAVE behave)
find_program(PYLINT NAMES pylint3 pylint)
find_program(PYTEST NAMES pytest py.test-3 py.test)
find_program(PHPCS phpcs)
find_program(PHPUNIT phpunit)

if (PYTHON_BEHAVE)
message(STATUS "Using Python behave binary ${PYTHON_BEHAVE}")
Expand All @@ -141,24 +120,6 @@ if (BUILD_TESTS)
message(WARNING "behave not found. BDD tests disabled." )
endif()

if (PHPUNIT)
message(STATUS "Using phpunit binary ${PHPUNIT}")
add_test(NAME php
COMMAND ${PHPUNIT} ./
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/php)
else()
message(WARNING "phpunit not found. PHP unit tests disabled." )
endif()

if (PHPCS)
message(STATUS "Using phpcs binary ${PHPCS}")
add_test(NAME phpcs
COMMAND ${PHPCS} --report-width=120 --colors lib-php
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
else()
message(WARNING "phpcs not found. PHP linting tests disabled." )
endif()

if (PYLINT)
message(STATUS "Using pylint binary ${PYLINT}")
add_test(NAME pylint
Expand Down Expand Up @@ -203,11 +164,7 @@ if (BUILD_IMPORTER)
DESTINATION ${CMAKE_INSTALL_BINDIR}
RENAME nominatim)

if (EXISTS ${PHP_BIN})
configure_file(${PROJECT_SOURCE_DIR}/cmake/paths-py.tmpl paths-py.installed)
else()
configure_file(${PROJECT_SOURCE_DIR}/cmake/paths-py-no-php.tmpl paths-py.installed)
endif()
configure_file(${PROJECT_SOURCE_DIR}/cmake/paths-py-no-php.tmpl paths-py.installed)

foreach (submodule nominatim_db nominatim_api)
install(DIRECTORY src/${submodule}
Expand Down Expand Up @@ -243,10 +200,6 @@ if (BUILD_MODULE)
DESTINATION ${NOMINATIM_LIBDIR}/module)
endif()

if (BUILD_API AND EXISTS ${PHP_BIN})
install(DIRECTORY lib-php DESTINATION ${NOMINATIM_LIBDIR})
endif()

install(FILES settings/env.defaults
settings/address-levels.json
settings/phrase-settings.json
Expand Down
1 change: 0 additions & 1 deletion cmake/paths-py-no-php.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Path settings for extra data used by Nominatim (installed version).
"""
from pathlib import Path

PHPLIB_DIR = None
SQLLIB_DIR = (Path('@NOMINATIM_LIBDIR@') / 'lib-sql').resolve()
DATA_DIR = Path('@NOMINATIM_DATADIR@').resolve()
CONFIG_DIR = Path('@NOMINATIM_CONFIGDIR@').resolve()
15 changes: 0 additions & 15 deletions cmake/paths-py.tmpl

This file was deleted.

2 changes: 1 addition & 1 deletion docs/admin/Advanced-Installations.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ On the client side you now need to configure the import to point to the
correct location of the library **on the database server**. Add the following
line to your your `.env` file:

```php
```
NOMINATIM_DATABASE_MODULE_PATH="<directory on the database server where nominatim.so resides>"
```

Expand Down
151 changes: 0 additions & 151 deletions docs/admin/Deployment-PHP.md

This file was deleted.

Loading