From e70f405abddfe5a8a7400424558071ebba769eda Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 2 Dec 2018 11:13:48 +0100 Subject: [PATCH] Restructure script and website installation Just make cmake install a small stub that includes the settings from the build directory and then the script from the source directory. Remove executable rights from php files in utils/ so that they cannot be accidentally executed. --- CMakeLists.txt | 25 ++++++++++++++++++++----- cmake/script.tmpl | 4 ++++ cmake/website.tmpl | 3 +++ utils/country_languages.php | 2 -- utils/export.php | 2 -- utils/importWikipedia.php | 2 -- utils/query.php | 2 -- utils/server_compare.php | 1 - utils/setup.php | 5 ----- utils/specialphrases.php | 2 -- utils/update.php | 2 -- utils/warm.php | 2 -- website/deletable.php | 1 - website/details.php | 2 -- website/hierarchy.php | 2 -- website/lookup.php | 2 -- website/polygons.php | 1 - website/reverse.php | 2 -- website/search.php | 2 -- website/status.php | 3 --- 20 files changed, 27 insertions(+), 40 deletions(-) create mode 100755 cmake/script.tmpl create mode 100755 cmake/website.tmpl mode change 100755 => 100644 utils/country_languages.php mode change 100755 => 100644 utils/export.php mode change 100755 => 100644 utils/importWikipedia.php mode change 100755 => 100644 utils/query.php mode change 100755 => 100644 utils/server_compare.php mode change 100755 => 100644 utils/setup.php mode change 100755 => 100644 utils/specialphrases.php mode change 100755 => 100644 utils/update.php mode change 100755 => 100644 utils/warm.php mode change 100755 => 100644 website/deletable.php mode change 100755 => 100644 website/details.php mode change 100755 => 100644 website/hierarchy.php mode change 100755 => 100644 website/lookup.php mode change 100755 => 100644 website/polygons.php mode change 100755 => 100644 website/reverse.php mode change 100755 => 100644 website/search.php diff --git a/CMakeLists.txt b/CMakeLists.txt index 898ab229..b7a2caaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,8 +93,7 @@ message (STATUS "Using PHP binary " ${PHP_BIN}) # #----------------------------------------------------------------------------- -set(CUSTOMFILES - settings/phrase_settings.php +set(WEBSITESCRIPTS website/deletable.php website/details.php website/hierarchy.php @@ -103,6 +102,9 @@ set(CUSTOMFILES website/reverse.php website/search.php website/status.php +) + +set(CUSTOMSCRIPTS utils/country_languages.php utils/importWikipedia.php utils/export.php @@ -114,11 +116,24 @@ set(CUSTOMFILES utils/warm.php ) -foreach (cfile ${CUSTOMFILES}) - configure_file(${PROJECT_SOURCE_DIR}/${cfile} ${PROJECT_BINARY_DIR}/${cfile}) +foreach (script_source ${CUSTOMSCRIPTS}) + configure_file(${PROJECT_SOURCE_DIR}/cmake/script.tmpl + ${PROJECT_BINARY_DIR}/${script_source}) +endforeach() + +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(CONFIGUREFILES + settings/phrase_settings.php + settings/defaults.php + ) + +foreach (cfile ${CONFIGUREFILES}) + configure_file(${PROJECT_SOURCE_DIR}/${cfile} ${PROJECT_BINARY_DIR}/${cfile}) +endforeach() set(WEBPATHS css images js) diff --git a/cmake/script.tmpl b/cmake/script.tmpl new file mode 100755 index 00000000..8146ca8b --- /dev/null +++ b/cmake/script.tmpl @@ -0,0 +1,4 @@ +#!@PHP_BIN@ -Cq +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_functions.php'); ini_set('memory_limit', '800M'); diff --git a/utils/specialphrases.php b/utils/specialphrases.php old mode 100755 new mode 100644 index 7d22df50..40fd3750 --- a/utils/specialphrases.php +++ b/utils/specialphrases.php @@ -1,7 +1,5 @@ -#!@PHP_BIN@ -Cq