######################### # THE PASSWORD FUNCTION # ######################### function password() { while [[ $# -gt 0 ]] do KEY="$1" case $KEY in -d|--duration) DURATION=$2 ; shift ;; -u|--username) USERNAME=$2 ; shift ;; -v|--view) VIEW="yes" ;; -p|--path) DIRECTORY=$2 ; shift ;; *) echo "$1 not implemented" ; POSIT+=("$1") ;; esac shift done DIRECTORY=${DIRECTORY:-`pwd`} USERNAME=${USERNAME:-admin} VIEW=${VIEW:-no} DURATION=${DURATION:-600s} [ -f $DIRECTORY/wp-config.php ] || echo "this isn't a wordpress installation" [ -f $DIRECTORY/wp-config.php ] || exit 1 local DATETIME=`date +%Y%m%d.%H%M` echo "==WPM PASSWORD CALLED ON $DATETIME WITH VERSION $WPMVERSION==" | tee -a $LOGFILE echo "==UNIQUE IDENTIFIER $INSTANCEID==" | tee -a $LOGFILE echo "==$INSTANCEID==Executing password on $DIRECTORY" | tee -a $LOGFILE cd $DIRECTORY local DATABASENAME=`grep DB_NAME wp-config.php | cut -f 2 -d ',' | cut -f 2 -d "'"` echo "==$INSTANCEID==The DB name is $DATABASENAME" | tee -a $LOGFILE if mysql "${DATABASENAME}" >/dev/null 2>&1