# +----+----+----+----+ # | | | | | # Author: Mark David Scott Cunningham | M | D | S | C | # +----+----+----+----+ # Created: 2014-05-07 # Updated: 2020-02-25 # # #!/bin/bash # http://wordpress.org/plugins/wp-multi-network/ # http://codex.wordpress.org/images/9/97/WP3.8-ERD.png # Taste the rainbow BLACK=$(tput setaf 0); RED=$(tput setaf 1) GREEN=$(tput setaf 2); YELLOW=$(tput setaf 3) BLUE=$(tput setaf 4); PURPLE=$(tput setaf 5) CYAN=$(tput setaf 6); WHITE=$(tput setaf 7) BRIGHT=$(tput bold); NORMAL=$(tput sgr0) BLINK=$(tput blink); REVERSE=$(tput smso) UNDERLINE=$(tput smul) getusr(){ pwd | sed 's:^/chroot::' | cut -d/ -f3; } echo; runonce=0; if [[ $1 =~ ^-.*$ ]]; then SITEPATH='.'; opt="$1"; shift; param="$@"; else SITEPATH="$1"; opt="$2"; shift; shift; param="$@"; fi; if [[ -f $SITEPATH/wp-includes/version.php ]]; then version=$(grep "wp_version =" $SITEPATH/wp-includes/version.php | cut -d\' -f2) dbversion=$(grep "wp_db_version =" $SITEPATH/wp-includes/version.php | awk '{print $3}' | tr -d \;) fi if [[ -f $SITEPATH/wp-config.php ]]; then if grep -Eqi "MULTISITE...true" $SITEPATH/wp-config.php; then edition='WP Multisite'; else edition='Wordpress'; fi prefix=$(grep table_prefix $SITEPATH/wp-config.php | cut -d\' -f2); fi # if [[ -f $SITEPATH/wp-config.php ]]; then continue=1; else echo -e "\n Could not find Worpdress configuration file!\n"; return 0; fi _wpdbinfo(){ dbconnect=($(grep DB_ $SITEPATH/wp-config.php 2> /dev/null | cut -d\' -f4)); dbname=${dbconnect[0]}; dbuser="${dbconnect[1]}"; dbpass="${dbconnect[2]}"; dbhost=${dbconnect[3]}; } _wpdbusage(){ echo " Usage: wpdb []