Commit 6c1b8306 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Add the PHP_DIRECTIVES config option

parent f12be6dc
Loading
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -126,6 +126,18 @@ be the latest stable available in the wordpress.org registry.

The path to a file containing lines to append to [**PLUGINS**](#plugins).

### PHP_DIRECTIVES

**Type**: array\
**Required**: no\
**Default**: "upload_max_filesize=20M", "post_max_size=20M"

An array of "key=value" strings declaring [PHP directives][].

**Note:** These values may alternatively be supplied as container command 
arguments prefixed with the '-d' flag:
`-d upload_max_filesize=20M -d post_max_size=20M`

### STATIC_PATTERNS

**Type**: array\
@@ -173,3 +185,8 @@ to go near the end of the file.
This is an array of lines (without terminating carriage-returns) to add to 
*wp-config.php* just before the contents of the file in 
[**WP_CONFIG_EXTRA**](#wp_config_extra).


[php directives]:
  https://www.php.net/manual/en/ini.list.php
  "PHP: List of php.ini directives"
+13 −1
Original line number Diff line number Diff line
@@ -27,6 +27,12 @@ declare -a STATIC_PATTERNS=(
	"README"
	"readme.html"
)
declare -a PHP_DIRECTIVES=(
	${PHP_DIRECTIVES-}
	upload_max_filesize=20M
	post_max_size=20M
)


create_config()
{
@@ -176,6 +182,12 @@ if [[ -e ${LANGUAGES_LIST:=/etc/wordpress/languages.txt} ]]; then
	LANGUAGES+=( $(<"${LANGUAGES_LIST}") )
fi

declare -a extra_args

for directive in "${PHP_DIRECTIVES[@]}"; do
	extra_args+=( -d "${directive}" )
done

case "$1" in
	database-setup) create_config -f && setup_database "${@:2}" ;;
	install-setup) create_config && setup_components ;;
@@ -186,7 +198,7 @@ case "$1" in
		setup_components
		collect_static
		run_background_cron
		exec "$@"
		exec "$@" "${extra_args[@]}"
		;;
	*)
		[[ -v DB_NAME ]] && create_config || true