Skip to content

Commit

Permalink
Merge pull request #7 from russellmacshane/dev
Browse files Browse the repository at this point in the history
Added QWCLI - Quick WordPress CLI
  • Loading branch information
russellmacshane authored Oct 2, 2020
2 parents 5f166eb + a9bf2d2 commit c1d6574
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 13 deletions.
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,8 @@ The goal of this project is to create a quick virtual machine setup with a WordP

## Backup and Restores
1. In order to do backup and restores login to your virtual machine - `$ vagrant ssh`
2. `$ cd /quick-wordpress`
3. `$ ./backup.sh` and follow the on screen instructions
4. Backups are saved in the `/quick-wordpress/backups` directory
5. If you'd like to restore from a previous backup - `$ ./restore.sh` and follow the on screen instructions
2. `$ qwcli backup` and follow the on screen instructions
3. If you'd like to restore from a previous backup - `$ qwcli restore` and follow the on screen instructions

## Cleanup
1. If you are ready to delete your WordPress VM from you local machine - `$ vagrant destroy -f`

## Project Roadmap
* ~~LAMP Stack installed on Virtual Machine with WordPress using Vagrant~~
* ~~Plugin installations on initial WordPress install~~
* ~~Site Backups~~
* ~~Site Restores~~
* Web Application instead of bash scripts for WordPress install, backup, and restore
* Modifications to WP details in order to give a working WordPress backup to a host
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ sudo -E mysql -u root -p$mysql_root_password -e "create database $wp_db;"
sudo -E mysql -u root -p$mysql_root_password -e "GRANT ALL PRIVILEGES ON $wp_db.* TO $wp_db_user@localhost IDENTIFIED BY '$wp_db_password'"
sudo -E mysql -u root -p$mysql_root_password -e "GRANT ALL PRIVILEGES ON $wp_db.* TO phpmyadmin@localhost IDENTIFIED BY '$phpyadmin_password'"

echo "***************************** Install QWCli *****************************"
sudo -E ln -s /quick-wordpress/qwcli/qwcli.sh /usr/local/bin/qwcli

echo "***************************** Install WPCli *****************************"
cd /home/$USER
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Expand Down
File renamed without changes.
37 changes: 37 additions & 0 deletions qwcli/qwcli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# https://github.com/brotandgames/bagcli -- example location

cli_help() {
cli_name=${0##*/}
echo "
$cli_name
Quick WordPress CLI
Version: 1.0.0
https://github.com/russellmacshane/quick-wordpress
Usage: $cli_name [command]
Commands:
backup Backup
list List Backups
restore Restore
* Help
"
exit 1
}

case "$1" in
backup|b)
/quick-wordpress/qwcli/backup.sh
;;
list|l)
ls /quick-wordpress/backup
;;
restore|r)
/quick-wordpress/qwcli/restore.sh
;;
*)
cli_help
;;
esac
6 changes: 5 additions & 1 deletion restore.sh → qwcli/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ source /quick-wordpress/config
echo "***************************** WordPress Restore **************************"
read -p "Enter the filename of the backup you would like to restore: " file

backup_file=/quick-wordpress/backup/$file
backup_dir=/quick-wordpress/backup
backup_file=$backup_dir/$file

if [ ! -f $backup_file ]; then
echo "$backup_file not found!" 1>&2
echo ""
echo "Available backups in $backup_dir"
ls $backup_dir
exit 1
fi

Expand Down

0 comments on commit c1d6574

Please sign in to comment.