Last active
December 16, 2020 13:51
-
-
Save briandeheus/35857b30f0ae2d902056412dfe952522 to your computer and use it in GitHub Desktop.
Wordpress Cleaner
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 | |
tmp_path="/tmp/wordpress-cleaner" | |
echo "Wordpress Ultra Cleaner" | |
echo "--------" | |
echo "Fetching fresh copy of Wordpress" | |
curl -OL wordpress.org/latest.tar.gz | |
echo "Making new Wordpress directory" | |
sudo mkdir "$tmp_path" | |
echo "Unarchiving fresh Wordpress install" | |
sudo tar -xvf latest.tar.gz -C "$tmp_path" | |
echo "Copying over wp-content and configuration" | |
sudo cp /var/www/wordpress/wp-content "$tmp_path/wordpress" -r | |
sudo cp /var/www/wordpress/wp-config.php "$tmp_path/wordpress" | |
echo "Setting up permissions" | |
sudo chmod 755 "$tmp_path/wordpress" -R | |
sudo chown www-data:www-data "$tmp_path/wordpress" -R | |
echo "Backup up old Wordpress install" | |
sudo cp /var/www/wordpress /var/www/wordpress-old -r | |
echo "Deleting old Wordpress installation" | |
sudo rm -rf /var/www/wordpress | |
sudo mv "$tmp_path/wordpress" /var/www/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment