Skip to content
Open
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ Externally the MySQL server is available at port 8889, and when running on the V
Username: root
Password: root

#### Database import
If you want to import existing database, file to import can be set in `provision.sh` in `wordpress_database_dumped` variable. By default, it's `wordpress.sql`

Technical Details
-----------------
* Ubuntu 14.04 64-bit
Expand Down
8 changes: 8 additions & 0 deletions provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ wordpress_username="wordpress_user"
wordpress_password="password"
wordpress_database="wordpress"
wordpress_debug="true"
wordpress_database_dumped="wordpress.sql"

# This function is called at the very bottom of the file
main() {
Expand Down Expand Up @@ -37,6 +38,7 @@ EOD
download_wordpress_tarball
extract_wordpress_to_var_www_html_directory
create_database_in_mysql
create_database_from_dump
configure_wordpress_mysql_credentials

touch /var/lock/vagrant-provision
Expand Down Expand Up @@ -140,6 +142,12 @@ FLUSH PRIVILEGES;
EOF
}

create_database_from_dump() {
if [[ ! -f ${wordpress_database_dumped} ]]; then
mysql -uroot -proot wordpress < /vagrant/${wordpress_database_dumped}
fi
}

configure_wordpress_mysql_credentials() {
sed -e "s/define('DB_NAME'.*/define('DB_NAME', '${wordpress_database}');/g" \
-e "s/define('DB_USER'.*/define('DB_USER', '${wordpress_username}');/g" \
Expand Down