Skip to content

Commit

Permalink
[bitnami/mediawiki] Add env var to control skipping config validation…
Browse files Browse the repository at this point in the history
… during startup (#65729)

* Add env var to control skipping config validation during startup

Signed-off-by: Iain MacDonald <IJMacD@gmail.com>

* Update bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/libmediawiki.sh

Thanks for the suggestions

Co-authored-by: David Gomez <davidbhlm@gmail.com>
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 <IJMacD@gmail.com>

---------

Signed-off-by: Iain MacDonald <IJMacD@gmail.com>
Signed-off-by: Iain MacDonald <151295347+iain-ilearner@users.noreply.github.com>
Co-authored-by: Iain MacDonald <IJMacD@gmail.com>
Co-authored-by: David Gomez <davidbhlm@gmail.com>
  • Loading branch information
3 people authored May 7, 2024
1 parent e95afea commit 52c3fc6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bitnami/mediawiki/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 52c3fc6

Please sign in to comment.