From 3197544cccb6620ee20edd0e5cc873cbb4fb8599 Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 17:43:49 +0200 Subject: [PATCH 01/11] Docker-readiness --- index.php | 6 ++++-- install/includes/core_class.php | 30 +++++++++++++++++------------- install/index.php | 3 +++ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/index.php b/index.php index 689cce4d7..d1b1f81b4 100644 --- a/index.php +++ b/index.php @@ -54,7 +54,9 @@ * NOTE: If you change these, also change the error_reporting() code below */ #define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); - if (file_exists('.debug')) { + if (isset($_SERVER['CI_ENV'])) { + define('ENVIRONMENT', $_SERVER['CI_ENV']) { + elseif (file_exists('.debug')) { define('ENVIRONMENT', 'development'); } else if (file_exists('.maintenance')) { define('ENVIRONMENT', 'maintenance'); @@ -81,7 +83,7 @@ switch (ENVIRONMENT) error_reporting(-1); ini_set('display_errors', 1); break; - + case 'production': ini_set('display_errors', 0); if (version_compare(PHP_VERSION, '5.3', '>=')) diff --git a/install/includes/core_class.php b/install/includes/core_class.php index fabe5dcbd..0c74f12f2 100644 --- a/install/includes/core_class.php +++ b/install/includes/core_class.php @@ -41,27 +41,27 @@ class Core // Validate First Name if (isset($_POST['firstname']) && !empty($_POST['firstname'])) { $counter++; - } + } // Validate Last Name if (isset($_POST['lastname']) && !empty($_POST['lastname'])) { $counter++; - } + } // Validate Username if (isset($_POST['username']) && !empty($_POST['username'])) { $counter++; - } + } // Validate Callsign if (isset($_POST['callsign']) && !empty($_POST['callsign'])) { $counter++; - } + } // Validate Password if (isset($_POST['password']) && !empty($_POST['password'])) { $counter++; - } + } // Validate Locator if (isset($_POST['userlocator']) && !empty($_POST['userlocator'])) { @@ -78,7 +78,7 @@ class Core // Validate Confirm Password if (isset($_POST['cnfm_password']) && !empty($_POST['cnfm_password'])) { $counter++; - } + } // Validate Email Address if (isset($_POST['user_email']) && filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)) { @@ -90,7 +90,7 @@ class Core // Validate Timezone if (isset($_POST['timezone']) && is_numeric($_POST['timezone'])) { $counter++; - } + } // Check if all the required fields have been entered if ($counter == '13') { @@ -107,12 +107,14 @@ class Core } // Function to write the config file - function write_config($data) - { + function write_config($data) { - // Config path $template_path = 'config/database.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/database.php'; + if (isset($_SERVER['CI_ENV'])) { + $template_path = $_SERVER['CI_ENV'].'/database.php'; + $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/'.$_SERVER['CI_ENV'].'/database.php'; + } // Open the file $database_file = file_get_contents($template_path); @@ -147,12 +149,14 @@ class Core } // Function to write the config file - function write_configfile($data) - { + function write_configfile($data) { - // Config path $template_path = 'config/config.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/config.php'; + if (isset($_SERVER['CI_ENV'])) { + $template_path = $_SERVER['CI_ENV'].'/config.php'; + $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/'.$_SERVER['CI_ENV'].'/config.php'; + } // Open the file $database_file = file_get_contents($template_path); diff --git a/install/index.php b/install/index.php index 8c072371e..a0b74d9a1 100644 --- a/install/index.php +++ b/install/index.php @@ -24,6 +24,9 @@ if (file_exists('config_unattended.php')) { // Config Paths $db_config_path = '../application/config/'; +if (isset($_SERVER['CI_ENV'])) { + $db_config_path ='../application/'.$_SERVER['CI_ENV'].'/'; +} $db_file_path = $db_config_path . "database.php"; // if you need to disabled all button locks you can create a root_mode file in the /install directory From cdbd645c42366813205ecaebadce06f557243837 Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 17:48:35 +0200 Subject: [PATCH 02/11] Fix typo --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index d1b1f81b4..f2efbe997 100644 --- a/index.php +++ b/index.php @@ -56,7 +56,7 @@ #define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); if (isset($_SERVER['CI_ENV'])) { define('ENVIRONMENT', $_SERVER['CI_ENV']) { - elseif (file_exists('.debug')) { + } elseif (file_exists('.debug')) { define('ENVIRONMENT', 'development'); } else if (file_exists('.maintenance')) { define('ENVIRONMENT', 'maintenance'); From d007c4810bb328665ccfd69dd0c957b3ee3b912a Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 17:52:44 +0200 Subject: [PATCH 03/11] Agaim typo --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index f2efbe997..b701e6413 100644 --- a/index.php +++ b/index.php @@ -56,7 +56,7 @@ #define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); if (isset($_SERVER['CI_ENV'])) { define('ENVIRONMENT', $_SERVER['CI_ENV']) { - } elseif (file_exists('.debug')) { + } else if (file_exists('.debug')) { define('ENVIRONMENT', 'development'); } else if (file_exists('.maintenance')) { define('ENVIRONMENT', 'maintenance'); From 2c2787e5bb9cd6349f9f8a366f1d4bb3b9126fe8 Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 17:59:06 +0200 Subject: [PATCH 04/11] Bad Typo day --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index b701e6413..1946d66c2 100644 --- a/index.php +++ b/index.php @@ -55,7 +55,7 @@ */ #define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); if (isset($_SERVER['CI_ENV'])) { - define('ENVIRONMENT', $_SERVER['CI_ENV']) { + define('ENVIRONMENT', $_SERVER['CI_ENV']); } else if (file_exists('.debug')) { define('ENVIRONMENT', 'development'); } else if (file_exists('.maintenance')) { From 3d80d770a43b8dd84f2ec82de1da14ab53614a20 Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 18:07:20 +0200 Subject: [PATCH 05/11] ENV is taken instead of SERVER for Environment --- index.php | 4 ++-- install/includes/core_class.php | 12 ++++++------ install/index.php | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index 1946d66c2..320627e22 100644 --- a/index.php +++ b/index.php @@ -54,8 +54,8 @@ * NOTE: If you change these, also change the error_reporting() code below */ #define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); - if (isset($_SERVER['CI_ENV'])) { - define('ENVIRONMENT', $_SERVER['CI_ENV']); + if (isset($_ENV['CI_ENV'])) { + define('ENVIRONMENT', $_ENV['CI_ENV']); } else if (file_exists('.debug')) { define('ENVIRONMENT', 'development'); } else if (file_exists('.maintenance')) { diff --git a/install/includes/core_class.php b/install/includes/core_class.php index 0c74f12f2..6b67f6f18 100644 --- a/install/includes/core_class.php +++ b/install/includes/core_class.php @@ -111,9 +111,9 @@ class Core $template_path = 'config/database.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/database.php'; - if (isset($_SERVER['CI_ENV'])) { - $template_path = $_SERVER['CI_ENV'].'/database.php'; - $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/'.$_SERVER['CI_ENV'].'/database.php'; + if (isset($_ENV['CI_ENV'])) { + $template_path = $_ENV['CI_ENV'].'/database.php'; + $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/'.$_ENV['CI_ENV'].'/database.php'; } // Open the file @@ -153,9 +153,9 @@ class Core $template_path = 'config/config.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/config.php'; - if (isset($_SERVER['CI_ENV'])) { - $template_path = $_SERVER['CI_ENV'].'/config.php'; - $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/'.$_SERVER['CI_ENV'].'/config.php'; + if (isset($_ENV['CI_ENV'])) { + $template_path = $_ENV['CI_ENV'].'/config.php'; + $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/'.$_ENV['CI_ENV'].'/config.php'; } // Open the file diff --git a/install/index.php b/install/index.php index a0b74d9a1..bf57aeebf 100644 --- a/install/index.php +++ b/install/index.php @@ -24,8 +24,8 @@ if (file_exists('config_unattended.php')) { // Config Paths $db_config_path = '../application/config/'; -if (isset($_SERVER['CI_ENV'])) { - $db_config_path ='../application/'.$_SERVER['CI_ENV'].'/'; +if (isset($_ENV['CI_ENV'])) { + $db_config_path ='../application/'.$_ENV['CI_ENV'].'/'; } $db_file_path = $db_config_path . "database.php"; From 501cf4930a93e322cafb38ecd6449e40db58cf33 Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 18:10:07 +0200 Subject: [PATCH 06/11] docker-env needs to be defined --- index.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 320627e22..113a57805 100644 --- a/index.php +++ b/index.php @@ -84,14 +84,19 @@ switch (ENVIRONMENT) ini_set('display_errors', 1); break; + case 'docker': + ini_set('display_errors', 0); + if (version_compare(PHP_VERSION, '5.3', '>=')) { + error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); + } else { + error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); + } + case 'production': ini_set('display_errors', 0); - if (version_compare(PHP_VERSION, '5.3', '>=')) - { + if (version_compare(PHP_VERSION, '5.3', '>=')) { error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); - } - else - { + } else { error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); } break; From c53bcf4d046ec8abed9b0858dd0d1011786696a9 Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 18:17:28 +0200 Subject: [PATCH 07/11] Placeholder for Mount-Vol --- application/docker/.placeholder | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 application/docker/.placeholder diff --git a/application/docker/.placeholder b/application/docker/.placeholder new file mode 100644 index 000000000..e69de29bb From 2ae8c6e444b91b55a2cf78d6d3671620edc2bfcd Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 19:04:46 +0200 Subject: [PATCH 08/11] Other Folder --- application/docker/.placeholder | 0 install/includes/core_class.php | 8 ++++---- install/index.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 application/docker/.placeholder diff --git a/application/docker/.placeholder b/application/docker/.placeholder deleted file mode 100644 index e69de29bb..000000000 diff --git a/install/includes/core_class.php b/install/includes/core_class.php index 6b67f6f18..f0d29a738 100644 --- a/install/includes/core_class.php +++ b/install/includes/core_class.php @@ -112,8 +112,8 @@ class Core $template_path = 'config/database.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/database.php'; if (isset($_ENV['CI_ENV'])) { - $template_path = $_ENV['CI_ENV'].'/database.php'; - $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/'.$_ENV['CI_ENV'].'/database.php'; + $template_path = 'config/'.$_ENV['CI_ENV'].'/database.php'; + $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/'.$_ENV['CI_ENV'].'/database.php'; } // Open the file @@ -154,8 +154,8 @@ class Core $template_path = 'config/config.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/config.php'; if (isset($_ENV['CI_ENV'])) { - $template_path = $_ENV['CI_ENV'].'/config.php'; - $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/'.$_ENV['CI_ENV'].'/config.php'; + $template_path = 'config/'.$_ENV['CI_ENV'].'/config.php'; + $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/'.$_ENV['CI_ENV'].'/config.php'; } // Open the file diff --git a/install/index.php b/install/index.php index bf57aeebf..f7bfe4830 100644 --- a/install/index.php +++ b/install/index.php @@ -25,7 +25,7 @@ if (file_exists('config_unattended.php')) { // Config Paths $db_config_path = '../application/config/'; if (isset($_ENV['CI_ENV'])) { - $db_config_path ='../application/'.$_ENV['CI_ENV'].'/'; + $db_config_path ='../application/config/'.$_ENV['CI_ENV'].'/'; } $db_file_path = $db_config_path . "database.php"; From e774be426d8e4ce100c3b5049248a721f9bcd607 Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 19:15:20 +0200 Subject: [PATCH 09/11] Path-adjustments --- install/includes/core_class.php | 2 -- install/index.php | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/install/includes/core_class.php b/install/includes/core_class.php index f0d29a738..ccc39f012 100644 --- a/install/includes/core_class.php +++ b/install/includes/core_class.php @@ -112,7 +112,6 @@ class Core $template_path = 'config/database.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/database.php'; if (isset($_ENV['CI_ENV'])) { - $template_path = 'config/'.$_ENV['CI_ENV'].'/database.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/'.$_ENV['CI_ENV'].'/database.php'; } @@ -154,7 +153,6 @@ class Core $template_path = 'config/config.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/config.php'; if (isset($_ENV['CI_ENV'])) { - $template_path = 'config/'.$_ENV['CI_ENV'].'/config.php'; $output_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $data['directory'] . '/application/config/'.$_ENV['CI_ENV'].'/config.php'; } diff --git a/install/index.php b/install/index.php index f7bfe4830..3782887a1 100644 --- a/install/index.php +++ b/install/index.php @@ -25,7 +25,7 @@ if (file_exists('config_unattended.php')) { // Config Paths $db_config_path = '../application/config/'; if (isset($_ENV['CI_ENV'])) { - $db_config_path ='../application/config/'.$_ENV['CI_ENV'].'/'; + $db_config_path ='../application/'.$_ENV['CI_ENV'].'/'; } $db_file_path = $db_config_path . "database.php"; @@ -115,11 +115,11 @@ if ($_POST) { } elseif ($database->create_tables($_POST) == false) { $message = $core->show_message('error', "The database tables could not be created, please verify your settings."); } elseif ($core->write_config($_POST) == false) { - $message = $core->show_message('error', "The database configuration file could not be written, please chmod /application/config/database.php file to 777"); + $message = $core->show_message('error', "The database configuration file could not be written, please chmod ".$db_config_path."/database.php file to 777"); } if ($core->write_configfile($_POST) == false) { - $message = $core->show_message('error', "The config configuration file could not be written, please chmod /application/config/config.php file to 777"); + $message = $core->show_message('error', "The config configuration file could not be written, please chmod ".$db_config_path."/config.php file to 777"); } // If no errors, redirect to registration page @@ -1458,7 +1458,7 @@ global $wavelog_url;
-

Please make the /application/config/ folder writable. Example:

chmod -R 777 application/config/

Don't forget to restore the permissions afterwards.

+

Please make the /application/config/ folder writable. Example:

chmod -R 777

Don't forget to restore the permissions afterwards.

From f264b9d50abafcbdcfe7fe438dfa6b06d75de2fb Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 19:22:38 +0200 Subject: [PATCH 10/11] Even more PATH Adjustments (driving me crazy) --- install/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/index.php b/install/index.php index 3782887a1..29d859699 100644 --- a/install/index.php +++ b/install/index.php @@ -25,7 +25,7 @@ if (file_exists('config_unattended.php')) { // Config Paths $db_config_path = '../application/config/'; if (isset($_ENV['CI_ENV'])) { - $db_config_path ='../application/'.$_ENV['CI_ENV'].'/'; + $db_config_path ='../application/config/'.$_ENV['CI_ENV'].'/'; } $db_file_path = $db_config_path . "database.php"; @@ -1458,7 +1458,7 @@ global $wavelog_url;
-

Please make the /application/config/ folder writable. Example:

chmod -R 777

Don't forget to restore the permissions afterwards.

+

Please make the folder writable. Example:

chmod -R 777

Don't forget to restore the permissions afterwards.

From 2fa3deffc130134cd6d33ff15fac95fde9e11fa4 Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 14 Apr 2024 19:26:23 +0200 Subject: [PATCH 11/11] Test if it's still working after image-update --- install/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/install/index.php b/install/index.php index 29d859699..5fe16bd40 100644 --- a/install/index.php +++ b/install/index.php @@ -6,6 +6,7 @@ This installer guides a user through the install process and all necessary parameters for the new Wavelog Installation. HB9HIL - January 2024 +DJ7NT - Docker Readiness - April 2024 */ // #########################################################