From 99ecab36489f3732d52378ab00d770f84cf8a9a5 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 25 Jun 2014 17:08:02 +0530 Subject: [PATCH] Search/replace --- bin/ee | 1326 -------------------------------------------------------- 1 file changed, 1326 deletions(-) diff --git a/bin/ee b/bin/ee index a7532211..0167eb13 100644 --- a/bin/ee +++ b/bin/ee @@ -1,561 +1,6 @@ #!/bin/bash -EE_MYSQL_USERPASS() -{ - read -p "Enter The MySQL Username [root]: " EE_MYSQL_USER - # If Enter Is Pressed, Then Use root as MySQL User - if [[ $EE_MYSQL_USER = "" ]] - then - EE_MYSQL_USER=root - fi - - # Turn Off Echo For Passwords - stty -echo - read -p "Enter The MySQL Password: " EE_MYSQL_PASS - stty echo - echo -} - - -EE_MYSQL_PASSCHECK() -{ - while [ -n $(mysqladmin -h $EE_MYSQL_HOST -u $EE_MYSQL_USER -p$EE_MYSQL_PASS ping 2> /dev/null | grep alive) &> /dev/null ] - do - # Verify MySQL Credentials - EE_MYSQL_USERPASS - done -} - -MYSQLROOT() -{ - EE_MYSQL_USER=$(cat ~/.my.cnf | grep user | cut -d'=' -f2) - EE_MYSQL_PASS=$(cat ~/.my.cnf | grep pass | cut -d'=' -f2 | sed -e 's/^"//' -e 's/"$//') -} -# GET Information Function -MYSQLINFO() -{ - # Get The MySQL Host - EE_MYSQL_HOST=$(grep mysqlhost /etc/easyengine/ee.conf | awk '{print($3)}') - - # MySQL Default Host: localhost - if [[ $EE_MYSQL_HOST = "" ]] - then - EE_MYSQL_HOST=localhost - fi - - if [ -f ~/.my.cnf ] - then - MYSQLROOT - else - # Verify MySQL Credentials - EE_MYSQL_USERPASS - fi - - # Verify MySQL Credentials - EE_MYSQL_PASSCHECK - - # Replace Dot With Underscore In $EE_DOMAIN Name - ee_replace_dot=$(echo $EE_DOMAIN | tr '.' '_') - - # Check Use Default DB Name Or Custom DB Name - grep customdbname /etc/easyengine/ee.conf | grep -i true &>> /dev/null - - if [ $? -eq 0 ] - then - read -p "Enter The MySQL Database Name [$ee_replace_dot]: " EE_DB_NAME - fi - - # If customdbname = false - # Then It Never Ask For MySQL Database Name In This Case $EE_DB_NAME Is Empty - # If customdbname = true - # User Enter Custom Databse Name Then EE_DB_NAME Is Not Empty & We Used Provided Database Name - # If User Pressed Enter Then $EE_DB_NAME Is Empty - - if [[ $EE_DB_NAME = "" ]] - then - EE_DB_NAME=$ee_replace_dot - fi -} - -EEWPDBPREFIX() -{ - # Get The WordPress Database Table Prefix - EE_WP_PREFIX=$(grep wpdbprefix /etc/easyengine/ee.conf | awk '{print($3)}') - - # Display EE_WP_PREFIX Valid Characters Warning & Try Again - while [ $(echo $EE_WP_PREFIX | grep '[^[:alnum:] _]') ] - do - ee_lib_echo_fail "Warning: \033[34mTable Prefix Can Only Contain Numbers, Letters, And Underscores." - # For Proper read Command Output - stty echo - read -p "Enter The MySQL Database Table Prefix [wp_]: " EE_WP_PREFIX - done - - # WordPress Database Table Prefix Default: wp_ - if [[ $EE_WP_PREFIX = "" ]] - then - EE_WP_PREFIX=wp_ - fi -} - -FIXEE_MYSQL_USER16() -{ - # Fix MySQL USER ERROR 1470 (HY000) - EE_MYSQL_USER16=$(echo -n $EE_DB_USER | wc -c) - - if [[ $EE_MYSQL_USER16 -gt 16 ]] - then - echo MySQL Database Username $EE_DB_USER = $EE_MYSQL_USER16 &>> $EE_COMMAND_LOG - ee_lib_echo "Auto Fix MySQL Username To The 16 Characters" - RANDOM_CHARACTER=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n1) - EE_DB_USER=$(echo $ee_replace_dot | cut -c1-16 | sed "s/.\{10\}$/$RANDOM_CHARACTER/") - - #ee_lib_echo_fail "ERROR 1470 (HY000): $EE_DB_USER Is Too Long For MySQL Username" - # Turn Off Echo For Passwords - #stty echo - #read -p "Enter The MySQL Database Username [$ee_replace_dot16]: " EE_DB_USER - - #if [[ $EE_DB_USER = "" ]] - #then - # EE_DB_USER=$ee_replace_dot16 - #fi - - fi - -} - -ee_mod_setup_database() -{ - # Create Database - mysql -h $EE_MYSQL_HOST -u $EE_MYSQL_USER -p$EE_MYSQL_PASS -e "create database \`$EE_DB_NAME\`" \ - || ee_lib_error "Unable To Create $EE_DB_NAME Database" - - # Check Use Default DB User Or Custom DB User - WPDBRANDOMPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) - grep customdbuser /etc/easyengine/ee.conf | grep -i true &>> /dev/null - - if [ $? -eq 0 ] - then - read -p "Enter The MySQL Database Username [$ee_replace_dot]: " EE_DB_USER - - if [[ $EE_DB_USER = "" ]] - then - EE_DB_USER=$ee_replace_dot - fi - - # Fix MySQL USER ERROR 1470 (HY000) - FIXEE_MYSQL_USER16 - - # Turn Off Echo For Passwords - stty -echo - read -p "Enter The MySQL Database Password [$WPDBRANDOMPASS]: " EE_DB_PASS - stty echo - echo - fi - - if [[ $EE_DB_USER = "" ]] - then - EE_DB_USER=$ee_replace_dot - # Fix MySQL USER ERROR 1470 (HY000) - FIXEE_MYSQL_USER16 - fi - - if [[ $EE_DB_PASS = "" ]] - then - EE_DB_PASS=$WPDBRANDOMPASS - fi - - # Create Separate User & Grant Permission - echo -e "EE_DB_NAME = $EE_DB_NAME \nEE_DB_USER = $EE_DB_USER \nEE_DB_PASS = $EE_DB_PASS" &>> $EE_COMMAND_LOG - mysql -h $EE_MYSQL_HOST -u $EE_MYSQL_USER -p$EE_MYSQL_PASS -e "create user '$EE_DB_USER'@'$EE_MYSQL_HOST' identified by '$EE_DB_PASS'" - mysql -h $EE_MYSQL_HOST -u $EE_MYSQL_USER -p$EE_MYSQL_PASS -e "grant all privileges on \`$EE_DB_NAME\`.* to '$EE_DB_USER'@'$EE_MYSQL_HOST'" - mysql -h $EE_MYSQL_HOST -u $EE_MYSQL_USER -p$EE_MYSQL_PASS -e "flush privileges" -} - -PHPUSERINFO() -{ - # PHP User - PHPUSER=$(grep ^user /etc/php5/fpm/pool.d/www.conf | cut -d'=' -f2 | cut -d' ' -f2) \ - || ee_lib_error "Unable To Find Out PHP Username" -} - - -ee_mod_site_info() -{ - # Display The Specific Site Configuration - SITESTATUS=$(ls /etc/nginx/sites-enabled/$EE_DOMAIN &> /dev/null && echo Enable || echo Disable) - SITEINFO=$(head -n1 /etc/nginx/sites-available/$EE_DOMAIN | grep "NGINX CONFIGURATION" | rev | cut -d' ' -f3,4,5,6,7 | rev | cut -d ' ' -f2,3,4,5) - ACCESSLOG=$(grep access_log /etc/nginx/sites-available/$EE_DOMAIN | grep "/var/log/nginx/" | awk '{print($2)}' | cut -d ';' -f1) - EE_ERROR_LOG=$(grep error_log /etc/nginx/sites-available/$EE_DOMAIN | grep "/var/log/nginx/" | awk '{print($2)}' | cut -d ';' -f1) - WEBROOT=$(grep root /etc/nginx/sites-available/$EE_DOMAIN | grep htdocs | awk '{print($2)}' | cut -d ';' -f1) - EE_DB_NAME=$(grep DB_NAME /var/www/$EE_DOMAIN/wp-config.php 2> /dev/null | cut -d"'" -f4) - - ee_lib_echo "$EE_DOMAIN Information:\n" - ee_lib_echo "Nginx Configuration:\t\t \033[37m$SITEINFO ($SITESTATUS)" - ee_lib_echo "Nginx access_log:\t\t \033[37m$ACCESSLOG" - ee_lib_echo "Nginx error_log:\t\t \033[37m$EE_ERROR_LOG" - ee_lib_echo "Nginx root:\t\t\t \033[37m$WEBROOT" - ee_lib_echo "$EE_DOMAIN Database:\t\t \033[37m$EE_DB_NAME" -} - -EESITEEDIT() -{ - # Open Website In Default Editor - sensible-editor /etc/nginx/sites-available/$EE_DOMAIN 2> /dev/null -} - - -# EE Domain Functions -ee_lib_check_domain() -{ - # Check SITENAME Is Empty Or Not - if [ -z "$EE_DOMAIN_CHECK" ] - then - # Ask Users To Enter Domain Name - read -p "Enter Domain Name: " EE_DOMAIN_CHECK - # Remove http:// https:// & www. - EE_DOMAIN=$(echo $EE_DOMAIN_CHECK | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'www.''" | sed "s'/''") - else - # Remove http:// https:// & www. - EE_DOMAIN=$(echo $EE_DOMAIN_CHECK | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'www.''" | sed "s'/''") - fi - - # Remove http:// https:// For WordPress Setup (www.example.com) - EE_WWW_DOMAIN=$(echo $EE_DOMAIN_CHECK | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'/''") -} - -ee_lib_symbolic_link() -{ - # Creating Symbolic Link - ee_lib_echo "Creating Symbolic Link For $EE_DOMAIN" - ln -s /etc/nginx/sites-available/$EE_DOMAIN /etc/nginx/sites-enabled/ \ - || ee_lib_error "Unable To Create Symbolic Link For $EE_DOMAIN" -} - -ee_mod_setup_domain() -{ - #Check The Nginx Configuration Exist For $EE_DOMAIN - ls /etc/nginx/sites-available/$EE_DOMAIN &> $EE_ERROR_LOG - - if [ $? -ne 0 ] - then - # Creating Website $EE_DOMAIN - ee_lib_echo "Creating $EE_DOMAIN, Please Wait..." - sed "s/example.com/$EE_DOMAIN/g" \ - /usr/share/easyengine/nginx/$EE_NGINX_CONF \ - > /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable To Create Nginx Configuration File For $EE_DOMAIN" - - # Creating Symbolic Link - ee_lib_symbolic_link - - # Creating Htdocs & Logs Directory - ee_lib_echo "Creating htdocs & logs Directory" - mkdir -p /var/www/$EE_DOMAIN/htdocs && mkdir -p /var/www/$EE_DOMAIN/logs \ - || ee_lib_error "Unable To Create htdocs & logs Directory" - - # Creating Symbolic Links For Logs - ee_lib_echo "Creating Symbolic Link For Logs" - ln -s /var/log/nginx/$EE_DOMAIN.access.log /var/www/$EE_DOMAIN/logs/access.log \ - && ln -s /var/log/nginx/$EE_DOMAIN.error.log /var/www/$EE_DOMAIN/logs/error.log \ - || ee_lib_error "Unable To Create Symbolic Link For $EE_DOMAIN Logs" - else - ee_lib_error "$EE_DOMAIN Already Exist" - fi -} - -# Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress() -{ - # Download Latest WordPress - ee_lib_echo "Downloading WordPress, Please Wait..." - wget --no-check-certificate -cqO /var/www/$EE_DOMAIN/htdocs/latest.tar.gz \ - http://wordpress.org/latest.tar.gz \ - || ee_lib_error "Unable To Download WordPress" - - # Extracting WordPress - tar --strip-components=1 -zxf /var/www/$EE_DOMAIN/htdocs/latest.tar.gz \ - -C /var/www/$EE_DOMAIN/htdocs/ \ - || ee_lib_error "Unable To Extract WordPress" - - # Removing WordPress Archive - rm /var/www/$EE_DOMAIN/htdocs/latest.tar.gz - - # Call MYSQLINFO Function For MySQL Values - MYSQLINFO - EEWPDBPREFIX - ee_mod_setup_database - - # Modify wp-config.php & Move Outside The Webroot - cp /var/www/$EE_DOMAIN/htdocs/wp-config-sample.php \ - /var/www/$EE_DOMAIN/wp-config.php - - sed -i "s/database_name_here/$EE_DB_NAME/" \ - /var/www/$EE_DOMAIN/wp-config.php - - sed -i "s/username_here/$EE_DB_USER/" \ - /var/www/$EE_DOMAIN/wp-config.php - - sed -i "s/password_here/$EE_DB_PASS/" \ - /var/www/$EE_DOMAIN/wp-config.php - - sed -i "s/localhost/$EE_MYSQL_HOST/" \ - /var/www/$EE_DOMAIN/wp-config.php - - sed -i "s/wp_/$EE_WP_PREFIX/" \ - /var/www/$EE_DOMAIN/wp-config.php - - printf '%s\n' "g/put your unique phrase here/d" \ - a "$(curl -sL https://api.wordpress.org/secret-key/1.1/salt/)" . w \ - | ed -s /var/www/$EE_DOMAIN/wp-config.php -} - -# Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress() -{ - # Get WordPress Site Title - #ee_lib_echo "WordPress Information Required..." - - # WordPress Default User: admin - EE_WP_USER=$(grep EE_WP_USER /etc/easyengine/ee.conf | awk '{print($3)}') - if [[ $EE_WP_USER = "" ]] - then - EE_WP_USER=admin - fi - - # WordPress Default Password: Random Password - EE_WP_PASS=$(grep wpadminpass /etc/easyengine/ee.conf | awk '{print($3)}') - if [[ $EE_WP_PASS = "" ]] - then - EE_WP_PASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) - fi - - # WordPress Default Email: `git config user.email` - EE_WP_EMAIL=$(grep wpadminemail /etc/easyengine/ee.conf | awk '{print($3)}') - if [[ $EE_WP_EMAIL = "" ]] - then - EE_WP_EMAIL=`git config user.email` - fi - - # Create WordPress Tables - ee_lib_echo "Setting Up WordPress, Please Wait..." - cd /var/www/$EE_DOMAIN/htdocs || ee_lib_error "Unable To Change Directory To Install WordPress" - wp core install --allow-root --url=$EE_WWW_DOMAIN --title="$EE_WWW_DOMAIN" \ - --admin_name=$EE_WP_USER --admin_password=$EE_WP_PASS --admin_email=$EE_WP_EMAIL &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable To Create WordPress Tables For $EE_DOMAIN" - - # Update WordPress Permalink Structure Day and Postname - ee_lib_echo "Updating WordPress Permalink, Please Wait..." - wp rewrite structure --allow-root /%year%/%monthnum%/%day%/%postname%/ &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable To Update WordPress Permalink For $EE_DOMAIN" -} - -ee_lib_permission() -{ - # Call PHPUSERINFO Function For PHP User Details - PHPUSERINFO - - # Change Ownership - ee_lib_echo "Changing Ownership" - chown -R $PHPUSER:$PHPUSER /var/www/$EE_DOMAIN/ || ee_lib_error "Unable To Change Ownership For $EE_DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD -} - - -# NGINX Configuration Function -SETUP_DOMAIN() -{ - # Check SITENAME Is Empty Or Not - ee_lib_check_domain - - # Creating Website $EE_DOMAIN - ee_mod_setup_domain - - # Setup WordPress Webroot & Database - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress -} - -# Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options"() -{ - # Change Webroot Permission - ee_lib_permission - - # Take Nginx Configuration In Git Version Control - EE_GIT_DIR=/etc/nginx - EE_GIT_MESSAGE="Create Website With $WPNETWORKSITE $EE_SITE_CACHE_OPTION Option: $EE_DOMAIN" - ee_lib_git_commit -} - -ee_mod_plugin_w3tc() -{ - # Installing W3 Total Cache - cd /var/www/$EE_DOMAIN/htdocs/ - ee_lib_echo "Installing W3 Total Cache Plugin, Please Wait..." - wp plugin --allow-root install w3-total-cache &>> $EE_COMMAND_LOG || ee_lib_error "Unable To Install W3 Total Cache Plugin" - - # Activate W3 Total Cache - wp plugin --allow-root activate w3-total-cache $EE_NETWORK_ACTIVATE &>> $EE_COMMAND_LOG || ee_lib_error "Unable To Activate W3 Total Cache Plugin" -} - -ee_mod_plugin_wpsc() -{ - # Installing WP Super Cache - cd /var/www/$EE_DOMAIN/htdocs/ - ee_lib_echo "Installing WP Super Cache Plugin, Please Wait..." - wp plugin --allow-root install wp-super-cache &>> $EE_COMMAND_LOG || ee_lib_error "Unable To Install WP Super Cache Plugin" - - # Activate WP Super Cache - wp plugin --allow-root activate wp-super-cache $EE_NETWORK_ACTIVATE &>> $EE_COMMAND_LOG || ee_lib_error "Unable To Activate WP Super Cache Plugin" -} - -ee_mod_plugin_nginx_helper() -{ - # Installing Nginx Helper - cd /var/www/$EE_DOMAIN/htdocs/ - ee_lib_echo "Installing Nginx Helper Plugin, Please Wait..." - wp plugin --allow-root install nginx-helper &>> $EE_COMMAND_LOG || ee_lib_error "Unable To Install Nginx Helper" - - # Activate Nginx Helper - wp plugin --allow-root activate nginx-helper $EE_NETWORK_ACTIVATE &>> $EE_COMMAND_LOG || ee_lib_error "Unable To Activate Nginx Helper Plugin" -} - - -# Setup Wordpress Network -SETUPWPNETWORK() -{ - # Prepare wp-config.php File Foe WordPress Multisite With SubDirectory - cd /var/www/$EE_DOMAIN/htdocs || ee_lib_error "Unable To Change Directory" - wp core install-network --allow-root --title="$EE_WWW_DOMAIN" $EE_WP_SUBDOMAIN &>> $EE_COMMAND_LOG || ee_lib_error "Unable To Setup WordPress SubDirectory Network" - - sed -i "/WP_DEBUG/a \define('WP_ALLOW_MULTISITE', true);" /var/www/$EE_DOMAIN/wp-config.php - sed -i "/WP_ALLOW_MULTISITE/a \define('WPMU_ACCEL_REDIRECT', true);" /var/www/$EE_DOMAIN/wp-config.php - - # Remove index.php from permalink - # Install Nginx Helper - ee_mod_plugin_nginx_helper -} - - -# Remove Database -ee_mod_delete_database() -{ - # HTML & PHP Website Doesn't Have Database - head -n1 /etc/nginx/sites-available/$EE_DOMAIN | egrep -e 'HTML|PHP' &>> $EE_COMMAND_LOG - if [ $? -ne 0 ] - then - # MySQL Information - MYSQLROOT - EE_DB_NAME=$(grep DB_NAME /var/www/$EE_DOMAIN/*-config.php | cut -d"'" -f4) - EE_DB_USER=$(grep DB_USER /var/www/$EE_DOMAIN/*-config.php | cut -d"'" -f4) - EE_DB_PASS=$(grep DB_PASS /var/www/$EE_DOMAIN/*-config.php | cut -d"'" -f4) - EE_MYSQL_HOST=$(grep DB_HOST /var/www/$EE_DOMAIN/*-config.php | cut -d"'" -f4) - echo -e " EE_DB_NAME = $EE_DB_NAME \n EE_DB_USER = $EE_DB_USER \n EE_MYSQL_HOST = $EE_MYSQL_HOST" - - # Remove Database - # For Proper read Command Output - stty echo - if [ "$1" = "--no-prompt" ] - then - # Assume yes - ee_prompt="y" - else - # Ask user for confirmation - read -p "Are You Sure To Drop $EE_DB_NAME Database (y/n): " ee_prompt - fi - - if [ "$ee_prompt" = "y" ] - then - # Remove Database - mysql -h $EE_MYSQL_HOST -u $EE_MYSQL_USER -p$EE_MYSQL_PASS -e "drop database \`$EE_DB_NAME\`" \ - || ee_lib_error "Unable To Drop $EE_DB_NAME Database" - - # Never Remove root User - if [ "$EE_DB_USER" != "root" ] - then - # Remove Database User - mysql -h $EE_MYSQL_HOST -u $EE_MYSQL_USER -p$EE_MYSQL_PASS -e "drop user '$EE_DB_USER'@'$EE_MYSQL_HOST'" \ - || ee_lib_error "Unable To Drop Database User $EE_DB_USER" - mysql -h $EE_MYSQL_HOST -u $EE_MYSQL_USER -p$EE_MYSQL_PASS -e "flush privileges" \ - || ee_lib_error "Unable To Flush MySQL Privileges" - fi - else - # User Denied Messages - ee_lib_echo_fail "User Denied To Drop $EE_DB_NAME Database." - fi - else - ee_lib_echo_fail "No Database Found For $EE_DOMAIN" - fi -} - -ee_mod_delete_webroot() -{ - # Remove Webroot - # For Proper read Command Output - stty echo - if [ "$1" = "--no-prompt" ] - then - # Assume yes - ee_prompt="y" - else - # Ask user for confirmation - read -p "Are You Sure To Remove $EE_DOMAIN Webroot (y/n): " ee_prompt - fi - - if [ "$ee_prompt" = "y" ] - then - # Remove Webroot - rm -rf /var/www/$EE_DOMAIN || ee_lib_error "Unable To Remove $EE_DOMAIN Webroot" - else - # User Denied Messages - ee_lib_echo_fail "User Denied To Remove $EE_DOMAIN Webroot." - fi -} - -ee_mod_delete_nginxconf() -{ - # Remove Nginx Configuration - # For Proper read Command Output - stty echo - if [ "$1" = "--no-prompt" ] - then - # Assume yes - ee_prompt="y" - else - # Ask user for confirmation - read -p "Are You Sure To Remove $EE_DOMAIN Nginx Configuration (y/n): " ee_prompt - fi - if [ "$ee_prompt" = "y" ] - then - # Remove Webroot - rm -rf /etc/nginx/sites-available/$EE_DOMAIN /etc/nginx/sites-enabled/$EE_DOMAIN \ - || ee_lib_error "Unable To Remove $EE_DOMAIN Nginx Configuration" - else - # User Denied Messages - ee_lib_echo_fail "User Denied To Remove $EE_DOMAIN Nginx Configuration." - fi -} ee_mod_debug_nginx_start() { @@ -938,777 +383,6 @@ then # Display Man Pages man ee -# Easy Engine Site Settings -elif [ "$1" = "site" ] -then - - # Easy Engine Site Enabled List - if [ "$2" = "list" ] - then - - if [ "$3" = "available" ] - then - - # Display The List Of Available Sites - ee_lib_echo "Display The List Of Available Websites:" - ls /etc/nginx/sites-available/ \ - || ee_lib_error "Unable To Display The List Of Available Websites" - - else - - # Display The List Of Enabled Websites - ee_lib_echo "Display The List Of Enabled Websites:" - ls /etc/nginx/sites-enabled/ \ - || ee_lib_error "Unable To Display The List Of Enabled Websites" - fi - - elif [ "$2" = "show" ] - then - - # Check SITENAME Is Empty Or Not - EE_DOMAIN_CHECK=$EE_THIRD - ee_lib_check_domain - - # Check The Website Is Exist - ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null \ - || ee_lib_error "The $EE_DOMAIN Is Not Found In Available Websites List" - - if [ $? -eq 0 ] - then - - # Display The Specific Site Configuration - ee_lib_echo "Display Nginx Configuration For $EE_DOMAIN" - cat /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable To Display Nginx Configuration For $EE_DOMAIN" - - fi - - elif [ "$2" = "info" ] - then - - # Check SITENAME Is Empty Or Not - EE_DOMAIN_CHECK=$EE_THIRD - ee_lib_check_domain - - # Display The Specific Site Configuration - ee_mod_site_info - - elif [ "$2" = "create" ] - then - - # Configure variables - EE_DOMAIN_CHECK=$EE_THIRD - EE_SITE_CREATE_OPTION=$4 - EE_SITE_CACHE_OPTION=$5 - - # Auto Switch The Options - if [ "$EE_SITE_CREATE_OPTION" = "--basic" ] || [ "$EE_SITE_CREATE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpfc" ] - then - if [ "$EE_SITE_CACHE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdirectory" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdom" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdomain" ] - then - EE_SITE_CREATE_OPTION=$5 - EE_SITE_CACHE_OPTION=$4 - else - EE_SITE_CREATE_OPTION=--wp - EE_SITE_CACHE_OPTION=$4 - fi - fi - - # WordPress SubDirectory Variables - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdirectory" ] - then - EE_NETWORK_ACTIVATE="--network" - fi - - # WordPress SubDomain Variables - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdom" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] - then - EE_NETWORK_ACTIVATE="--network" - EE_WP_SUBDOMAIN="--subdomains" - fi - - # USE DEFAULT WHEN POSSIBLES - # ee site create example.com - if [ "$EE_SITE_CREATE_OPTION" = "" ] - then - EE_SITE_CREATE_OPTION=--html - fi - - - # If No Cache Specified Use --basic As Default On WordPress Sites - if [ "$EE_SITE_CACHE_OPTION" = "" ] && [ "$EE_SITE_CREATE_OPTION" != "--html" ] && [ "$EE_SITE_CREATE_OPTION" != "--php" ] && [ "$EE_SITE_CREATE_OPTION" != "--mysql" ] - then - EE_SITE_CACHE_OPTION=--basic - fi - - - if [ "$EE_SITE_CREATE_OPTION" = "--html" ] - then - - # Configure variable - EE_NGINX_CONF=html/basic.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup HTML Nginx - ee_lib_check_domain - ee_mod_setup_domain - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Display Success Message - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CREATE_OPTION" = "--php" ] - then - - # Configure variable - EE_NGINX_CONF=php/basic.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup PHP Nginx - ee_lib_check_domain - ee_mod_setup_domain - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Display Success Message - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CREATE_OPTION" = "--mysql" ] - then - - # Configure variable - EE_NGINX_CONF=mysql/basic.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup PHP Nginx - ee_lib_check_domain - ee_mod_setup_domain - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Call MYSQLINFO Function For MySQL Values - MYSQLINFO - ee_mod_setup_database - - # Add Database Information On ee-config.php - echo -e "define('DB_NAME', '$EE_DB_NAME'); \ndefine('DB_USER', '$EE_DB_USER'); \ndefine('DB_PASSWORD', '$EE_DB_PASS'); \ndefine('DB_HOST', '$EE_MYSQL_HOST');" \ - &>> /var/www/$EE_DOMAIN/ee-config.php - - # Display Success Message - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CREATE_OPTION" = "--wp" ] - then - - if [ "$EE_SITE_CACHE_OPTION" = "--basic" ] - then - - # Configure variable - EE_NGINX_CONF=wp/basic.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Basic Nginx - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - ee_mod_plugin_nginx_helper - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Display Success Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] - then - - # Configure variable - EE_NGINX_CONF=wp/w3tc.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup W3 Total Cache Nginx - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - ee_mod_plugin_nginx_helper - ee_mod_plugin_w3tc - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Display WordPress Plugin Configuration Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - ee_lib_echo "Please Configure The Following Settings..." - #ee_lib_echo "Permalink Settings: http://$EE_DOMAIN/wp-admin/options-permalink.php" - ee_lib_echo "W3 Total Cache: http://$EE_DOMAIN/wp-admin/admin.php?page=w3tc_general" - - # Display Success Message - echo - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ] - then - - # Configure variable - EE_NGINX_CONF=wp/wpsc.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup WP Super Cache Nginx - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - ee_mod_plugin_nginx_helper - ee_mod_plugin_wpsc - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Display WordPress Plugin Configuration Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - ee_lib_echo "Please Configure The Following Settings..." - #ee_lib_echo "Permalink Settings: http://$EE_DOMAIN/wp-admin/options-permalink.php" - ee_lib_echo "WP Super Cache: http://$EE_DOMAIN/wp-admin/options-general.php?page=wpsupercache" - - # Display Success Message - echo - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ] - then - - # Configure variable - EE_NGINX_CONF=wp/wpfc.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Fastcgi Cache Nginx - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - ee_mod_plugin_nginx_helper - ee_mod_plugin_w3tc - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Display WordPress Plugin Configuration Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - ee_lib_echo "Please Configure The Following Settings..." - #ee_lib_echo "Permalink Settings: http://$EE_DOMAIN/wp-admin/options-permalink.php" - ee_lib_echo "Nginx Helper: http://$EE_DOMAIN/wp-admin/options-general.php?page=nginx" - ee_lib_echo "W3 Total Cache: http://$EE_DOMAIN/wp-admin/admin.php?page=w3tc_general" - - # Display Success Message - echo - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - fi - - elif [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdirectory" ] - then - - if [ "$EE_SITE_CACHE_OPTION" = "--basic" ] - then - - # Configure variable - EE_NGINX_CONF=wpsubdir/basic.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Domain WordPress & Database - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - - # Setup WordPress SubDirectory Network - SETUPWPNETWORK - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Setup phpMyAdmin - #ln -s /var/www/22222/htdocs/db/pma /var/www/$EE_DOMAIN/htdocs/pma - - # Display Success Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] - then - - # Configure variable - EE_NGINX_CONF=wpsubdir/w3tc.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Domain WordPress & Database - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - - # Setup WordPress SubDirectory Network - SETUPWPNETWORK - ee_mod_plugin_w3tc - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Setup phpMyAdmin - #ln -s /var/www/22222/htdocs/db/pma /var/www/$EE_DOMAIN/htdocs/pma - - # Display WordPress Plugin Configuration Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - ee_lib_echo "Please Configure The Following Settings..." - #ee_lib_echo "Permalink Settings: http://$EE_DOMAIN/wp-admin/options-permalink.php" - ee_lib_echo "W3 Total Cache: http://$EE_DOMAIN/wp-admin/network/admin.php?page=w3tc_general" - - # Display Success Message - echo - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ] - then - - # Configure variable - EE_NGINX_CONF=wpsubdir/wpsc.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Domain WordPress & Database - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - - # Setup WordPress SubDirectory Network - SETUPWPNETWORK - ee_mod_plugin_wpsc - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Setup phpMyAdmin - #ln -s /var/www/22222/htdocs/db/pma /var/www/$EE_DOMAIN/htdocs/pma - - # Display WordPress Plugin Configuration Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - ee_lib_echo "Please Configure The Following Settings..." - #ee_lib_echo "Permalink Settings: http://$EE_DOMAIN/wp-admin/options-permalink.php" - ee_lib_echo "WP Super Cache: http://$EE_DOMAIN/wp-admin/network/settings.php?page=wpsupercache" - - # Display Success Message - echo - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ] - then - - # Configure variable - EE_NGINX_CONF=wpsubdir/wpfc.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Domain WordPress & Database - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - - # Setup WordPress SubDirectory Network - SETUPWPNETWORK - ee_mod_plugin_w3tc - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Setup phpMyAdmin - #ln -s /var/www/22222/htdocs/db/pma /var/www/$EE_DOMAIN/htdocs/pma - - # Display WordPress Plugin Configuration Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - ee_lib_echo "Please Configure The Following Settings..." - #ee_lib_echo "Permalink Settings: http://$EE_DOMAIN/wp-admin/options-permalink.php" - ee_lib_echo "Nginx Helper: http://$EE_DOMAIN/wp-admin/network/settings.php?page=nginx" - ee_lib_echo "W3 Total Cache: http://$EE_DOMAIN/wp-admin/network/admin.php?page=w3tc_general" - - # Display Success Message - echo - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - fi - - elif [ "$EE_SITE_CREATE_OPTION" = "--wpsubdom" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] - then - - if [ "$EE_SITE_CACHE_OPTION" = "--basic" ] - then - - # Configure variable - EE_NGINX_CONF=wpsubdomain/basic.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Domain WordPress & Database - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - - # Setup WordPress SubDirectory Network - SETUPWPNETWORK - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Setup phpMyAdmin - #ln -s /var/www/22222/htdocs/db/pma /var/www/$EE_DOMAIN/htdocs/pma - - # Display Success Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] - then - - # Configure variable - EE_NGINX_CONF=wpsubdomain/w3tc.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Domain WordPress & Database - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - - # Setup WordPress SubDirectory Network - SETUPWPNETWORK - ee_mod_plugin_w3tc - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Setup phpMyAdmin - #ln -s /var/www/22222/htdocs/db/pma /var/www/$EE_DOMAIN/htdocs/pma - - # Display WordPress Plugin Configuration Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - ee_lib_echo "Please Configure The Following Settings..." - #ee_lib_echo "Permalink Settings: http://$EE_DOMAIN/wp-admin/options-permalink.php" - ee_lib_echo "W3 Total Cache: http://$EE_DOMAIN/wp-admin/network/admin.php?page=w3tc_general" - - # Display Success Message - echo - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ] - then - - # Configure variable - EE_NGINX_CONF=wpsubdomain/wpsc.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Domain WordPress & Database - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - - # Setup WordPress SubDirectory Network - SETUPWPNETWORK - ee_mod_plugin_wpsc - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Setup phpMyAdmin - #ln -s /var/www/22222/htdocs/db/pma /var/www/$EE_DOMAIN/htdocs/pma - - # Display WordPress Plugin Configuration Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - ee_lib_echo "Please Configure The Following Settings..." - #ee_lib_echo "Permalink Settings: http://$EE_DOMAIN/wp-admin/options-permalink.php" - ee_lib_echo "WP Super Cache: http://$EE_DOMAIN/wp-admin/network/settings.php?page=wpsupercache" - - # Display Success Message - echo - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ] - then - - # Configure variable - EE_NGINX_CONF=wpsubdomain/wpfc.conf - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG - - # Setup Domain WordPress & Database - ee_lib_check_domain - ee_mod_setup_domain - # Setup MySQL database - ee_mod_setup_database - - # Setup WordPress - ee_mod_setup_wordpress - - # Setup WordPress SubDirectory Network - SETUPWPNETWORK - ee_mod_plugin_w3tc - # Adjust permission - ee_lib_permissions - - # Git commit - ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - - # Setup phpMyAdmin - #ln -s /var/www/22222/htdocs/db/pma /var/www/$EE_DOMAIN/htdocs/pma - - # Display WordPress Plugin Configuration Message - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - ee_lib_echo "Please Configure The Following Settings..." - #ee_lib_echo "Permalink Settings: http://$EE_DOMAIN/wp-admin/options-permalink.php" - ee_lib_echo "Nginx Helper: http://$EE_DOMAIN/wp-admin/network/settings.php?page=nginx" - ee_lib_echo "W3 Total Cache: http://$EE_DOMAIN/wp-admin/network/admin.php?page=w3tc_general" - - # Display Success Message - echo - ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" - - fi - fi - - elif [ "$2" = "enable" ] - then - - # Check SITENAME Is Empty Or Not - EE_DOMAIN_CHECK=$EE_THIRD - ee_lib_check_domain - - # Creating Symbolic Link - ee_lib_symbolic_link - - # Reload Nginx Configuration - NGINXRELOAD - - # Take Nginx Configuration In Git Version Control - EE_GIT_DIR=/etc/nginx - EE_GIT_MESSAGE="Enable Website: $EE_DOMAIN" - ee_lib_git_commit - - elif [ "$2" = "disable" ] - then - - # Check SITENAME Is Empty Or Not - EE_DOMAIN_CHECK=$EE_THIRD - ee_lib_check_domain - - # Remove Symbolic Link - ee_lib_echo "Removing Symbolic Link For $EE_DOMAIN" - rm /etc/nginx/sites-enabled/$EE_DOMAIN \ - || ee_lib_error "Unable To Remove Symbolic Link For $EE_DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD - - # Take Nginx Configuration In Git Version Control - EE_GIT_DIR=/etc/nginx - EE_GIT_MESSAGE="Disable Website: $EE_DOMAIN" - ee_lib_git_commit - - elif [ "$2" = "delete" ] - then - - # Check SITENAME Is Empty Or Not - EE_DOMAIN_CHECK=$EE_THIRD - EE_DELETE_ARGS=$4 - ee_lib_check_domain - - # USE DEFAULT WHEN POSSIBLES - if [ "$EE_DELETE_ARGS" = "" ] - then - EE_DELETE_ARGS=--all - fi - - if [ "$EE_DELETE_ARGS" = "--db" ] - then - - # Remove Database - ee_mod_delete_database - - elif [ "$EE_DELETE_ARGS" = "--files" ] - then - - # Remove Webroot - ee_mod_delete_webroot - - elif [ "$EE_DELETE_ARGS" = "--all" ] - then - - # Remove All Database And Webroot - ee_mod_delete_database - ee_mod_delete_webroot - - # Remove Nginx Configuration - ee_mod_delete_nginxconf - - # Reload Nginx - NGINXRELOAD - - # Take Nginx Configuration In Git Version Control - EE_GIT_DIR=/etc/nginx - EE_GIT_MESSAGE="Delete Website With $EE_DELETE_ARGS Option: $EE_DOMAIN" - ee_lib_git_commit - - elif [ "$EE_DELETE_ARGS" = "--all---no-prompt" ] - then - - # Remove All Database And Webroot - ee_mod_delete_database "--no-prompt" - ee_mod_delete_webroot "--no-prompt" - - # Remove Nginx Configuration - ee_mod_delete_nginxconf "--no-prompt" - - # Reload Nginx - NGINXRELOAD - - # Take Nginx Configuration In Git Version Control - EE_GIT_DIR=/etc/nginx - EE_GIT_MESSAGE="Delete Website With $EE_DELETE_ARGS Option: $EE_DOMAIN" - ee_lib_git_commit - fi - - elif [ "$2" = "edit" ] - then - - # Check SITENAME Is Empty Or Not - EE_DOMAIN_CHECK=$EE_THIRD - ee_lib_check_domain - - # Edit The Nginx Configuration For $EE_DOMAIN - EESITEEDIT - - if [ $(cd /etc/nginx; git status -s /etc/nginx/sites-available/$EE_DOMAIN | wc -l) -ne 0 ] - then - # Take Nginx Configuration In Git Version Control - EE_GIT_DIR=/etc/nginx - EE_GIT_MESSAGE="Edited Website: $EE_DOMAIN" - ee_lib_git_commit - - # Reload Nginx Configuration - NGINXRELOAD - fi - - - else - ee_lib_echo "List Of Available Commands:" - echo -e "\tinfo:\t Dispaly Information About Given Website" - echo -e "\tlist:\t List Nginx Enabled Websites" - echo -e "\tshow:\t Display Nginx Configuration For Given Website" - echo -e "\tcreate:\t Create A New HTML PHP MySQL & WordPress Website" - echo -e "\tdelete:\t Delete Existing Website" - echo -e "\tenable:\t Enable Website" - echo -e "\tedit: Manually Edit Website" - - fi - elif [ "$1" = "debug" ] then