add wordpress uninstall functionality

This commit is contained in:
2015-07-13 14:24:05 +03:00
parent 34c905c62b
commit 49648f229d
2 changed files with 45 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ PATH=$PATH:$HOME/bin
## FUNCTIONS
function checkaction {
REGEX="^adduser$|^changepw$|^listusers$|^userdetail$|^deluser$|^sizeall$|^sizeuser$|^viewdata$|^addalias$|^quota$|^installwp$"
REGEX="^adduser$|^changepw$|^listusers$|^userdetail$|^deluser$|^sizeall$|^sizeuser$|^viewdata$|^addalias$|^quota$|^installwp$|^uninstallwp$"
if [[ $1 =~ $REGEX ]]; then
echo "true"
else
@@ -460,3 +460,34 @@ if [ "$ACTION" == "installwp" ]; then
echo "Please take a look into your data sheet for the login data."
fi # /installwp
# # # # #
# REMOVE WORDPRESS
# # # # #
if [ "$ACTION" == "uninstallwp" ]; then
echo "Uninstalling WordPress..."
echo
# $USER: Username for Wordpress
# $PASS: Email address for Wordpress user
WEBDIR=$HOME/html
MYSQLUSER=$SYSUSER
MYSQLDB=${MYSQLUSER}_wp
# Delete database and content of ~/htmp
mysql -e "DROP DATABASE ${MYSQLDB};"
rm -rf $WEBDIR/*
rm -rf $WEBDIR/.*
# Update datasheet
LEAD='## > MYSQL'
TAIL='## < MYSQL'
notesdelete ".*"
echo
echo "Wordpress successfully uninstalled."
fi # /uninstallwp

View File

@@ -191,6 +191,19 @@ This panel will not work without activated JavaScript.</span></noscript>
</form>
</div> <!-- /hide -->
<!-- UNINSTALLWP - Uninstall WordPress -->
<b class="switch"><span class="turn_on">&#187;</span><span class="turn_off">&#171;</span> Uninstall WordPress</b>
<div class="hide">
<p>Deletes all files in your webdirectory and the database &lt;YourUsername&gt;_wp.<br />
<span class="warn">THIS OPERATION CANNOT BE UNDONE! ALL POST, PAGES AND SETTINGS WILL BE REMOVED!</span></p>
<form action="submit.php" method="post">
<label for="sure">
<input type="checkbox" name="sure" value="yes" id="sure">Yes, I'm really sure that I want to uninstall WordPress completely
</label>
<button type="submit" name="action" value="deluser">Uninstall WordPress</button>
</form>
</div> <!-- /hide -->
</div> <!-- /gallery -->
</div> <!-- /wrapper -->