Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bin/prestart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,19 @@ else
# set a nice default permalink structure
wp --allow-root option update permalink_structure '/%year%/%monthnum%/%postname%/'
# set theme
if [ $WORDPRESS_ACTIVE_THEME ]
if [ -n "$WORDPRESS_ACTIVE_THEME" ]
then
wp --allow-root theme activate $WORDPRESS_ACTIVE_THEME
fi

if [ $WORDPRESS_TEST_DATA ]
if [[ $WORDPRESS_TEST_DATA=true ]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"true" has no special meaning in bash, so if this works, it's doing a string comparison and won't match "True", "TRUE", or "1" as you'd expect in PHP. Perhaps this should be tested the same as $WORDPRESS_ACTIVE_THEME above and many WP constants are, and simply test if it's set with a non-empty value? [ -n "WORDPRESS_TEST_DATA" ] should work reliably.

then
echo "installing WP test content"
wp --allow-root plugin install wordpress-importer --activate
curl -OL https://raw.githubusercontent.com/manovotny/wptest/master/wptest.xml
wp --allow-root import wptest.xml --authors=create
wp --allow-root plugin uninstall wordpress-importer --deactivate
chown -R www-data:www-data /var/www/html/wordpress/content/uploads/*
rm wptest.xml
fi
fi
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ envcheck() {
echo '# Environment variables for for WordPress site' > _env
echo '# please include the scheme http:// or https:// in the URL variable' >> _env

echo 'WORDPRESS_URL=http://'wordpress.svc.${TRITON_ACCOUNT}.${TRITON_DC}.triton.zone >> _env
echo 'WORDPRESS_URL=http://'nginx.svc.${TRITON_ACCOUNT}.${TRITON_DC}.triton.zone >> _env
echo 'WORDPRESS_SITE_TITLE=Autopilot Pattern WordPress test site' >> _env
echo 'WORDPRESS_ADMIN_EMAIL=user@example.net' >> _env
echo 'WORDPRESS_ADMIN_USER=admin-'$(cat /dev/urandom | LC_ALL=C tr -dc 'A-Za-z0-9' | head -c 3) >> _env
Expand Down