Created
July 28, 2015 12:35
-
-
Save JMichaelRoach/d30e605e2cfdaf0c2184 to your computer and use it in GitHub Desktop.
Bash script to update WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| cd $1 | |
| if [ -f 'wp-config.php' ] && [ -d 'wp-admin' ] && [ 'wp-includes' ]; | |
| then | |
| rm -rf ./wp-admin | |
| rm -rf ./wp-includes | |
| cp -rf /var/www/wordpress/* . | |
| git add -u | |
| git commit -m "WordPress updates" | |
| else | |
| pwd | |
| echo "This doesn't appear to be a valid WordPress instance" | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For safety, there are two requirements:
In addition, to reduce the presence of malware and other harmful code, please the note the wp-admin and wp-includes folder are completed removed and replaced.
Also, /var/www/wordpress should be a clone of WordPress on github ... use git checkout tag to ensure you're pulling the most updated version.
Finally, I recommend keeping each installation as a git repo so you can more easily track changes.