From 52c3fc6200cb56066c632cdf8988b32ac65b844e Mon Sep 17 00:00:00 2001 From: Iain MacDonald <151295347+iain-ilearner@users.noreply.github.com> Date: Tue, 7 May 2024 14:15:43 +0800 Subject: [PATCH] [bitnami/mediawiki] Add env var to control skipping config validation during startup (#65729) * Add env var to control skipping config validation during startup Signed-off-by: Iain MacDonald * Update bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/libmediawiki.sh Thanks for the suggestions Co-authored-by: David Gomez Signed-off-by: Iain MacDonald <151295347+iain-ilearner@users.noreply.github.com> * Add skip config env var to empty directory branch Signed-off-by: Iain MacDonald --------- Signed-off-by: Iain MacDonald Signed-off-by: Iain MacDonald <151295347+iain-ilearner@users.noreply.github.com> Co-authored-by: Iain MacDonald Co-authored-by: David Gomez --- .../rootfs/opt/bitnami/scripts/libmediawiki.sh | 13 +++++++++++-- .../rootfs/opt/bitnami/scripts/mediawiki-env.sh | 2 ++ bitnami/mediawiki/README.md | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/libmediawiki.sh b/bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/libmediawiki.sh index 5200a4c98d321..675a79864a4e3 100644 --- a/bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/libmediawiki.sh +++ b/bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/libmediawiki.sh @@ -124,7 +124,11 @@ mediawiki_initialize() { else info "An already initialized MediaWiki database was provided, configuration will be skipped" # Perform MediaWiki database schema upgrade - debug_execute php "${MEDIAWIKI_BASE_DIR}/maintenance/update.php" + local -a update_args=() + if is_boolean_yes "$MEDIAWIKI_SKIP_CONFIG_VALIDATION"; then + update_args+=( "--skip-config-validation" ) + fi + debug_execute php "${MEDIAWIKI_BASE_DIR}/maintenance/update.php" "${update_args[@]}" fi # Configure MediaWiki based on environment variables @@ -151,7 +155,12 @@ mediawiki_initialize() { db_port="$MEDIAWIKI_DATABASE_PORT_NUMBER" mediawiki_wait_for_db_connection "$db_host" "$db_port" "$db_name" "$db_user" "$db_pass" # Perform MediaWiki database schema upgrade - debug_execute php "${MEDIAWIKI_BASE_DIR}/maintenance/update.php" + info "Performing database schema upgrade if needed" + local -a update_args=() + if is_boolean_yes "$MEDIAWIKI_SKIP_CONFIG_VALIDATION"; then + update_args+=( "--skip-config-validation" ) + fi + debug_execute php "${MEDIAWIKI_BASE_DIR}/maintenance/update.php" "${update_args[@]}" fi # Avoid exit code of previous commands to affect the result of this function diff --git a/bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/mediawiki-env.sh b/bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/mediawiki-env.sh index c3d8008f3f6c8..14be8d95e8056 100644 --- a/bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/mediawiki-env.sh +++ b/bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/mediawiki-env.sh @@ -46,6 +46,7 @@ mediawiki_env_vars=( MEDIAWIKI_DATABASE_NAME MEDIAWIKI_DATABASE_USER MEDIAWIKI_DATABASE_PASSWORD + MEDIAWIKI_SKIP_CONFIG_VALIDATION SMTP_HOST SMTP_HOST_ID SMTP_PORT @@ -76,6 +77,7 @@ export MEDIAWIKI_CONF_FILE="${MEDIAWIKI_BASE_DIR}/LocalSettings.php" # MediaWiki persistence configuration export MEDIAWIKI_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mediawiki" export MEDIAWIKI_DATA_TO_PERSIST="${MEDIAWIKI_DATA_TO_PERSIST:-images extensions skins LocalSettings.php}" +export MEDIAWIKI_SKIP_CONFIG_VALIDATION="${MEDIAWIKI_SKIP_CONFIG_VALIDATION:-no}" # MediaWiki site configuration export MEDIAWIKI_SKIP_BOOTSTRAP="${MEDIAWIKI_SKIP_BOOTSTRAP:-}" # only used during the first initialization diff --git a/bitnami/mediawiki/README.md b/bitnami/mediawiki/README.md index 955cb9f212017..4529bf571fb3d 100644 --- a/bitnami/mediawiki/README.md +++ b/bitnami/mediawiki/README.md @@ -222,6 +222,7 @@ docker run -d --name mediawiki \ | `MEDIAWIKI_DATABASE_NAME` | Database name. | `bitnami_mediawiki` | | `MEDIAWIKI_DATABASE_USER` | Database user name. | `bn_mediawiki` | | `MEDIAWIKI_DATABASE_PASSWORD` | Database user password. | `nil` | +| `MEDIAWIKI_SKIP_CONFIG_VALIDATION` | Skip config validation during startup. Allows the use of deprecated values in MediaWiki configuration file. Valid values: `yes`, `no`. | `no` | #### Read-only environment variables