Add 'Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh'

This commit is contained in:
2020-09-02 11:19:56 +00:00
parent 48d20f5850
commit c36a3f64ba

View File

@@ -0,0 +1,37 @@
function usage {
echo "Usage: $0 [option...]" >&2
echo
echo " -e, Enable PhpMyadmin"
echo " -d, Disable PhpMyadmin"
echo " -h, Shows this information"
echo
}
if [ -n "$1" ]; then
if [[ ! -f /etc/ICTM/toggle.conf ]]; then
echo "Creating File"
touch /etc/ICTM/toggle.conf
fi
source /etc/ICTM/toggle.conf
if [ -z "$PhpMA" ]; then
echo "Creating Var"
echo "PhpMA=3" >> /etc/ICTM/toggle.conf
PhpMA=3
fi
if [[ "$1" = "-d" && "$PhpMA" != 0 ]]; then
echo "Disable PhpMyadmin"
sed -i '/PhpMA=/c\PhpMA=0' /etc/ICTM/toggle.conf
sed -i --follow-symlinks '/#enables\/disables PHPMyadmin/!b;n;cdeny from all' /etc/apache2/sites-enabled/010-Backend.conf
systemctl reload nginx
elif [[ "$1" = "-e" && "$PhpMA" != 1 ]]; then
echo "Enable PhpMyadmin"
sed -i '/PhpMA=/c\PhpMA=1' /etc/ICTM/toggle.conf
sed -i --follow-symlinks '/#enables\/disables PHPMyadmin/!b;n;c#deny from all' /etc/apache2/sites-enabled/010-Backend.conf
systemctl reload nginx
elif [[ "$1" = "-h" ]]; then
usage
else
echo "Oopsie!"
fi
else
usage
fi