echo >&2 ' Did you forget to -e WORDPRESS_DB_PASSWORD=... ?'
echo >&2 ' Did you forget to -e WORDPRESS_DB_PASSWORD=... ?'
-
echo >&2
echo >&2
-
echo >&2 ' (Also of interest might be WORDPRESS_DB_USER and WORDPRESS_DB_NAME.)'
echo >&2 ' (Also of interest might be WORDPRESS_DB_USER and WORDPRESS_DB_NAME.)'
-
exit 1
exit 1
-
fi
fi
-
-
if ! [ -e index.php -a -e wp-includes/version.php ]; then
if ! [ -e index.php -a -e wp-includes/version.php ]; then
-
echo >&2 "WordPress not found in $(pwd) - copying now..."
echo >&2 "WordPress not found in $(pwd) - copying now..."
-
if [ "$(ls -A)" ]; then
if [ "$(ls -A)" ]; then
-
echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!"
echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!"
-
( set -x; ls -A; sleep 10 )
( set -x; ls -A; sleep 10 )
-
fi
tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
fi
tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
-
echo >&2 "Complete! WordPress has been successfully copied to $(pwd)"
echo >&2 "Complete! WordPress has been successfully copied to $(pwd)"
-
if [ ! -e .htaccess ]; then
if [ ! -e .htaccess ]; then
-
# NOTE: The "Indexes" option is disabled in the php:apache base image
# NOTE: The "Indexes" option is disabled in the php:apache base image
-
cat > .htaccess <<-'EOF'
cat > .htaccess <<-'EOF'
-
# BEGIN WordPress
# BEGIN WordPress
-
<IfModule mod_rewrite.c>
<IfModule mod_rewrite.c>
-
RewriteEngine On
RewriteEngine On
-
RewriteBase /
RewriteBase /
-
RewriteRule ^index\.php$ - [L]
RewriteRule ^index\.php$ - [L]
-
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-f
-
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-d
-
RewriteRule . /index.php [L]
RewriteRule . /index.php [L]
-
</IfModule>
</IfModule>
-
# END WordPress
# END WordPress
-
EOF
EOF
-
chown www-data:www-data .htaccess
chown www-data:www-data .htaccess
-
fi
fi
-
fi
fi
-
-
# TODO handle WordPress upgrades magically in the same way, but only if wp-includes/version.php's $wp_version is less than /usr/src/wordpress/wp-includes/version.php's $wp_version
# TODO handle WordPress upgrades magically in the same way, but only if wp-includes/version.php's $wp_version is less than /usr/src/wordpress/wp-includes/version.php's $wp_version
-
-
-
if [ ! -e wp-config.php ]; then
if [ ! -e wp-config.php ]; then
-
awk '/^\/\*.*stop editing.*\*\/$/ && c == 0 { c = 1; system("cat") } { print }' wp-config-sample.php > wp-config.php <<'EOPHP'
awk '/^\/\*.*stop editing.*\*\/$/ && c == 0 { c = 1; system("cat") } { print }' wp-config-sample.php > wp-config.php <<'EOPHP'
-
// If we're behind a proxy server and using HTTPS, we need to alert Wordpress of that fact
// If we're behind a proxy server and using HTTPS, we need to alert Wordpress of that fact
-
// see also http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy
// see also http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy
-
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {