From 6c406124dd416ec62fc2ce0a4d07d597d3ae53f3 Mon Sep 17 00:00:00 2001 From: K Rahul Reddy Date: Fri, 12 Jun 2020 19:04:48 +0530 Subject: [PATCH 1/5] Added setup-website option --- cmake/website.tmpl | 2 +- lib/setup/SetupClass.php | 43 ++++++++++++++++++++++++++++++++++++++++ utils/setup.php | 6 ++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/cmake/website.tmpl b/cmake/website.tmpl index 0257aa10..c5173956 100755 --- a/cmake/website.tmpl +++ b/cmake/website.tmpl @@ -1,3 +1,3 @@ removeFlatnodeFile(); } + /** + * Setup settings_test.php in the build/settings directory from build/.env file + * + * @return null + */ + public function setupWebsite() + { + $rOutputFile = fopen(CONST_InstallPath.'/settings/settings-frontend.php', 'w'); + + // Currently using CONST_BasePath and CONST_InstallPath. + // Once dotenv is setup, getenv() can be used, or another + // alternate option is to build settings_test.php using cmake. + + fwrite($rOutputFile, "createCountryNames($aCMDResult); } +if ($aCMDResult['setup-website'] || $aCMDResult['all']) { + $bDidSomething = true; + $oSetup->setupWebsite(); +} + // ****************************************************** // If we did something, repeat the warnings if (!$bDidSomething) { From a175a25e6c0f5b1cec117f10d9f7c258ee5fea62 Mon Sep 17 00:00:00 2001 From: K Rahul Reddy Date: Sun, 14 Jun 2020 18:30:01 +0530 Subject: [PATCH 2/5] Added setup-website to travis.yml --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index da6dd3a5..578bdd61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,8 @@ script: - if [[ $TEST_SUITE == "tests" ]]; then phpcs --report-width=120 . ; fi - cd $TRAVIS_BUILD_DIR/test/php - if [[ $TEST_SUITE == "tests" ]]; then /usr/bin/phpunit ./ ; fi + - cd $TRAVIS_BUILD_DIR/build + - /usr/bin/env php ./utils/setup.php --setup-website - cd $TRAVIS_BUILD_DIR/test/bdd - # behave --format=progress3 api - if [[ $TEST_SUITE == "tests" ]]; then behave -DREMOVE_TEMPLATE=1 --format=progress3 db ; fi From 95d2dd74ad61feb0e3ac9581558700e519eb5432 Mon Sep 17 00:00:00 2001 From: K Rahul Reddy Date: Sun, 14 Jun 2020 18:40:42 +0530 Subject: [PATCH 3/5] Documentation updated --- docs/admin/Import.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/admin/Import.md b/docs/admin/Import.md index bcc33af8..0820a2ff 100644 --- a/docs/admin/Import.md +++ b/docs/admin/Import.md @@ -195,6 +195,17 @@ Run this script to verify all required tables and indices got created successful ./utils/check_import_finished.php ``` +### Setting up the website + +Run the following command to set up the `settings/settings-frontend.php`. +These settings are used in website/*.php files. You can use the website only after this +step is completed. + +```sh +./utils/setup.php --setup-website +``` +!!! Note + This step is not necessary if you use `--all` option while setting up the DB. ## Tuning the database From 37f0b51dffa90b09d36b598f773571fdfec787fa Mon Sep 17 00:00:00 2001 From: K Rahul Reddy Date: Fri, 19 Jun 2020 21:52:56 +0530 Subject: [PATCH 4/5] Updated setup.php --- utils/setup.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/setup.php b/utils/setup.php index db17b8f5..e0f74427 100644 --- a/utils/setup.php +++ b/utils/setup.php @@ -77,15 +77,17 @@ if ($aCMDResult['create-db'] || $aCMDResult['all']) { $oSetup->createDB(); } -$oSetup->connect(); +if (!$aCMDResult['setup-website']) { + $oSetup->connect(); + // Try accessing the C module, so we know early if something is wrong + checkModulePresence(); // raises exception on failure +} if ($aCMDResult['setup-db'] || $aCMDResult['all']) { $bDidSomething = true; $oSetup->setupDB(); } -// Try accessing the C module, so we know early if something is wrong -checkModulePresence(); // raises exception on failure if ($aCMDResult['import-data'] || $aCMDResult['all']) { $bDidSomething = true; From a3201be7e77d910501d036bb18e54d2caa232016 Mon Sep 17 00:00:00 2001 From: K Rahul Reddy Date: Fri, 19 Jun 2020 22:06:23 +0530 Subject: [PATCH 5/5] Moved settings-frontend to website/ --- cmake/website.tmpl | 2 +- docs/admin/Import.md | 2 +- lib/setup/SetupClass.php | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cmake/website.tmpl b/cmake/website.tmpl index c5173956..8692280d 100755 --- a/cmake/website.tmpl +++ b/cmake/website.tmpl @@ -1,3 +1,3 @@