#! /bin/bash . /usr/src/k_framework/main.sh # ---- VARS ----- VERSION="1.0.2" SCRIPT_NAME="phpmyadmin check" TEST=0 # 1 - do not execute changes # ---- FUNCTIONS ----- # ---- MAIN ----- k_start k_config_details PDIR="/var/www/html/${SYSTEM_CONFIG_DIR}dbadmin" FIX="/usr/src/k_framework/helpers/phpmyadmin/phpmyadmin_install.sh" if [[ -e /var/www/html/moradmin ]]; then if ! [[ -e /var/www/html/moradmin/.htaccess && -e /var/www/html/.htpasswd ]]; then report "phpmyadmin accessbile without passwords and in wrong directory" 1 report " rm -rf /var/www/html/moradmin" fix report " $FIX" fix EXIT_CODE=1 else report "phpmyadmin is directory /var/www/html/moradmin but should be $PDIR" 1 report " rm -rf /var/www/html/moradmin" fix report " $FIX" fix EXIT_CODE=1 fi fi if [[ -e $PDIR ]]; then if ! [[ -e $PDIR/.htaccess && -e $PDIR/.htpasswd ]]; then report ".htaccess or .htpasswd is missing in $PDIR" 1 report " $FIX" fix EXIT_CODE=1 else if [[ ! -s $PDIR/.htaccess ]]; then report "/var/www/html/mordbadmin/.htaccess exist but is empty" 1 report " $FIX" fix EXIT_CODE=1 fi if [[ ! -s $PDIR/.htpasswd ]]; then report "$PDIR/.htpasswd exist but is empty" 1 report " $FIX" fix EXIT_CODE=1 fi fi else report "phpmyadmin is not installed" 3 fi # createdd by incorrect phpmyadmin install script if [[ -e /var/www/html/CentOS ]]; then report "incorrect dir /var/www/html/CentOS exits" 1 report "rmdir /var/www/html/CentOS" fix report " $FIX" fix EXIT_CODE=1 fi if [[ $EXIT_CODE == 0 ]]; then report "phpmyadmin is installed properly in $PDIR" 0 fi k_exit "$EXIT_CODE"