echo>&2 "WordPress not found in $(pwd) - copying now..."
if["$(ls-A)"];then
echo>&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!"
(set-x;ls-A;sleep 10 )
fi
tar cf - --one-file-system-C /usr/src/wordpress . | tar xf -
echo>&2 "Complete! WordPress has been successfully copied to $(pwd)"
if[!-e .htaccess ];then
# NOTE: The "Indexes" option is disabled in the php:apache base image
cat> .htaccess <<-'EOF'
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
EOF
chown www-data:www-data .htaccess
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
if[!-e wp-config.php ];then
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
// 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') {