Skip to content

Commit c1d6574

Browse files
Merge pull request #7 from russellmacshane/dev
Added QWCLI - Quick WordPress CLI
2 parents 5f166eb + a9bf2d2 commit c1d6574

File tree

5 files changed

+47
-13
lines changed

5 files changed

+47
-13
lines changed

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,8 @@ The goal of this project is to create a quick virtual machine setup with a WordP
3232

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

4038
## Cleanup
4139
1. If you are ready to delete your WordPress VM from you local machine - `$ vagrant destroy -f`
42-
43-
## Project Roadmap
44-
* ~~LAMP Stack installed on Virtual Machine with WordPress using Vagrant~~
45-
* ~~Plugin installations on initial WordPress install~~
46-
* ~~Site Backups~~
47-
* ~~Site Restores~~
48-
* Web Application instead of bash scripts for WordPress install, backup, and restore
49-
* Modifications to WP details in order to give a working WordPress backup to a host

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ sudo -E mysql -u root -p$mysql_root_password -e "create database $wp_db;"
4141
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'"
4242
sudo -E mysql -u root -p$mysql_root_password -e "GRANT ALL PRIVILEGES ON $wp_db.* TO phpmyadmin@localhost IDENTIFIED BY '$phpyadmin_password'"
4343

44+
echo "***************************** Install QWCli *****************************"
45+
sudo -E ln -s /quick-wordpress/qwcli/qwcli.sh /usr/local/bin/qwcli
46+
4447
echo "***************************** Install WPCli *****************************"
4548
cd /home/$USER
4649
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
File renamed without changes.

qwcli/qwcli.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# https://github.com/brotandgames/bagcli -- example location
4+
5+
cli_help() {
6+
cli_name=${0##*/}
7+
echo "
8+
$cli_name
9+
Quick WordPress CLI
10+
Version: 1.0.0
11+
https://github.com/russellmacshane/quick-wordpress
12+
13+
Usage: $cli_name [command]
14+
15+
Commands:
16+
backup Backup
17+
list List Backups
18+
restore Restore
19+
* Help
20+
"
21+
exit 1
22+
}
23+
24+
case "$1" in
25+
backup|b)
26+
/quick-wordpress/qwcli/backup.sh
27+
;;
28+
list|l)
29+
ls /quick-wordpress/backup
30+
;;
31+
restore|r)
32+
/quick-wordpress/qwcli/restore.sh
33+
;;
34+
*)
35+
cli_help
36+
;;
37+
esac

restore.sh renamed to qwcli/restore.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ source /quick-wordpress/config
55
echo "***************************** WordPress Restore **************************"
66
read -p "Enter the filename of the backup you would like to restore: " file
77

8-
backup_file=/quick-wordpress/backup/$file
8+
backup_dir=/quick-wordpress/backup
9+
backup_file=$backup_dir/$file
910

1011
if [ ! -f $backup_file ]; then
1112
echo "$backup_file not found!" 1>&2
13+
echo ""
14+
echo "Available backups in $backup_dir"
15+
ls $backup_dir
1216
exit 1
1317
fi
1418

0 commit comments

Comments
 (0)