From 0c1b04d2fc714a7bb2cbc0459d8fddd9ebc81ec8 Mon Sep 17 00:00:00 2001 From: Chris Proud Date: Tue, 20 Sep 2022 17:15:13 +0100 Subject: [PATCH 1/4] [+] ENV PMA_UPLOADDIR and PMA_SAVEDIR --- config.inc.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/config.inc.php b/config.inc.php index 827184bb..c53bcb1b 100644 --- a/config.inc.php +++ b/config.inc.php @@ -25,6 +25,8 @@ 'PMA_QUERYHISTORYMAX', 'MAX_EXECUTION_TIME', 'MEMORY_LIMIT', + 'PMA_UPLOADDIR', + 'PMA_SAVEDIR', ]; foreach ($vars as $var) { @@ -137,8 +139,13 @@ $i--; /* Uploads setup */ -$cfg['UploadDir'] = ''; -$cfg['SaveDir'] = ''; +if (isset($_ENV['PMA_UPLOADDIR'])) { + $cfg['UploadDir'] = trim($_ENV['PMA_UPLOADDIR']); +} + +if (isset($_ENV['PMA_SAVEDIR'])) { + $cfg['SaveDir'] = trim($_ENV['PMA_SAVEDIR']); +} if (isset($_ENV['MAX_EXECUTION_TIME'])) { $cfg['ExecTimeLimit'] = $_ENV['MAX_EXECUTION_TIME']; From 80ce7025ac4f0ba71718495cfa625869bf96050a Mon Sep 17 00:00:00 2001 From: Chris Proud Date: Wed, 21 Sep 2022 13:10:09 +0100 Subject: [PATCH 2/4] Remove Trim() from around dir env settings --- config.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.inc.php b/config.inc.php index c53bcb1b..8055e5c9 100644 --- a/config.inc.php +++ b/config.inc.php @@ -140,11 +140,11 @@ /* Uploads setup */ if (isset($_ENV['PMA_UPLOADDIR'])) { - $cfg['UploadDir'] = trim($_ENV['PMA_UPLOADDIR']); + $cfg['UploadDir'] = $_ENV['PMA_UPLOADDIR']; } if (isset($_ENV['PMA_SAVEDIR'])) { - $cfg['SaveDir'] = trim($_ENV['PMA_SAVEDIR']); + $cfg['SaveDir'] = $_ENV['PMA_SAVEDIR']; } if (isset($_ENV['MAX_EXECUTION_TIME'])) { From 9b09f1ae4cd92a36f7e07dc4c445d3b601675cd8 Mon Sep 17 00:00:00 2001 From: Chris Proud Date: Wed, 21 Sep 2022 14:07:05 +0100 Subject: [PATCH 3/4] Add ENV PMA_UPLOADDIR and PMA_SAVEDIR to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c14b445b..b58d6a9e 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,8 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma * ``UPLOAD_LIMIT`` - if set, this option will override the default value for apache and php-fpm (format as `[0-9+](K,M,G)` default value is 2048K, this will change ``upload_max_filesize`` and ``post_max_size`` values) * ``HIDE_PHP_VERSION`` - if defined, this option will hide the PHP version (`expose_php = Off`). Set to any value (such as `HIDE_PHP_VERSION=true`). * ``APACHE_PORT`` - if defined, this option will change the default Apache port from `80` in case you want it to run on a different port like an unprivileged port. Set to any port value (such as `APACHE_PORT=8090`) +* ``PMA_UPLOADDIR`` - if defined, this option will set the name of the webserver directory where imported files can be saved to be available to import ([$cfg['UploadDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_UploadDir)) +* ``PMA_SAVEDIR`` - if defined, this option will set the name of the webserver directory where exported files will be saved ([$cfg['SaveDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_SaveDir)) For usage with Docker secrets, appending ``_FILE`` to the ``PMA_PASSWORD`` environment variable is allowed (it overrides ``PMA_PASSWORD`` if it is set): From 7e5dd3b39daf627e9078dc39e878e72e1c036227 Mon Sep 17 00:00:00 2001 From: Chris Proud Date: Wed, 21 Sep 2022 14:39:50 +0100 Subject: [PATCH 4/4] Update description of PMA_UPLOADDIR and PM_SAVEDIR Co-authored-by: William Desportes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b58d6a9e..af563d75 100644 --- a/README.md +++ b/README.md @@ -165,8 +165,8 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma * ``UPLOAD_LIMIT`` - if set, this option will override the default value for apache and php-fpm (format as `[0-9+](K,M,G)` default value is 2048K, this will change ``upload_max_filesize`` and ``post_max_size`` values) * ``HIDE_PHP_VERSION`` - if defined, this option will hide the PHP version (`expose_php = Off`). Set to any value (such as `HIDE_PHP_VERSION=true`). * ``APACHE_PORT`` - if defined, this option will change the default Apache port from `80` in case you want it to run on a different port like an unprivileged port. Set to any port value (such as `APACHE_PORT=8090`) -* ``PMA_UPLOADDIR`` - if defined, this option will set the name of the webserver directory where imported files can be saved to be available to import ([$cfg['UploadDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_UploadDir)) -* ``PMA_SAVEDIR`` - if defined, this option will set the name of the webserver directory where exported files will be saved ([$cfg['SaveDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_SaveDir)) +* ``PMA_UPLOADDIR`` - if defined, this option will set the path where imported files can be saved to be available to import ([$cfg['UploadDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_UploadDir)) +* ``PMA_SAVEDIR`` - if defined, this option will set the path where exported files will be saved ([$cfg['SaveDir']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_SaveDir)) For usage with Docker secrets, appending ``_FILE`` to the ``PMA_PASSWORD`` environment variable is allowed (it overrides ``PMA_PASSWORD`` if it is set):