# strip off any '#' symbol ('#1000' is valid syntax for Apache)
pound='#'
user="${user#$pound}"
group="${group#$pound}"
;;
*)# php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi
# if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then
# # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory)
# if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then
# chown "$user:$group" .
# fi
#
# echo >&2 "WordPress not found in $PWD - copying now..."
# if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then
# echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
# fi
# sourceTarArgs=(
# --create
# --file -
# --directory /usr/src/wordpress
# --owner "$user" --group "$group"
# )
# targetTarArgs=(
# --extract
# --file -
# )
# if [ "$uid" != '0' ]; then
# # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
# targetTarArgs+=( --no-overwrite-dir )
# fi
# # loop over "pluggable" content in the source, and if it already exists in the destination, skip it
# tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
# echo >&2 "Complete! WordPress has been successfully copied to $PWD"
# fi
#
# wpEnvs=( "${!WORDPRESS_@}" )
# if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then
# for wpConfigDocker in \
# wp-config-docker.php \
# /usr/src/wordpress/wp-config-docker.php \
# ; do
# if [ -s "$wpConfigDocker" ]; then
# echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})"
# # using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables)