From 0cb9a0105d512955db9e6db9167151607003d66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20D=C4=99bski?= Date: Thu, 29 Feb 2024 10:14:50 +0100 Subject: [PATCH 1/3] Update php to 8.3 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 18b95a453..eccf31041 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM composer as composer COPY composer.json composer.lock ./ RUN composer install --ignore-platform-reqs --no-dev -FROM php:8.1-apache +FROM php:8.3-apache RUN apt-get update && apt-get install -y zlib1g-dev \ libzip-dev \ libldap2-dev \ From 65adddb37907de726f6f6c0863181801864e91e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20D=C4=99bski?= Date: Thu, 29 Feb 2024 11:53:27 +0100 Subject: [PATCH 2/3] Configure encryption key --- docker/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/config.php b/docker/config.php index 87c40ee3a..606f1f972 100644 --- a/docker/config.php +++ b/docker/config.php @@ -229,7 +229,7 @@ | MUST set an encryption key. See the user guide for info. | */ -$config['encryption_key'] = 'YJ9FljXV4axG7QTzEzbRaUBFwi0FzIls'; +$config['encryption_key'] = getEnv('ENC_KEY') ?: 'YJ9FljXV4axG7QTzEzbRaUBFwi0FzIls'; /* |-------------------------------------------------------------------------- From 4a6cc0fb6fb151f6893525b11de42e683f07a481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20D=C4=99bski?= Date: Tue, 12 Mar 2024 15:36:39 +0100 Subject: [PATCH 3/3] Set logs to php://stdout in docker --- docker/config.php | 2 +- system/core/Log.php | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docker/config.php b/docker/config.php index 606f1f972..bc7c8f9b3 100644 --- a/docker/config.php +++ b/docker/config.php @@ -196,7 +196,7 @@ | application/logs/ folder. Use a full server path with trailing slash. | */ -$config['log_path'] = ''; +$config['log_path'] = 'php://stdout'; /* |-------------------------------------------------------------------------- diff --git a/system/core/Log.php b/system/core/Log.php index ca3e38a7f..b1ce04fbe 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -129,11 +129,14 @@ public function __construct() $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '') ? ltrim($config['log_file_extension'], '.') : 'php'; - file_exists($this->_log_path) OR mkdir($this->_log_path, 0755, TRUE); - - if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path)) - { - $this->_enabled = FALSE; + if ($this->_log_path !== 'php://stdout') + { + file_exists($this->_log_path) OR mkdir($this->_log_path, 0755, TRUE); + + if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path)) + { + $this->_enabled = FALSE; + } } if (is_numeric($config['log_threshold'])) @@ -183,10 +186,10 @@ public function write_log($level, $msg) return FALSE; } - $filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext; + $filepath = $this->_log_path === 'php://stdout' ? $this->_log_path : $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext; $message = ''; - if ( ! file_exists($filepath)) + if ($this->_log_path !== 'php://stdout' AND ! file_exists($filepath)) { $newfile = TRUE; // Only add protection to php files