Guest User

Untitled

a guest
Feb 28th, 2018
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. THEME_FOLDER=`get_config_value 'theme' 'towa-theme'`
  4.  
  5. # Add the site name to the hosts file
  6. echo "127.0.0.1 ${VVV_SITE_NAME}.test # vvv-auto" >> "/etc/hosts"
  7.  
  8. # Create a database, if we don't already have one
  9. echo -e "\nCreating database '${VVV_SITE_NAME}' (if it's not already there)"
  10. mysql -u root --password=root -e "CREATE DATABASE IF NOT EXISTS ${VVV_SITE_NAME}"
  11. mysql -u root --password=root -e "GRANT ALL PRIVILEGES ON ${VVV_SITE_NAME}.* TO wp@localhost IDENTIFIED BY 'wp';"
  12. echo -e "\n DB operations done.\n\n"
  13.  
  14. # Nginx Logs
  15. mkdir -p ${VVV_PATH_TO_SITE}/log
  16. touch ${VVV_PATH_TO_SITE}/log/error.log
  17. touch ${VVV_PATH_TO_SITE}/log/access.log
  18.  
  19. cd ${VVV_PATH_TO_SITE}
  20.  
  21. # create .env file and generate salt hashes
  22. if [ ! -e .env ]; then
  23. wp package install aaemnnosttv/wp-cli-dotenv-command:^1.0 --allow-root
  24. wp dotenv init --template=.env.example --with-salts --allow-root
  25. wp dotenv set 'DB_NAME' ${VVV_SITE_NAME} --allow-root
  26. fi
  27.  
  28. # install composer dependencies
  29. noroot composer install --no-interaction --no-ansi
  30.  
  31. # Install and configure the latest stable version of WordPress
  32. if ! $(wp core is-installed --allow-root); then
  33. wp core download --path="${VVV_PATH_TO_SITE}" --skip-plugins --skip-themes --allow-root
  34. wp core install --path="${VVV_PATH_TO_SITE}" --url="${VVV_SITE_NAME}.test" --title="${VVV_SITE_NAME}" --admin_user=towa_admin --admin_password=dev --admin_email=kundencenter@towa.at --skip-email --allow-root
  35. wp plugin activate advanced-custom-fields-pro --path="${VVV_PATH_TO_SITE}" --allow-root
  36. wp theme activate "$THEME_FOLDER" --path="${VVV_PATH_TO_SITE}" --allow-root
  37. wp option update blog_public 0 --allow-root
  38. wp rewrite structure '/%postname%/' --hard --path="${VVV_PATH_TO_SITE}" --allow-root
  39. wp rewrite flush --hard --path="${VVV_PATH_TO_SITE}" --allow-root
  40. else
  41. wp core update --allow-root
  42. fi
Add Comment
Please, Sign In to add comment