9.0.5-debian-10-r3 release

This commit is contained in:
Bitnami Bot
2020-09-09 23:11:28 +00:00
parent 768a07af94
commit 55c6750dd2
5 changed files with 122 additions and 24 deletions

View File

@@ -26,6 +26,11 @@ drupal_env_vars=(
DRUPAL_USERNAME
DRUPAL_PASSWORD
DRUPAL_EMAIL
DRUPAL_SMTP_HOST
DRUPAL_SMTP_PORT_NUMBER
DRUPAL_SMTP_USER
DRUPAL_SMTP_PASSWORD
DRUPAL_SMTP_PROTOCOL
DRUPAL_DATABASE_HOST
DRUPAL_DATABASE_PORT_NUMBER
DRUPAL_DATABASE_NAME
@@ -33,6 +38,12 @@ drupal_env_vars=(
DRUPAL_DATABASE_PASSWORD
DRUPAL_DATABASE_TLS_CA_FILE
DRUPAL_DATABASE_MIN_VERSION
SMTP_HOST
SMTP_PORT
DRUPAL_SMTP_PORT
SMTP_USER
SMTP_PASSWORD
SMTP_PROTOCOL
MARIADB_HOST
MARIADB_PORT_NUMBER
)
@@ -56,26 +67,39 @@ export DRUPAL_MOUNTED_CONF_FILE="${DRUPAL_VOLUME_DIR}/settings.php"
export DRUPAL_DATA_TO_PERSIST="${DRUPAL_DATA_TO_PERSIST:-sites/ themes/ modules/ profiles/}"
# Drupal configuration
export DRUPAL_PROFILE="${DRUPAL_PROFILE:-standard}"
export DRUPAL_SITE_NAME="${DRUPAL_SITE_NAME:-My blog}"
export DRUPAL_SKIP_BOOTSTRAP="${DRUPAL_SKIP_BOOTSTRAP:-}"
export DRUPAL_ENABLE_MODULES="${DRUPAL_ENABLE_MODULES:-}"
export DRUPAL_PROFILE="${DRUPAL_PROFILE:-standard}" # only used during the first initialization
export DRUPAL_SITE_NAME="${DRUPAL_SITE_NAME:-My blog}" # only used during the first initialization
export DRUPAL_SKIP_BOOTSTRAP="${DRUPAL_SKIP_BOOTSTRAP:-}" # only used during the first initialization
export DRUPAL_ENABLE_MODULES="${DRUPAL_ENABLE_MODULES:-}" # only used during the first initialization
# Drupal credentials
export DRUPAL_USERNAME="${DRUPAL_USERNAME:-user}"
export DRUPAL_PASSWORD="${DRUPAL_PASSWORD:-bitnami}"
export DRUPAL_EMAIL="${DRUPAL_EMAIL:-user@example.com}"
export DRUPAL_USERNAME="${DRUPAL_USERNAME:-user}" # only used during the first initialization
export DRUPAL_PASSWORD="${DRUPAL_PASSWORD:-bitnami}" # only used during the first initialization
export DRUPAL_EMAIL="${DRUPAL_EMAIL:-user@example.com}" # only used during the first initialization
# Drupal SMTP credentials
DRUPAL_SMTP_HOST="${DRUPAL_SMTP_HOST:-"${SMTP_HOST:-}"}"
export DRUPAL_SMTP_HOST="${DRUPAL_SMTP_HOST:-}" # only used during the first initialization
DRUPAL_SMTP_PORT_NUMBER="${DRUPAL_SMTP_PORT_NUMBER:-"${SMTP_PORT:-}"}"
DRUPAL_SMTP_PORT_NUMBER="${DRUPAL_SMTP_PORT_NUMBER:-"${DRUPAL_SMTP_PORT:-}"}"
export DRUPAL_SMTP_PORT_NUMBER="${DRUPAL_SMTP_PORT_NUMBER:-25}" # only used during the first initialization
DRUPAL_SMTP_USER="${DRUPAL_SMTP_USER:-"${SMTP_USER:-}"}"
export DRUPAL_SMTP_USER="${DRUPAL_SMTP_USER:-}" # only used during the first initialization
DRUPAL_SMTP_PASSWORD="${DRUPAL_SMTP_PASSWORD:-"${SMTP_PASSWORD:-}"}"
export DRUPAL_SMTP_PASSWORD="${DRUPAL_SMTP_PASSWORD:-}" # only used during the first initialization
DRUPAL_SMTP_PROTOCOL="${DRUPAL_SMTP_PROTOCOL:-"${SMTP_PROTOCOL:-}"}"
export DRUPAL_SMTP_PROTOCOL="${DRUPAL_SMTP_PROTOCOL:-standard}" # only used during the first initialization
# Database configuration
export DRUPAL_DEFAULT_DATABASE_HOST="mariadb" # only used at build time
DRUPAL_DATABASE_HOST="${DRUPAL_DATABASE_HOST:-"${MARIADB_HOST:-}"}"
export DRUPAL_DATABASE_HOST="${DRUPAL_DATABASE_HOST:-$DRUPAL_DEFAULT_DATABASE_HOST}"
export DRUPAL_DATABASE_HOST="${DRUPAL_DATABASE_HOST:-$DRUPAL_DEFAULT_DATABASE_HOST}" # only used during the first initialization
DRUPAL_DATABASE_PORT_NUMBER="${DRUPAL_DATABASE_PORT_NUMBER:-"${MARIADB_PORT_NUMBER:-}"}"
export DRUPAL_DATABASE_PORT_NUMBER="${DRUPAL_DATABASE_PORT_NUMBER:-3306}"
export DRUPAL_DATABASE_NAME="${DRUPAL_DATABASE_NAME:-bitnami_drupal}"
export DRUPAL_DATABASE_USER="${DRUPAL_DATABASE_USER:-bn_drupal}"
export DRUPAL_DATABASE_PASSWORD="${DRUPAL_DATABASE_PASSWORD:-}"
export DRUPAL_DATABASE_TLS_CA_FILE="${DRUPAL_DATABASE_TLS_CA_FILE:-}"
export DRUPAL_DATABASE_PORT_NUMBER="${DRUPAL_DATABASE_PORT_NUMBER:-3306}" # only used during the first initialization
export DRUPAL_DATABASE_NAME="${DRUPAL_DATABASE_NAME:-bitnami_drupal}" # only used during the first initialization
export DRUPAL_DATABASE_USER="${DRUPAL_DATABASE_USER:-bn_drupal}" # only used during the first initialization
export DRUPAL_DATABASE_PASSWORD="${DRUPAL_DATABASE_PASSWORD:-}" # only used during the first initialization
export DRUPAL_DATABASE_TLS_CA_FILE="${DRUPAL_DATABASE_TLS_CA_FILE:-}" # only used during the first initialization
export DRUPAL_DATABASE_MIN_VERSION="${DRUPAL_DATABASE_MIN_VERSION:-}"
# PHP configuration

View File

@@ -41,6 +41,13 @@ drupal_validate() {
error "$1"
error_code=1
}
check_multi_value() {
if [[ " ${2} " != *" ${!1} "* ]]; then
print_validation_error "The allowed values for ${1} are: ${2}"
fi
}
check_yes_no_value() {
if ! is_yes_no_value "${!1}" && ! is_true_false_value "${!1}"; then
print_validation_error "The allowed values for ${1} are: yes no"
@@ -77,6 +84,15 @@ drupal_validate() {
done
fi
# Validate SMTP credentials
if ! is_empty_value "$DRUPAL_SMTP_HOST"; then
for empty_env_var in "DRUPAL_SMTP_USER" "DRUPAL_SMTP_PASSWORD" "DRUPAL_SMTP_PORT_NUMBER" "DRUPAL_SMTP_PROTOCOL"; do
is_empty_value "${!empty_env_var}" && warn "The ${empty_env_var} environment variable is empty or not set."
done
! is_empty_value "$DRUPAL_DATABASE_PORT_NUMBER" && validate_port "$DRUPAL_SMTP_PORT_NUMBER"
! is_empty_value "$DRUPAL_SMTP_PROTOCOL" && check_multi_value "DRUPAL_SMTP_PROTOCOL" "standard tls ssl"
fi
# Check that the web server is properly set up
web_server_validate || print_validation_error "Web server validation failed"
@@ -126,6 +142,10 @@ drupal_initialize() {
info "Enabling Drupal modules"
drupal_enable_modules
fi
if ! is_empty_value "$DRUPAL_SMTP_HOST"; then
info "Configuring SMTP"
drupal_configure_smtp
fi
info "Flushing Drupal cache"
drupal_flush_cache
else
@@ -259,7 +279,7 @@ drupal_site_install() {
# Globals:
# *
# Arguments:
# None
# $@ - Arguments to pass to the Drush tool
# Returns:
# None
#########################
@@ -271,6 +291,30 @@ drush_execute() {
fi
}
########################
# Execute Drush Tool to set a config option
# Globals:
# *
# Arguments:
# $1 - config group
# $2 - config key
# $3 - config value
# Returns:
# None
#########################
drush_config_set() {
local -r group="${1:?missing config group}"
local -r key="${2:?missing config key}"
local -r value="${3:?missing config value}"
local -r major_version="$(get_sematic_version "$(drupal_get_version)" 1)"
if [[ "$major_version" -gt 7 ]]; then
drush_execute "config-set" "--yes" "$group" "$key" "$value"
else
drush_execute "variable-set" "$key" "$value"
fi
}
########################
# Get Drupal version
# Globals:
@@ -300,6 +344,36 @@ drupal_enable_modules() {
drush_execute "pm:enable" "--yes" "${modules[@]}"
}
########################
# Drupal configure SMTP
# Globals:
# *
# Arguments:
# None
# Returns:
# None
#########################
drupal_configure_smtp() {
local -r major_version="$(get_sematic_version "$(drupal_get_version)" 1)"
drush_execute "pm:enable" "--yes" "smtp"
if [[ "$major_version" -gt 7 ]]; then
drush_config_set "system.mail" "interface.default" "SMTPMailSystem"
else
drush_execute "php:eval" 'variable_set("mail_system", array("default-system" => "SmtpMailSystem"))'
fi
drush_config_set "smtp.settings" "smtp_on" "1"
drush_config_set "smtp.settings" "smtp_host" "$DRUPAL_SMTP_HOST"
drush_config_set "smtp.settings" "smtp_port" "$DRUPAL_SMTP_PORT_NUMBER"
drush_config_set "smtp.settings" "smtp_protocol" "$DRUPAL_SMTP_PROTOCOL"
drush_config_set "smtp.settings" "smtp_username" "$DRUPAL_SMTP_USER"
drush_config_set "smtp.settings" "smtp_password" "$DRUPAL_SMTP_PASSWORD"
drush_config_set "smtp.settings" "smtp_from" "$DRUPAL_EMAIL"
drush_config_set "smtp.settings" "smtp_fromname" "$DRUPAL_SITE_NAME"
}
########################
# Drupal flush cache
# Globals:
@@ -315,7 +389,7 @@ drupal_flush_cache() {
drush_execute "cache:rebuild"
else
# This is occasionally needed by modules that make system-wide changes to access levels.
drush_execute php-eval 'node_access_rebuild();'
drush_execute "php:eval" 'node_access_rebuild();'
drush_execute "cache:clear" "all"
fi
}