Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- THEME_FOLDER=`get_config_value 'theme' 'towa-theme'`
- # Add the site name to the hosts file
- echo "127.0.0.1 ${VVV_SITE_NAME}.test # vvv-auto" >> "/etc/hosts"
- # Create a database, if we don't already have one
- echo -e "\nCreating database '${VVV_SITE_NAME}' (if it's not already there)"
- mysql -u root --password=root -e "CREATE DATABASE IF NOT EXISTS ${VVV_SITE_NAME}"
- mysql -u root --password=root -e "GRANT ALL PRIVILEGES ON ${VVV_SITE_NAME}.* TO wp@localhost IDENTIFIED BY 'wp';"
- echo -e "\n DB operations done.\n\n"
- # Nginx Logs
- mkdir -p ${VVV_PATH_TO_SITE}/log
- touch ${VVV_PATH_TO_SITE}/log/error.log
- touch ${VVV_PATH_TO_SITE}/log/access.log
- cd ${VVV_PATH_TO_SITE}
- # create .env file and generate salt hashes
- if [ ! -e .env ]; then
- wp package install aaemnnosttv/wp-cli-dotenv-command:^1.0 --allow-root
- wp dotenv init --template=.env.example --with-salts --allow-root
- wp dotenv set 'DB_NAME' ${VVV_SITE_NAME} --allow-root
- fi
- # install composer dependencies
- noroot composer install --no-interaction --no-ansi
- # Install and configure the latest stable version of WordPress
- if ! $(wp core is-installed --allow-root); then
- wp core download --path="${VVV_PATH_TO_SITE}" --skip-plugins --skip-themes --allow-root
- 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
- wp plugin activate advanced-custom-fields-pro --path="${VVV_PATH_TO_SITE}" --allow-root
- wp theme activate "$THEME_FOLDER" --path="${VVV_PATH_TO_SITE}" --allow-root
- wp option update blog_public 0 --allow-root
- wp rewrite structure '/%postname%/' --hard --path="${VVV_PATH_TO_SITE}" --allow-root
- wp rewrite flush --hard --path="${VVV_PATH_TO_SITE}" --allow-root
- else
- wp core update --allow-root
- fi
Add Comment
Please, Sign In to add comment