diff --git a/bitnami/moodle/4.2/debian-11/rootfs/opt/bitnami/scripts/libmoodle.sh b/bitnami/moodle/4.2/debian-11/rootfs/opt/bitnami/scripts/libmoodle.sh index b7e043bf4d1c..bec8c505c94b 100644 --- a/bitnami/moodle/4.2/debian-11/rootfs/opt/bitnami/scripts/libmoodle.sh +++ b/bitnami/moodle/4.2/debian-11/rootfs/opt/bitnami/scripts/libmoodle.sh @@ -156,6 +156,15 @@ moodle_initialize() { read -r -a extra_args <<<"$MOODLE_INSTALL_EXTRA_ARGS" [[ "${#extra_args[@]}" -gt 0 ]] && moodle_install_args+=("${extra_args[@]}") + # Handle --prefix (table prefix) being overridden via MOODLE_INSTALL_EXTRA_ARGS + mdl_prefix="mdl_" + for extra_arg in "${extra_args[@]}"; do + if [[ $extra_arg == --prefix=* ]]; then + mdl_prefix=${extra_arg#--prefix=} + break + fi + done + # Setup Moodle if ! is_boolean_yes "$MOODLE_SKIP_BOOTSTRAP"; then info "Running Moodle install script" @@ -166,17 +175,17 @@ moodle_initialize() { [[ "$db_type" = "pgsql" ]] && db_remote_execute="postgresql_remote_execute" local -a db_execute_args=("$db_host" "$db_port" "$db_name" "$db_user" "$db_pass") # Configure no-reply e-mail address for SMTP - echo "INSERT INTO mdl_config (name, value) VALUES ('noreplyaddress', '${MOODLE_EMAIL}')" | "$db_remote_execute" "${db_execute_args[@]}" + echo "INSERT INTO ${mdl_prefix}config (name, value) VALUES ('noreplyaddress', '${MOODLE_EMAIL}')" | "$db_remote_execute" "${db_execute_args[@]}" # Additional Bitnami customizations - echo "UPDATE mdl_course SET summary='Moodle powered by Bitnami' WHERE id='1'" | "$db_remote_execute" "${db_execute_args[@]}" + echo "UPDATE ${mdl_prefix}course SET summary='Moodle powered by Bitnami' WHERE id='1'" | "$db_remote_execute" "${db_execute_args[@]}" # SMTP configuration if ! is_empty_value "$MOODLE_SMTP_HOST"; then info "Configuring SMTP credentials" "$db_remote_execute" "${db_execute_args[@]}" <