From cab5ae44027cef6c9584e0f3885bfe04ea5ab211 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 16 Oct 2014 16:05:53 +0530 Subject: [PATCH 01/80] fixed ee update --- bin/easyengine | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index 481b4678..d07995fb 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -886,8 +886,8 @@ elif [ "$EE_FIRST" = "import-slow-log" ];then # EasyEngine update elif [ "$EE_FIRST" = "update" ]; then - ee_lib_echo "Checking EasyEngine(ee) update, please wait..." - wget --no-check-certificate -qO eeup http://rt.cx/eeup && sudo bash eeup + ee_lib_echo "Run following command to update EasyEngine" + ee_lib_echo_info "wget --no-check-certificate -qO eeup http://rt.cx/eeup && sudo bash eeup" else ee_lib_echo "EasyEngine (ee) commands:" From 83d8e9d856c13931a9b65c57286ffbf8b73e8a22 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Fri, 17 Oct 2014 14:11:20 +0530 Subject: [PATCH 02/80] Update Back up directory structure --- src/modules/site/ee_mod_site_backup.sh | 36 +++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/modules/site/ee_mod_site_backup.sh b/src/modules/site/ee_mod_site_backup.sh index f4268a34..347a00a7 100644 --- a/src/modules/site/ee_mod_site_backup.sh +++ b/src/modules/site/ee_mod_site_backup.sh @@ -5,33 +5,39 @@ function ee_mod_site_backup() # Backup directory setup local ee_webroot=$(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/\/htdocs//') - if [ ! -d $ee_webroot/backup ] || [ ! -d $ee_webroot/backup/htdocs/$EE_DATE ] || [ ! -d $ee_webroot/backup/nginx/$EE_DATE ] || [ ! -d $ee_webroot/backup/db/$EE_DATE ]; then - mkdir -p $ee_webroot/backup/{htdocs/$EE_DATE,nginx/$EE_DATE,db/$EE_DATE} || ee_lib_error "Unable to create $ee_webroot/backup directory, exit status =" $? + if [ ! -d $ee_webroot/backup/$EE_DATE ]; then + mkdir -p $ee_webroot/backup/$EE_DATE || ee_lib_error "Fail to create backup directory, exit status =" $? fi + ee_lib_echo "Backup location: $ee_webroot/backup/$EE_DATE" + ee_lib_echo "Backup NGINX configuration, please wait..." + # Backup $EE_DOMAIN NGINX configuration + cp /etc/nginx/sites-available/$EE_DOMAIN $ee_webroot/backup/$EE_DATE/ \ + || ee_lib_error "Failed: Backup NGINX configuration, exit status =" $? + # Move htdocs - if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then - ee_lib_echo "Backup webroot at $ee_webroot/backup/htdocs/$EE_DATE/, please wait..." - mv $ee_webroot/htdocs $ee_webroot/backup/htdocs/$EE_DATE/ || ee_lib_error "Unable to move $ee_webroot/htdocs to backup, exit status =" $? - mkdir -p $ee_webroot/htdocs + if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]; then + ee_lib_echo "Backup webroot, please wait..." + mv $ee_webroot/htdocs $ee_webroot/backup/$EE_DATE/ \ + || ee_lib_error "Failed: Backup webroot, exit status =" $? + ee_lib_echo "Setting up webroot, please wait..." + mkdir -p $ee_webroot/htdocs || ee_lib_error "Failed: Setting up webroot, exit status =" $? fi - ee_lib_echo "Backup NGINX configuration at $ee_webroot/backup/nginx/$EE_DATE/, please wait..." - # Backup $EE_DOMAIN NGINX configuration - cp /etc/nginx/sites-available/$EE_DOMAIN $ee_webroot/backup/nginx/$EE_DATE/ &>> $EE_COMMAND_LOG - # Database backup if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/') ]; then local ee_db_name=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) - ee_lib_echo "Backup Database $ee_db_name at $ee_webroot/backup/db/$EE_DATE/, please wait..." - mysqldump $ee_db_name > $ee_webroot/backup/db/$EE_DATE/${ee_db_name}.sql \ - || ee_lib_error "Unable to dump ${ee_db_name}, exit status =" $? + ee_lib_echo "Backup Database, please wait..." + mysqldump $ee_db_name > $ee_webroot/backup/$EE_DATE/${ee_db_name}.sql \ + || ee_lib_error "Failed: Backup Database, exit status =" $? # Move ee-config.php and copy wp-config.php to backup if [ -f $ee_webroot/ee-config.php ]; then - mv $ee_webroot/ee-config.php $ee_webroot/backup/htdocs/$EE_DATE/ || ee_lib_error "Unable to move $ee_webroot/ee-config.php to backup, exit status =" $? + mv $ee_webroot/ee-config.php $ee_webroot/backup/$EE_DATE/ \ + || ee_lib_error "Failed: Backup ee-config.php, exit status =" $? else - cp $ee_webroot/wp-config.php $ee_webroot/backup/htdocs/$EE_DATE/ || ee_lib_error "Unable to move $ee_webroot/wp-config.php to backup, exit status =" $? + cp $ee_webroot/wp-config.php $ee_webroot/backup/$EE_DATE/ \ + || ee_lib_error "Failed: Backup wp-config.php, exit status =" $? fi fi } From 9a771ec48c5cc3e6075c378c9bb7db21804ebe5e Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 15:24:45 +0530 Subject: [PATCH 03/80] Removed extra check for wp-cli as now ee site create already install all the required packages --- bin/easyengine | 3 --- 1 file changed, 3 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index d07995fb..16a8d2cb 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -444,9 +444,6 @@ elif [ "$EE_FIRST" = "site" ]; then ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" elif [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - # Cross check WP-CLI installed or not - wp --allow-root --info &>> $EE_COMMAND_LOG \ - || ee_lib_error "WP-CLI not found, exit status = " $? # Configure variable EE_NGINX_CONF=$(echo $EE_SITE_CREATE_OPTION | cut -c3-)/$(echo $EE_SITE_CACHE_OPTION | cut -c3-).conf From 4b75d3ceaf8fbe6cd39387f1d05201fe2309efe1 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 18:08:50 +0530 Subject: [PATCH 04/80] Optimise ee site update code --- bin/easyengine | 227 ++++-------------- .../site/create/ee_mod_plugin_settings.sh | 35 +++ .../site/create/ee_mod_setup_wordpress.sh | 17 ++ .../site/update/ee_mod_update_domain.sh | 93 ------- .../site/update/ee_mod_update_nginx.sh | 129 ++++++++++ 5 files changed, 226 insertions(+), 275 deletions(-) create mode 100644 src/modules/site/create/ee_mod_plugin_settings.sh delete mode 100644 src/modules/site/update/ee_mod_update_domain.sh create mode 100644 src/modules/site/update/ee_mod_update_nginx.sh diff --git a/bin/easyengine b/bin/easyengine index 16a8d2cb..27e0aed6 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -456,22 +456,6 @@ elif [ "$EE_FIRST" = "site" ]; then # Setup WordPress ee_mod_setup_wordpress - # Setup WordPress Network - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - ee_mod_setup_network - fi - - # Install WordPress plugins - ee_mod_plugin_nginx_helper - - if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then - ee_mod_plugin_wpsc - fi - - if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - ee_mod_plugin_w3tc - fi - # Adjust permission ee_lib_permissions @@ -493,38 +477,8 @@ elif [ "$EE_FIRST" = "site" ]; then ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" echo - # Configure WordPress plugin settings - if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - ee_lib_echo_escape "Configure WPSC:\t\thttp://$EE_DOMAIN/wp-admin/network/settings.php?page=wpsupercache" - else - ee_lib_echo_escape "Configure WPSC:\t\thttp://$EE_DOMAIN/wp-admin/options-general.php?page=wpsupercache" - fi - fi - - if [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - ee_lib_echo_escape "Configure nginx-helper:\thttp://$EE_DOMAIN/wp-admin/network/settings.php?page=nginx" - else - ee_lib_echo_escape "Configure nginx-helper:\thttp://$EE_DOMAIN/wp-admin/options-general.php?page=nginx" - fi - fi - - if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - ee_lib_echo_escape "Configure W3TC:\t\thttp://$EE_DOMAIN/wp-admin/network/admin.php?page=w3tc_general" - else - ee_lib_echo_escape "Configure W3TC:\t\thttp://$EE_DOMAIN/wp-admin/admin.php?page=w3tc_general" - fi - if [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - ee_lib_echo_escape "Page Cache:\t\tDisable" - elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then - ee_lib_echo_escape "Page Cache:\t\tDisk Enhanced" - fi - ee_lib_echo_escape "Database Cache:\t\tMemcached" - ee_lib_echo_escape "Object Cache:\t\tMemcached" - ee_lib_echo_escape "Browser Cache:\t\tDisable" - fi + # Display WordPress cache plugin settings + ee_mod_plugin_settings # Display Success Message ee_lib_echo_info "Successfully created new website: http://$EE_WWW_DOMAIN" @@ -582,155 +536,64 @@ elif [ "$EE_FIRST" = "site" ]; then # Check the website name is empty or not ee_lib_check_domain - # Check the website exist + # Auto switch site options + ee_mod_site_option + + # Let's use variable name as per action + # EE_SITE_CREATE_OPTION=$EE_SITE_CREATE_OPTION + + # Check the website exist or not ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null \ - || ee_lib_error "The $EE_DOMAIN is not found in /etc/nginx/sites-available, exit status = " $? + || ee_lib_error "The $EE_DOMAIN does not exist, exit status = " $? - # Update WordPress user password - if [ "$EE_SITE_CREATE_OPTION" = "--password" ]; then - ee_mod_site_update_password - else - # Auto switch site options - ee_mod_site_option - - EE_SITE_CURRENT_OPTION=$(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) - if [ "$EE_SITE_CREATE_OPTION" = "--html" ] || [ "$EE_SITE_CREATE_OPTION" = "--php" ] || [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then - EE_NGINX_CONF=$(echo $EE_SITE_CREATE_OPTION | cut -c3-)/basic.conf - elif [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - if [ "$EE_SITE_CACHE_OPTION" = "--basic" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - EE_NGINX_CONF=$(echo $EE_SITE_CREATE_OPTION | cut -c3-)/$(echo $EE_SITE_CACHE_OPTION | cut -c3-).conf - fi - fi + # Find out information about current NGINX configuration + EE_SITE_CURRENT_OPTION=$(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) + + # Lets update HTML|PHP website + #if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then + if [[ "$EE_SITE_CURRENT_OPTION" = "HTML" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_OPTION" = "PHP" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then + # Let's take backup first + ee_mod_site_backup # Install required packages ee_mod_site_packages - # Lets update HTML|PHP|MySQL website - if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]; then - - - # Update NGINX configuration for $EE_DOMAIN - if [[ "$EE_SITE_CREATE_OPTION" = "--php" && "$EE_SITE_CURRENT_OPTION" != "PHP" ]] || [[ "$EE_SITE_CREATE_OPTION" = "--mysql" && "$EE_SITE_CURRENT_OPTION" != "MYSQL" ]] \ - || [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then - ee_mod_update_domain - else - ee_lib_error "$EE_DOMAIN already with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options, exit status" $? - fi - - # Setup WordPress - if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then - if [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]; then - # Sets EE_DB_NAME, EE_DB_USER, EE_DB_PASS variables, so that same database can be used while updating MYSQL site to any WordPress site - EE_DB_NAME=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/htdocs/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) - EE_DB_USER=$(grep DB_USER $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/htdocs/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) - EE_DB_PASS=$(grep DB_PASSWORD $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/htdocs/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) - fi - ee_mod_setup_wordpress - fi - - # Setup WordPress Network - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - ee_mod_setup_network - fi - - # Install WordPress plugins - if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then - ee_mod_plugin_nginx_helper - fi + # Let's start update + ee_mod_update_nginx - # Update cache plugins - ee_mod_update_plugins - - # Setup MySQL database - if [[ "$EE_SITE_CREATE_OPTION" = "--mysql" && "$EE_SITE_CURRENT_OPTION" != "MYSQL" ]]; then - 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 - fi + # Setup MySQL database + if [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then + ee_mod_setup_database - if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then - # Display WordPress credential - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - fi + # 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 + fi - # Lets update WordPress Single sites - # WordPress Single sites can only be updated to multisites or with different cache options - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ] \ - && [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]]; then - - if [[ "$EE_SITE_CACHE_OPTION" = "--basic" && "$EE_SITE_CURRENT_OPTION" != "WPSINGLE BASIC" ]] \ - || [[ "$EE_SITE_CACHE_OPTION" = "--wpfc" && "$EE_SITE_CURRENT_OPTION" != "WPSINGLE FAST CGI" ]] \ - || [[ "$EE_SITE_CACHE_OPTION" = "--w3tc" && "$EE_SITE_CURRENT_OPTION" != "WPSINGLE W3 TOTAL CACHE" ]] \ - || [[ "$EE_SITE_CACHE_OPTION" = "--wpsc" && "$EE_SITE_CURRENT_OPTION" != "WPSINGLE WP SUPER CACHE" ]] \ - || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then - # Update NGINX configuration for $EE_DOMAIN - ee_mod_update_domain - else - ee_lib_error "$EE_DOMAIN already with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options, exit status" $? - fi - # Setup WordPress Network - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - ee_mod_setup_network - fi - # Update cache plugins - ee_mod_update_plugins - - # Lets update WprdPress multi sites with subdirectory - # WordPress multi sites with subdirectory can only update cache - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR W3 TOTAL CACHE" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR WP SUPER CACHE" ] && [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then - if [[ "$EE_SITE_CACHE_OPTION" = "--basic" && "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR BASIC" ]] \ - || [[ "$EE_SITE_CACHE_OPTION" = "--wpfc" && "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR FAST CGI" ]] \ - || [[ "$EE_SITE_CACHE_OPTION" = "--w3tc" && "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR W3 TOTAL CACHE" ]] \ - || [[ "$EE_SITE_CACHE_OPTION" = "--wpsc" && "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR WP SUPER CACHE" ]]; then - # Update NGINX configuration for $EE_DOMAIN - ee_mod_update_domain - else - ee_lib_error "$EE_DOMAIN already with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options, exit status" $? - fi - # Update cache plugins - ee_mod_update_plugins - - # Lets update WordPress multi sites with subdomain - # WordPress multi sites with subdomain can only update cache - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN W3 TOTAL CACHE" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN WP SUPER CACHE" ] && [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - if [[ "$EE_SITE_CACHE_OPTION" = "--basic" && "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN BASIC" ]] \ - || [[ "$EE_SITE_CACHE_OPTION" = "--wpfc" && "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN FAST CGI" ]] \ - || [[ "$EE_SITE_CACHE_OPTION" = "--w3tc" && "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN W3 TOTAL CACHE" ]] \ - || [[ "$EE_SITE_CACHE_OPTION" = "--wpsc" && "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN WP SUPER CACHE" ]]; then - # Update NGINX configuration for $EE_DOMAIN - ee_mod_update_domain - else - ee_lib_error "$EE_DOMAIN already with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options, exit status" $? - fi - # Update cache plugins - ee_mod_update_plugins + # Setup WordPress + if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + # Setup WordPress + ee_mod_setup_wordpress - else - ee_lib_error "Invalid update option, exit status =" $? + # Display WordPress cache plugin settings + ee_mod_plugin_settings fi - # Adjust permission - ee_lib_permissions + fi - # Execute: service nginx reload - ee_lib_service nginx reload + # Adjust permission + ee_lib_permissions + + # Execute: service nginx reload + ee_lib_service nginx reload - # Git commit - ee_lib_git /etc/nginx/ "After ee site update: $EE_DOMAIN updated with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" + # Git commit + ee_lib_git /etc/nginx/ "After ee site update: $EE_DOMAIN updated with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" - # Display Success Message - ee_lib_echo_info "Successfully Updated Website: http://$EE_WWW_DOMAIN" - fi + # Display Success Message + ee_lib_echo_info "Successfully Updated Website: http://$EE_WWW_DOMAIN" elif [ "$EE_SECOND" = "log" ]; then - # Display logs for websites - ee_mod_site_log ${@:3} + # Display logs for websites + ee_mod_site_log ${@:3} # EasyEngine cd elif [ "$EE_SECOND" = "cd" ]; then diff --git a/src/modules/site/create/ee_mod_plugin_settings.sh b/src/modules/site/create/ee_mod_plugin_settings.sh new file mode 100644 index 00000000..e59347be --- /dev/null +++ b/src/modules/site/create/ee_mod_plugin_settings.sh @@ -0,0 +1,35 @@ +# Display WordPress cache plugin settings + +function ee_mod_plugin_settings() { + if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + ee_lib_echo_escape "Configure WPSC:\t\thttp://$EE_DOMAIN/wp-admin/network/settings.php?page=wpsupercache" + else + ee_lib_echo_escape "Configure WPSC:\t\thttp://$EE_DOMAIN/wp-admin/options-general.php?page=wpsupercache" + fi + fi + + if [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + ee_lib_echo_escape "Configure nginx-helper:\thttp://$EE_DOMAIN/wp-admin/network/settings.php?page=nginx" + else + ee_lib_echo_escape "Configure nginx-helper:\thttp://$EE_DOMAIN/wp-admin/options-general.php?page=nginx" + fi + fi + + if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + ee_lib_echo_escape "Configure W3TC:\t\thttp://$EE_DOMAIN/wp-admin/network/admin.php?page=w3tc_general" + else + ee_lib_echo_escape "Configure W3TC:\t\thttp://$EE_DOMAIN/wp-admin/admin.php?page=w3tc_general" + fi + if [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + ee_lib_echo_escape "Page Cache:\t\tDisable" + elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then + ee_lib_echo_escape "Page Cache:\t\tDisk Enhanced" + fi + ee_lib_echo_escape "Database Cache:\t\tMemcached" + ee_lib_echo_escape "Object Cache:\t\tMemcached" + ee_lib_echo_escape "Browser Cache:\t\tDisable" + fi +} diff --git a/src/modules/site/create/ee_mod_setup_wordpress.sh b/src/modules/site/create/ee_mod_setup_wordpress.sh index 8f282095..80547d7c 100644 --- a/src/modules/site/create/ee_mod_setup_wordpress.sh +++ b/src/modules/site/create/ee_mod_setup_wordpress.sh @@ -121,4 +121,21 @@ function ee_mod_setup_wordpress() 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, exit status = " $? + + # Setup WordPress Network + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + ee_mod_setup_network + fi + + # Install WordPress plugins + ee_mod_plugin_nginx_helper + + if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + ee_mod_plugin_wpsc + fi + + if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + ee_mod_plugin_w3tc + fi + } diff --git a/src/modules/site/update/ee_mod_update_domain.sh b/src/modules/site/update/ee_mod_update_domain.sh deleted file mode 100644 index 00d4224c..00000000 --- a/src/modules/site/update/ee_mod_update_domain.sh +++ /dev/null @@ -1,93 +0,0 @@ -# Update NGINX configuration for $EE_DOMAIN - -function ee_mod_update_domain() -{ - # Git commit - ee_lib_git /etc/nginx/ "Before ee site update: $EE_DOMAIN running on $EE_SITE_CURRENT_OPTION" - # Backup NGINX configuration & Database & Webroot - ee_mod_site_backup - - # Creating $EE_DOMAIN - ee_lib_echo "Updating $EE_DOMAIN, please wait..." - if [ -f /etc/nginx/sites-available/$EE_DOMAIN ]; then - EE_SITE_CURRENT_CONF=$(head -n1 /etc/nginx/sites-available/$EE_DOMAIN | grep "NGINX CONFIGURATION") - EE_SITE_UPDATE_CONF=$(head -n1 /usr/share/easyengine/nginx/$EE_NGINX_CONF | grep "NGINX CONFIGURATION") - EE_SITE_NGINX_CONF="/etc/nginx/sites-available/$EE_DOMAIN" - - # Update Head Line of NGINX conf - sed -i "s'$EE_SITE_CURRENT_CONF'$EE_SITE_UPDATE_CONF'" $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - - # Update Head Line of NGINX conf file - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] \ - && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN BASIC" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR BASIC" ] \ - && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN WP SUPER CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR WP SUPER CACHE" ] \ - && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN FAST CGI" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR FAST CGI" ] \ - && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN W3 TOTAL CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR W3 TOTAL CACHE" ];then - sed -i "s'server_name $EE_DOMAIN www.$EE_DOMAIN;'server_name $EE_DOMAIN *.$EE_DOMAIN;'" $EE_SITE_NGINX_CONF && \ - sed -i '/server_name.*;/i \\t# Uncomment the following line for domain mapping;\n\t# listen 80 default_server;\n' $EE_SITE_NGINX_CONF && \ - sed -i '/server_name.*;/a \\n\t# Uncomment the following line for domain mapping \n\t#server_name_in_redirect off;' $EE_SITE_NGINX_CONF && \ - sed -i '/include common\/locations.conf/i \\tinclude common\/wpsubdir.conf;' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - fi - # Update NGINX conf for HTML site - if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ]; then - sed -i 's/access\.log/access.log rt_cache/' $EE_SITE_NGINX_CONF && \ - sed -i '/index index.html index.htm;$/d' $EE_SITE_NGINX_CONF && \ - sed -i '/location \/ {/,/}/c \\tindex index.php index.htm index.html;' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - if [ "$EE_SITE_CACHE_OPTION" = "--basic" ] || [[ "$EE_SITE_CREATE_OPTION" = "--php" || "$EE_SITE_CREATE_OPTION" = "--mysql" ]]; then - sed -i '/include common\/locations.conf/i \\tinclude common\/php.conf;' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - sed -i '/include common\/locations.conf/i \\tinclude common\/wpfc.conf;' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then - sed -i '/include common\/locations.conf/i \\tinclude common\/wpsc.conf;' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then - sed -i '/include common\/locations.conf/i \\tinclude common\/w3tc.conf;' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - fi - # Update NGINX conf from BASIC CACHE to WPFC|W3TC|WPSC CACHE - elif [ "$EE_SITE_CURRENT_OPTION" = "PHP" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN BASIC" ]; then - if [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - sed -i 's/include common\/php.conf/include common\/wpfc.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then - sed -i 's/include common\/php.conf/include common\/wpsc.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then - sed -i 's/include common\/php.conf/include common\/w3tc.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - fi - # Update NGINX conf from W3TC CACHE to BASIC|WPSC|WPFC CACHE - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR W3 TOTAL CACHE" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN W3 TOTAL CACHE" ]; then - if [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - sed -i 's/include common\/w3tc.conf/include common\/wpfc.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then - sed -i 's/include common\/w3tc.conf/include common\/wpsc.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then - sed -i 's/include common\/w3tc.conf/include common\/php.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - fi - # Update NGINX conf from WPFC CACHE to BASIC|W3TC|WPSC CACHE - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN FAST CGI" ]; then - if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then - sed -i 's/include common\/wpfc.conf/include common\/php.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then - sed -i 's/include common\/wpfc.conf/include common\/wpsc.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then - sed -i 's/include common\/wpfc.conf/include common\/w3tc.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - fi - # Update NGINX conf from WPSC CACHE to BASIC|W3TC|WPFC CACHE - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN WP SUPER CACHE" ]; then - if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then - sed -i 's/include common\/wpsc.conf/include common\/php.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - sed -i 's/include common\/wpsc.conf/include common\/wpfc.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then - sed -i 's/include common\/wpfc.conf/include common\/w3tc.conf/' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - fi - fi - - # Update NGINX conf from HTML|PHP|MYSQL to wp|wpsubdir|wpsubdomain - if [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]] \ - && [[ "$EE_SITE_CURRENT_OPTION" = "HTML" || "$EE_SITE_CURRENT_OPTION" = "PHP" || "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]]; then - sed -i '/include common\/locations.conf/i \\tinclude common\/wpcommon.conf;' $EE_SITE_NGINX_CONF || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? - fi - else - ee_lib_error "Unable to find $EE_DOMAIN NGINX configuration, exit status =" $? - fi -} diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh new file mode 100644 index 00000000..d27bcbb2 --- /dev/null +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -0,0 +1,129 @@ +# Update NGINX configuration for $EE_DOMAIN + +function ee_mod_update_nginx() +{ + # Find out information about current NGINX configuration + EE_SITE_CURRENT_OPTION=$(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) + + # Git commit + ee_lib_git /etc/nginx/ "Before ee site update: $EE_DOMAIN running on $EE_SITE_CURRENT_OPTION" + + # Update NGINX configuration + ee_lib_echo "Updating $EE_DOMAIN, please wait..." + + if [ -f /etc/nginx/sites-available/$EE_DOMAIN ]; then + # Find out current NGINX configuration header + ee_nginx_current_header=$(head -n1 /etc/nginx/sites-available/$EE_DOMAIN | grep "NGINX CONFIGURATION") + + # Update NGINX configuration header + if [ "$EE_SITE_UPDATE_OPTION" = "--html" ] || [ "$EE_SITE_UPDATE_OPTION" = "--php" ] || [ "$EE_SITE_UPDATE_OPTION" = "--mysql" ]; then + ee_nginx_conf=$(echo $EE_SITE_UPDATE_OPTION | cut -c3-)/basic.conf + elif [ "$EE_SITE_CACHE_OPTION" = "--basic" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + ee_nginx_conf=$(echo $EE_SITE_UPDATE_OPTION | cut -c3-)/$(echo $EE_SITE_CACHE_OPTION | cut -c3-).conf + fi + ee_nginx_update_header=$(head -n1 /usr/share/easyengine/nginx/$ee_nginx_conf | grep "NGINX CONFIGURATION") + + # Update Head Line of NGINX conf + sed -i "s'$ee_nginx_current_header'$ee_nginx_update_header'" /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_UPDATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? + + # Update NGINX conf for HTML site + if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ]; then + sed -i 's/access\.log/access.log rt_cache/' /etc/nginx/sites-available/$EE_DOMAIN && \ + sed -i '/index index.html index.htm;$/d' /etc/nginx/sites-available/$EE_DOMAIN && \ + sed -i '/location \/ {/,/}/c \\tindex index.php index.htm index.html;' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + + # Update HTML to PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) options + if [ "$EE_SITE_UPDATE_OPTION" = "--php" ] || [ "$EE_SITE_UPDATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CACHE_OPTION" = "--basic" ] || ; then + sed -i '/include common\/locations.conf/i \\tinclude common\/php.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + # Update HTML to --wpsc (--wp/--wpsubdir/--wpsubdomain) options + elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + sed -i '/include common\/locations.conf/i \\tinclude common\/wpsc.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + # Update HTML to --w3tc (--wp/--wpsubdir/--wpsubdomain) options + elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then + sed -i '/include common\/locations.conf/i \\tinclude common\/w3tc.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + # Update HTML to --wpfc (--wp/--wpsubdir/--wpsubdomain) options + elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + sed -i '/include common\/locations.conf/i \\tinclude common\/wpfc.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + fi + + # Update PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) to --wpsc --w3tc --wpfc options + elif [ "$EE_SITE_CURRENT_OPTION" = "PHP" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN BASIC" ]; then + if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + sed -i 's/include common\/php.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then + sed -i 's/include common\/php.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + sed -i 's/include common\/php.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + fi + + # Update --wpsc (--wp/--wpsubdir/--wpsubdomain) to --basic --w3tc --wpfc options + elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN WP SUPER CACHE" ]; then + if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then + sed -i 's/include common\/wpsc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then + sed -i 's/include common\/wpfc.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + sed -i 's/include common\/wpsc.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + + + # Update --w3tc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --wpfc options + elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN W3 TOTAL CACHE" ]; then + if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then + sed -i 's/include common\/w3tc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + sed -i 's/include common\/w3tc.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + sed -i 's/include common\/w3tc.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + fi + + # Update --wpfc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --w3tc options + elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN FAST CGI" ]; then + if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then + sed -i 's/include common\/wpfc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + sed -i 's/include common\/wpfc.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then + sed -i 's/include common\/wpfc.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + fi + fi + + # Add WordPress common file wpcommon.conf for HTML PHP & MYSQL sites + if [[ "$EE_SITE_CURRENT_OPTION" = "HTML" || "$EE_SITE_CURRENT_OPTION" = "PHP" || "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]] && \ + [[ "$EE_SITE_UPDATE_OPTION" = "--wp" || "$EE_SITE_UPDATE_OPTION" = "--wpsubdomain" || "$EE_SITE_UPDATE_OPTION" = "--wpsubdir" ]]; then + sed -i '/include common\/locations.conf/i \\tinclude common\/wpcommon.conf;' /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_UPDATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? + fi + + # Update server_name for HTML PHP MYSQL WP (single site) only + # Don't execute for WordPress Multisite + if [ "$EE_SITE_UPDATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_UPDATE_OPTION" = "--wpsubdomain" ] \ + && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR BASIC" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN BASIC" ] \ + && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR WP SUPER CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN WP SUPER CACHE" ] \ + && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR W3 TOTAL CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN W3 TOTAL CACHE" ] \ + && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR FAST CGI" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN FAST CGI" ]; then + + sed -i "s'server_name $EE_DOMAIN www.$EE_DOMAIN;'server_name $EE_DOMAIN *.$EE_DOMAIN;'" /etc/nginx/sites-available/$EE_DOMAIN && \ + sed -i '/server_name.*;/i \\t# Uncomment the following line for domain mapping;\n\t# listen 80 default_server;\n' /etc/nginx/sites-available/$EE_DOMAIN && \ + sed -i '/server_name.*;/a \\n\t# Uncomment the following line for domain mapping \n\t#server_name_in_redirect off;' /etc/nginx/sites-available/$EE_DOMAIN && \ + sed -i '/include common\/locations.conf/i \\tinclude common\/wpsubdir.conf;' /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_UPDATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? + fi + else + ee_lib_error "Unable to find $EE_DOMAIN NGINX configuration, exit status =" $? + fi +} From 7132a1289bbd256bda28862e21fafb2503bc188d Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 18:21:41 +0530 Subject: [PATCH 05/80] Fixed if statement --- src/modules/site/update/ee_mod_update_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index d27bcbb2..697e96dd 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -34,7 +34,7 @@ function ee_mod_update_nginx() || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? # Update HTML to PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) options - if [ "$EE_SITE_UPDATE_OPTION" = "--php" ] || [ "$EE_SITE_UPDATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CACHE_OPTION" = "--basic" ] || ; then + if [ "$EE_SITE_UPDATE_OPTION" = "--php" ] || [ "$EE_SITE_UPDATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then sed -i '/include common\/locations.conf/i \\tinclude common\/php.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? # Update HTML to --wpsc (--wp/--wpsubdir/--wpsubdomain) options From b2df3fa1b62240339c8e436717e69ad1fa1ea387 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 18:25:36 +0530 Subject: [PATCH 06/80] Minor fix --- src/modules/site/update/ee_mod_update_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index 697e96dd..ea96b827 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -75,7 +75,7 @@ function ee_mod_update_nginx() elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then sed -i 's/include common\/wpsc.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? - + fi # Update --w3tc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --wpfc options elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN W3 TOTAL CACHE" ]; then From 67477e5808c85fe2b19cb2ed0c1fc7df3a24f70a Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 19:03:25 +0530 Subject: [PATCH 07/80] Minor fix and echo values --- .travis.yml | 15 ---------- bin/easyengine | 30 +++++++++++++------ .../site/update/ee_mod_update_nginx.sh | 3 ++ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb41793c..e96328bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,21 +133,6 @@ script: - sudo bash ee site update 1.com --wp - sudo bash ee site update 2.com --wpsubdir -- sudo bash ee site update 3.com --wpsubdomain - - -- sudo bash ee site update site1.com --wp --wpfc -- sudo bash ee site update site1.com --wp --w3tc -- sudo bash ee site update site1.com --wp --wpsc - -- sudo bash ee site update site5.com --wpsubdir --wpfc -- sudo bash ee site update site5.com --wpsubdir --w3tc -- sudo bash ee site update site5.com --wpsubdir --wpsc - -- sudo bash ee site update site9.com --wpsubdom --wpfc -- sudo bash ee site update site9.com --wpsubdom --w3tc -- sudo bash ee site update site9.com --wpsubdom --wpsc - - sudo ee site delete site12.com --no-prompt - sudo ee site delete site12.net --no-prompt diff --git a/bin/easyengine b/bin/easyengine index 27e0aed6..2841cee0 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -549,6 +549,13 @@ elif [ "$EE_FIRST" = "site" ]; then # Find out information about current NGINX configuration EE_SITE_CURRENT_OPTION=$(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) + # Detect current website type and cache + if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ]; then + EE_SITE_TYPE="--html" + elif [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then + EE_SITE_TYPE="--php" + fi + # Lets update HTML|PHP website #if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then if [[ "$EE_SITE_CURRENT_OPTION" = "HTML" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_OPTION" = "PHP" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then @@ -579,18 +586,23 @@ elif [ "$EE_FIRST" = "site" ]; then ee_mod_plugin_settings fi fi + + if [ "$EE_SITE_TYPE" != "$EE_SITE_CREATE_OPTION" ]; then + # Adjust permission + ee_lib_permissions - # Adjust permission - ee_lib_permissions - - # Execute: service nginx reload - ee_lib_service nginx reload + # Execute: service nginx reload + ee_lib_service nginx reload - # Git commit - ee_lib_git /etc/nginx/ "After ee site update: $EE_DOMAIN updated with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" + # Git commit + ee_lib_git /etc/nginx/ "After ee site update: $EE_DOMAIN updated with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" + + # Display Success Message + ee_lib_echo_info "Successfully Updated Website: http://$EE_WWW_DOMAIN" + else + ee_lib_error "Invalid option, exit status = " $? + fi - # Display Success Message - ee_lib_echo_info "Successfully Updated Website: http://$EE_WWW_DOMAIN" elif [ "$EE_SECOND" = "log" ]; then # Display logs for websites ee_mod_site_log ${@:3} diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index ea96b827..7eda98ff 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -23,6 +23,9 @@ function ee_mod_update_nginx() fi ee_nginx_update_header=$(head -n1 /usr/share/easyengine/nginx/$ee_nginx_conf | grep "NGINX CONFIGURATION") + # Echo values + echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_UPDATE_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 + # Update Head Line of NGINX conf sed -i "s'$ee_nginx_current_header'$ee_nginx_update_header'" /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_UPDATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? From 8965aaa58bcee6a515ba75e002d532a724472d8b Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 19:11:23 +0530 Subject: [PATCH 08/80] Fix variable name --- .../site/update/ee_mod_update_nginx.sh | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index 7eda98ff..3ecd9af5 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -16,106 +16,106 @@ function ee_mod_update_nginx() ee_nginx_current_header=$(head -n1 /etc/nginx/sites-available/$EE_DOMAIN | grep "NGINX CONFIGURATION") # Update NGINX configuration header - if [ "$EE_SITE_UPDATE_OPTION" = "--html" ] || [ "$EE_SITE_UPDATE_OPTION" = "--php" ] || [ "$EE_SITE_UPDATE_OPTION" = "--mysql" ]; then - ee_nginx_conf=$(echo $EE_SITE_UPDATE_OPTION | cut -c3-)/basic.conf + if [ "$EE_SITE_CREATE_OPTION" = "--html" ] || [ "$EE_SITE_CREATE_OPTION" = "--php" ] || [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then + ee_nginx_conf=$(echo $EE_SITE_CREATE_OPTION | cut -c3-)/basic.conf elif [ "$EE_SITE_CACHE_OPTION" = "--basic" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - ee_nginx_conf=$(echo $EE_SITE_UPDATE_OPTION | cut -c3-)/$(echo $EE_SITE_CACHE_OPTION | cut -c3-).conf + ee_nginx_conf=$(echo $EE_SITE_CREATE_OPTION | cut -c3-)/$(echo $EE_SITE_CACHE_OPTION | cut -c3-).conf fi ee_nginx_update_header=$(head -n1 /usr/share/easyengine/nginx/$ee_nginx_conf | grep "NGINX CONFIGURATION") # Echo values - echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_UPDATE_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 + 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 # Update Head Line of NGINX conf - sed -i "s'$ee_nginx_current_header'$ee_nginx_update_header'" /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_UPDATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? + sed -i "s'$ee_nginx_current_header'$ee_nginx_update_header'" /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? # Update NGINX conf for HTML site if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ]; then sed -i 's/access\.log/access.log rt_cache/' /etc/nginx/sites-available/$EE_DOMAIN && \ sed -i '/index index.html index.htm;$/d' /etc/nginx/sites-available/$EE_DOMAIN && \ sed -i '/location \/ {/,/}/c \\tindex index.php index.htm index.html;' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? # Update HTML to PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) options - if [ "$EE_SITE_UPDATE_OPTION" = "--php" ] || [ "$EE_SITE_UPDATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then + if [ "$EE_SITE_CREATE_OPTION" = "--php" ] || [ "$EE_SITE_CREATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then sed -i '/include common\/locations.conf/i \\tinclude common\/php.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? # Update HTML to --wpsc (--wp/--wpsubdir/--wpsubdomain) options elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then sed -i '/include common\/locations.conf/i \\tinclude common\/wpsc.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? # Update HTML to --w3tc (--wp/--wpsubdir/--wpsubdomain) options elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then sed -i '/include common\/locations.conf/i \\tinclude common\/w3tc.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? # Update HTML to --wpfc (--wp/--wpsubdir/--wpsubdomain) options elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then sed -i '/include common\/locations.conf/i \\tinclude common\/wpfc.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? fi # Update PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) to --wpsc --w3tc --wpfc options elif [ "$EE_SITE_CURRENT_OPTION" = "PHP" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN BASIC" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then sed -i 's/include common\/php.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then sed -i 's/include common\/php.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then sed -i 's/include common\/php.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? fi # Update --wpsc (--wp/--wpsubdir/--wpsubdomain) to --basic --w3tc --wpfc options elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN WP SUPER CACHE" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then sed -i 's/include common\/wpsc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then sed -i 's/include common\/wpfc.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then sed -i 's/include common\/wpsc.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? fi # Update --w3tc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --wpfc options elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN W3 TOTAL CACHE" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then sed -i 's/include common\/w3tc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then sed -i 's/include common\/w3tc.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then sed -i 's/include common\/w3tc.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? fi # Update --wpfc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --w3tc options elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN FAST CGI" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then sed -i 's/include common\/wpfc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then sed -i 's/include common\/wpfc.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then sed -i 's/include common\/wpfc.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ - || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_UPDATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? + || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? fi fi # Add WordPress common file wpcommon.conf for HTML PHP & MYSQL sites if [[ "$EE_SITE_CURRENT_OPTION" = "HTML" || "$EE_SITE_CURRENT_OPTION" = "PHP" || "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]] && \ - [[ "$EE_SITE_UPDATE_OPTION" = "--wp" || "$EE_SITE_UPDATE_OPTION" = "--wpsubdomain" || "$EE_SITE_UPDATE_OPTION" = "--wpsubdir" ]]; then - sed -i '/include common\/locations.conf/i \\tinclude common\/wpcommon.conf;' /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_UPDATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? + [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]]; then + sed -i '/include common\/locations.conf/i \\tinclude common\/wpcommon.conf;' /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? fi # Update server_name for HTML PHP MYSQL WP (single site) only # Don't execute for WordPress Multisite - if [ "$EE_SITE_UPDATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_UPDATE_OPTION" = "--wpsubdomain" ] \ + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] \ && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR BASIC" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN BASIC" ] \ && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR WP SUPER CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN WP SUPER CACHE" ] \ && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR W3 TOTAL CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN W3 TOTAL CACHE" ] \ @@ -124,7 +124,7 @@ function ee_mod_update_nginx() sed -i "s'server_name $EE_DOMAIN www.$EE_DOMAIN;'server_name $EE_DOMAIN *.$EE_DOMAIN;'" /etc/nginx/sites-available/$EE_DOMAIN && \ sed -i '/server_name.*;/i \\t# Uncomment the following line for domain mapping;\n\t# listen 80 default_server;\n' /etc/nginx/sites-available/$EE_DOMAIN && \ sed -i '/server_name.*;/a \\n\t# Uncomment the following line for domain mapping \n\t#server_name_in_redirect off;' /etc/nginx/sites-available/$EE_DOMAIN && \ - sed -i '/include common\/locations.conf/i \\tinclude common\/wpsubdir.conf;' /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_UPDATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? + sed -i '/include common\/locations.conf/i \\tinclude common\/wpsubdir.conf;' /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? fi else ee_lib_error "Unable to find $EE_DOMAIN NGINX configuration, exit status =" $? From 3424f6bdecc331773a1ca3d5aaea28dc21cc7243 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 19:17:36 +0530 Subject: [PATCH 09/80] Update echo message --- src/modules/site/update/ee_mod_update_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index 3ecd9af5..970319d3 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -24,7 +24,7 @@ function ee_mod_update_nginx() ee_nginx_update_header=$(head -n1 /usr/share/easyengine/nginx/$ee_nginx_conf | grep "NGINX CONFIGURATION") # Echo values - 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 + 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_update_header = $ee_nginx_update_header" &>> $EE_COMMAND_LOG # Update Head Line of NGINX conf sed -i "s'$ee_nginx_current_header'$ee_nginx_update_header'" /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? From db361a9c527cfe01d04d697458e0a5edab7426f0 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 19:41:50 +0530 Subject: [PATCH 10/80] Minor update --- src/modules/site/update/ee_mod_update_nginx.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index 970319d3..ce1f6132 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -32,8 +32,8 @@ function ee_mod_update_nginx() # Update NGINX conf for HTML site if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ]; then sed -i 's/access\.log/access.log rt_cache/' /etc/nginx/sites-available/$EE_DOMAIN && \ - sed -i '/index index.html index.htm;$/d' /etc/nginx/sites-available/$EE_DOMAIN && \ - sed -i '/location \/ {/,/}/c \\tindex index.php index.htm index.html;' /etc/nginx/sites-available/$EE_DOMAIN \ + sed -i '/index index.html index.htm;$/c \\tindex index.php index.htm index.html;' $EE_SITE_NGINX_CONF && \ + sed -i '/location \/ {/,/}/d ' $EE_SITE_NGINX_CONF \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? # Update HTML to PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) options From 708c30ca1e60a046a5c7a34179e294967d9396fc Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 19:49:04 +0530 Subject: [PATCH 11/80] Minor update --- src/modules/site/update/ee_mod_update_nginx.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index ce1f6132..4aaba0f9 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -32,8 +32,8 @@ function ee_mod_update_nginx() # Update NGINX conf for HTML site if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ]; then sed -i 's/access\.log/access.log rt_cache/' /etc/nginx/sites-available/$EE_DOMAIN && \ - sed -i '/index index.html index.htm;$/c \\tindex index.php index.htm index.html;' $EE_SITE_NGINX_CONF && \ - sed -i '/location \/ {/,/}/d ' $EE_SITE_NGINX_CONF \ + sed -i '/index index.html index.htm;$/c \\tindex index.php index.htm index.html;' $/etc/nginx/sites-available/$EE_DOMAIN && \ + sed -i '/location \/ {/,/}/d ' $/etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? # Update HTML to PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) options From 4e9c0435276bc7131ce7a7e3dc4358f0f7fd5156 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 19:51:10 +0530 Subject: [PATCH 12/80] Minor update --- src/modules/site/update/ee_mod_update_nginx.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index 4aaba0f9..1a6c5fc4 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -32,8 +32,8 @@ function ee_mod_update_nginx() # Update NGINX conf for HTML site if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ]; then sed -i 's/access\.log/access.log rt_cache/' /etc/nginx/sites-available/$EE_DOMAIN && \ - sed -i '/index index.html index.htm;$/c \\tindex index.php index.htm index.html;' $/etc/nginx/sites-available/$EE_DOMAIN && \ - sed -i '/location \/ {/,/}/d ' $/etc/nginx/sites-available/$EE_DOMAIN \ + sed -i '/index index.html index.htm;$/c \\tindex index.php index.htm index.html;' /etc/nginx/sites-available/$EE_DOMAIN && \ + sed -i '/location \/ {/,/}/d ' /etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? # Update HTML to PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) options From a7804b327a021d4042716aa9b1f1e7211429594b Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 20:03:41 +0530 Subject: [PATCH 13/80] Display WordPress Credentials After update HTML PHP webistes --- bin/easyengine | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/easyengine b/bin/easyengine index 2841cee0..b39acecc 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -582,6 +582,12 @@ elif [ "$EE_FIRST" = "site" ]; then # Setup WordPress ee_mod_setup_wordpress + # Display WordPress credential + echo + ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" + ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" + echo + # Display WordPress cache plugin settings ee_mod_plugin_settings fi From 9c21880d9be065228f8ed044ad76d1f60c8c4f12 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 20:23:56 +0530 Subject: [PATCH 14/80] ee site update mysql optimised --- bin/easyengine | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/bin/easyengine b/bin/easyengine index b39acecc..43c208e3 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -587,7 +587,33 @@ elif [ "$EE_FIRST" = "site" ]; then ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" echo - + + # Display WordPress cache plugin settings + ee_mod_plugin_settings + elif [[ "$EE_SITE_CURRENT_OPTION" = "MYSQL" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then + # Let's take backup first + ee_mod_site_backup + + # Install required packages + ee_mod_site_packages + + # Let's start update + ee_mod_update_nginx + + # Use same database for WordPress + EE_DB_NAME=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) + EE_DB_USER=$(grep DB_USER $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) + EE_DB_PASS=$(grep DB_PASSWORD $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) + + # Setup WordPress + ee_mod_setup_wordpress + + # Display WordPress credential + echo + ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" + ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" + echo + # Display WordPress cache plugin settings ee_mod_plugin_settings fi From b5dd47e083b88c272bda080943115d0ead21a010 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 20:29:47 +0530 Subject: [PATCH 15/80] ee site update mysql optimised --- bin/easyengine | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/easyengine b/bin/easyengine index 43c208e3..f491d67c 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -554,6 +554,8 @@ elif [ "$EE_FIRST" = "site" ]; then EE_SITE_TYPE="--html" elif [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then EE_SITE_TYPE="--php" + elif [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]; then + EE_SITE_TYPE="--mysql" fi # Lets update HTML|PHP website From c2d44cc01afd30b7328aaa17b7b0b7b48ac66868 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 20:36:06 +0530 Subject: [PATCH 16/80] ee site update mysql optimised --- bin/easyengine | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index f491d67c..21cf0fd6 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -592,35 +592,37 @@ elif [ "$EE_FIRST" = "site" ]; then # Display WordPress cache plugin settings ee_mod_plugin_settings - elif [[ "$EE_SITE_CURRENT_OPTION" = "MYSQL" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then - # Let's take backup first - ee_mod_site_backup + fi + #if [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] + elif [[ "$EE_SITE_CURRENT_OPTION" = "MYSQL" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then + # Let's take backup first + ee_mod_site_backup - # Install required packages - ee_mod_site_packages + # Install required packages + ee_mod_site_packages - # Let's start update - ee_mod_update_nginx + # Let's start update + ee_mod_update_nginx - # Use same database for WordPress - EE_DB_NAME=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) - EE_DB_USER=$(grep DB_USER $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) - EE_DB_PASS=$(grep DB_PASSWORD $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) + # Use same database for WordPress + EE_DB_NAME=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) + EE_DB_USER=$(grep DB_USER $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) + EE_DB_PASS=$(grep DB_PASSWORD $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) - # Setup WordPress - ee_mod_setup_wordpress + # Setup WordPress + ee_mod_setup_wordpress - # Display WordPress credential - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo + # Display WordPress credential + echo + ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" + ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" + echo - # Display WordPress cache plugin settings - ee_mod_plugin_settings - fi + # Display WordPress cache plugin settings + ee_mod_plugin_settings fi + if [ "$EE_SITE_TYPE" != "$EE_SITE_CREATE_OPTION" ]; then # Adjust permission ee_lib_permissions From 600377617919576b88f32a17c0f07f229db31c4c Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 20:36:15 +0530 Subject: [PATCH 17/80] ee site update mysql optimised --- bin/easyengine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/easyengine b/bin/easyengine index 21cf0fd6..f2fd1969 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -593,7 +593,7 @@ elif [ "$EE_FIRST" = "site" ]; then # Display WordPress cache plugin settings ee_mod_plugin_settings fi - #if [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] + # if [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] elif [[ "$EE_SITE_CURRENT_OPTION" = "MYSQL" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then # Let's take backup first ee_mod_site_backup From cbb0ecf989aadfd4b7a213221fd3df2d4fd9c78f Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 17 Oct 2014 20:43:35 +0530 Subject: [PATCH 18/80] Display DB information when update mysql websites --- src/modules/site/create/ee_mod_setup_wordpress.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/site/create/ee_mod_setup_wordpress.sh b/src/modules/site/create/ee_mod_setup_wordpress.sh index 80547d7c..e91d7a1d 100644 --- a/src/modules/site/create/ee_mod_setup_wordpress.sh +++ b/src/modules/site/create/ee_mod_setup_wordpress.sh @@ -15,6 +15,9 @@ function ee_mod_setup_wordpress() # else current mysql site is to be updated if [ "$EE_DB_NAME" = "" ] && [ "$EE_DB_USER" = "" ] && [ "$EE_DB_PASS" = "" ]; then ee_mod_setup_database + else + # Display when run ee site update mysql.com --wp + echo -e "EE_DB_NAME = $EE_DB_NAME \nEE_DB_USER = $EE_DB_USER \nEE_DB_PASS = $EE_DB_PASS \nEE_MYSQL_HOST = $EE_MYSQL_HOST \nEE_MYSQL_GRANT_HOST = $EE_MYSQL_GRANT_HOST" &>> $EE_COMMAND_LOG fi # Default WordPress prefix or custom prefix From 5fdcf2eedc42a859975ae6e9d58666df1a4f17a5 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Mon, 20 Oct 2014 11:44:23 +0530 Subject: [PATCH 19/80] Optimized ee site update wp code --- bin/easyengine | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bin/easyengine b/bin/easyengine index f2fd1969..f9dbd74c 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -620,6 +620,30 @@ elif [ "$EE_FIRST" = "site" ]; then # Display WordPress cache plugin settings ee_mod_plugin_settings + elif [[ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" || "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" || "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" || "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ]] \ + && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then + # Let's take backup first + ee_mod_site_backup + + # Let's start update + ee_mod_update_nginx + + # Setup WordPress Network + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + ee_mod_setup_network + fi + + if [[ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" && "$EE_SITE_CACHE_OPTION" != "--basic" ]]; then + if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + ee_mod_plugin_wpsc + fi + + if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + ee_mod_plugin_w3tc + fi + else + ee_mod_update_plugins + fi fi From fb47a6862faedb35105ef56018d2d0eaef3a6cd8 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Mon, 20 Oct 2014 17:07:02 +0530 Subject: [PATCH 20/80] minor update --- bin/easyengine | 2 +- .../site/update/ee_mod_update_plugins.sh | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index f9dbd74c..764fee95 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -632,7 +632,7 @@ elif [ "$EE_FIRST" = "site" ]; then if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then ee_mod_setup_network fi - + # Let's Update cache plugins if [[ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" && "$EE_SITE_CACHE_OPTION" != "--basic" ]]; then if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then ee_mod_plugin_wpsc diff --git a/src/modules/site/update/ee_mod_update_plugins.sh b/src/modules/site/update/ee_mod_update_plugins.sh index b50df163..8a7ce7f0 100644 --- a/src/modules/site/update/ee_mod_update_plugins.sh +++ b/src/modules/site/update/ee_mod_update_plugins.sh @@ -4,28 +4,35 @@ function ee_mod_update_plugins() { cd /var/www/$EE_DOMAIN/htdocs/ + # Uninstall W3TC plugin in case converting site to --basic | --wpsc if [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ] \ || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR FAST CGI" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN FAST CGI" ] && [[ "$EE_SITE_CACHE_OPTION" = "--basic" || "$EE_SITE_CACHE_OPTION" = "--wpsc" ]]; then + || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN FAST CGI" ] \ + && [[ "$EE_SITE_CACHE_OPTION" = "--basic" || "$EE_SITE_CACHE_OPTION" = "--wpsc" ]]; then ee_lib_echo "Uninstalling W3 Total Cache plugin, please wait..." wp plugin --allow-root uninstall w3-total-cache &>> $EE_COMMAND_LOG fi - - if [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR WP SUPER CACHE" ] && [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then + # Uninstall WPSC plugin in case converting site to --basic | --w3tc | --wpfc + if [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR WP SUPER CACHE" ] \ + || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN WP SUPER CACHE" ] && [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then ee_lib_echo "Unistalling WP Super Cache plugin, please wait..." wp plugin --allow-root uninstall wp-super-cache &>> $EE_COMMAND_LOG fi + # Install wpsc plugin in case updating site to --wpsc if [ "$EE_SITE_CURRENT_OPTION" != "WPSINGLE WP SUPER CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR WP SUPER CACHE" ] \ && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN WP SUPER CACHE" ] && [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then ee_mod_plugin_wpsc + ee_mod_plugin_settings fi + # Install w3tc plugin in case updating site to --w3tc | --wpfc if [ "$EE_SITE_CURRENT_OPTION" != "WPSINGLE W3 TOTAL CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR W3 TOTAL CACHE" ] \ - || [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN W3 TOTAL CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSINGLE FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR FAST CGI" ] \ - || [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN FAST CGI" ] && [[ "$EE_SITE_CACHE_OPTION" = "--wpfc" || "$EE_SITE_CACHE_OPTION" = "--w3tc" ]]; then + || [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN W3 TOTAL CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSINGLE FAST CGI" ] \ + || [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN FAST CGI" ] \ + && [[ "$EE_SITE_CACHE_OPTION" = "--w3tc" || "$EE_SITE_CACHE_OPTION" = "--wpfc" ]]; then ee_mod_plugin_w3tc + ee_mod_plugin_settings fi } From 5dedb27ca514fd9e1d0f4b6c028f965f63cd3b8e Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Mon, 20 Oct 2014 19:00:22 +0530 Subject: [PATCH 21/80] ee site update for wordpress --- bin/easyengine | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index 764fee95..4763beae 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -556,11 +556,21 @@ elif [ "$EE_FIRST" = "site" ]; then EE_SITE_TYPE="--php" elif [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]; then EE_SITE_TYPE="--mysql" + elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" ]; then + EE_SITE_TYPE="--wp --basic" + elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ]; then + EE_SITE_TYPE="--wp --wpsc" + elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ]; then + EE_SITE_TYPE="--wp --w3tc" + elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ]; then + EE_SITE_TYPE="--wp --wpfc" fi + # Let's log site current option + ee_lib_echo_escape "EE_SITE_TYPE = $EE_SITE_TYPE \nEE_SITE_UPDATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION" &>> $EE_COMMAND_LOG + # Lets update HTML|PHP website - #if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then - if [[ "$EE_SITE_CURRENT_OPTION" = "HTML" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_OPTION" = "PHP" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then + if [[ "$EE_SITE_TYPE" = "--html" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_TYPE" = "--php" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then # Let's take backup first ee_mod_site_backup @@ -593,8 +603,8 @@ elif [ "$EE_FIRST" = "site" ]; then # Display WordPress cache plugin settings ee_mod_plugin_settings fi - # if [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] - elif [[ "$EE_SITE_CURRENT_OPTION" = "MYSQL" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then + + elif [[ "$EE_SITE_TYPE" = "--mysql" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then # Let's take backup first ee_mod_site_backup @@ -620,11 +630,15 @@ elif [ "$EE_FIRST" = "site" ]; then # Display WordPress cache plugin settings ee_mod_plugin_settings - elif [[ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" || "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" || "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" || "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ]] \ - && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then + + elif [[ "$EE_SITE_TYPE" = "--wp --basic" || "$EE_SITE_TYPE" = "--wp --wpsc" || "$EE_SITE_TYPE" = "--wp --w3tc" || "$EE_SITE_TYPE" = "--wp --wpfc" ]] \ + && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then # Let's take backup first ee_mod_site_backup + # Install required packages + ee_mod_site_packages + # Let's start update ee_mod_update_nginx @@ -632,18 +646,20 @@ elif [ "$EE_FIRST" = "site" ]; then if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then ee_mod_setup_network fi - # Let's Update cache plugins - if [[ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" && "$EE_SITE_CACHE_OPTION" != "--basic" ]]; then - if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then - ee_mod_plugin_wpsc - fi - if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - ee_mod_plugin_w3tc - fi - else - ee_mod_update_plugins + # Install WordPress plugins + ee_mod_plugin_nginx_helper + + if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + ee_mod_plugin_wpsc + fi + + if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + ee_mod_plugin_w3tc fi + + # Display WordPress cache plugin settings + ee_mod_plugin_settings fi From db29165f4e34e76cacf6df5b995158505389114e Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 11:48:31 +0530 Subject: [PATCH 22/80] Fix ee site create wp.com --wp to ee site update wp.com --wp --- bin/easyengine | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index 4763beae..cc8aa48d 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -547,30 +547,34 @@ elif [ "$EE_FIRST" = "site" ]; then || ee_lib_error "The $EE_DOMAIN does not exist, exit status = " $? # Find out information about current NGINX configuration - EE_SITE_CURRENT_OPTION=$(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) + EE_SITE_CURRENT_TYPE=$(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) # Detect current website type and cache - if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ]; then - EE_SITE_TYPE="--html" - elif [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then - EE_SITE_TYPE="--php" - elif [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]; then - EE_SITE_TYPE="--mysql" - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" ]; then - EE_SITE_TYPE="--wp --basic" - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ]; then - EE_SITE_TYPE="--wp --wpsc" - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ]; then - EE_SITE_TYPE="--wp --w3tc" - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ]; then - EE_SITE_TYPE="--wp --wpfc" + if [ "$EE_SITE_CURRENT_TYPE" = "HTML" ]; then + EE_SITE_CURRENT_TYPE="--html" + elif [ "$EE_SITE_CURRENT_TYPE" = "PHP" ]; then + EE_SITE_CURRENT_TYPE="--php" + elif [ "$EE_SITE_CURRENT_TYPE" = "MYSQL" ]; then + EE_SITE_CURRENT_TYPE="--mysql" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE BASIC" ]; then + EE_SITE_CURRENT_TYPE="--wp" + EE_SITE_CURRENT_CACHE="--basic" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE WP SUPER CACHE" ]; then + EE_SITE_CURRENT_TYPE="--wp" + EE_SITE_CURRENT_CACHE="--wpsc" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE W3 TOTAL CACHE" ]; then + EE_SITE_CURRENT_TYPE="--wp" + EE_SITE_CURRENT_CACHE="--w3tc" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE FAST CGI" ]; then + EE_SITE_CURRENT_TYPE="--wp" + EE_SITE_CURRENT_CACHE="--wpfc" fi # Let's log site current option - ee_lib_echo_escape "EE_SITE_TYPE = $EE_SITE_TYPE \nEE_SITE_UPDATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION" &>> $EE_COMMAND_LOG + ee_lib_echo_escape "EE_SITE_CURRENT_TYPE = $EE_SITE_CURRENT_TYPE \nEE_SITE_CURRENT_CACHE = $EE_SITE_CURRENT_CACHE \nEE_SITE_UPDATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION" &>> $EE_COMMAND_LOG # Lets update HTML|PHP website - if [[ "$EE_SITE_TYPE" = "--html" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_TYPE" = "--php" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then + if [[ "$EE_SITE_CURRENT_TYPE" = "--html" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_TYPE" = "--php" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then # Let's take backup first ee_mod_site_backup @@ -604,7 +608,7 @@ elif [ "$EE_FIRST" = "site" ]; then ee_mod_plugin_settings fi - elif [[ "$EE_SITE_TYPE" = "--mysql" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then + elif [[ "$EE_SITE_CURRENT_TYPE" = "--mysql" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then # Let's take backup first ee_mod_site_backup @@ -631,7 +635,7 @@ elif [ "$EE_FIRST" = "site" ]; then # Display WordPress cache plugin settings ee_mod_plugin_settings - elif [[ "$EE_SITE_TYPE" = "--wp --basic" || "$EE_SITE_TYPE" = "--wp --wpsc" || "$EE_SITE_TYPE" = "--wp --w3tc" || "$EE_SITE_TYPE" = "--wp --wpfc" ]] \ + elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp" && "$EE_SITE_CURRENT_CACHE" != "$EE_SITE_CACHE_OPTION" ]] \ && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then # Let's take backup first ee_mod_site_backup @@ -663,7 +667,7 @@ elif [ "$EE_FIRST" = "site" ]; then fi - if [ "$EE_SITE_TYPE" != "$EE_SITE_CREATE_OPTION" ]; then + if [ "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_CREATE_OPTION" ]; then # Adjust permission ee_lib_permissions @@ -675,8 +679,6 @@ elif [ "$EE_FIRST" = "site" ]; then # Display Success Message ee_lib_echo_info "Successfully Updated Website: http://$EE_WWW_DOMAIN" - else - ee_lib_error "Invalid option, exit status = " $? fi elif [ "$EE_SECOND" = "log" ]; then From ec1ddbb2c70b54326f8bbdf164be004f550a14ab Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 13:16:44 +0530 Subject: [PATCH 23/80] Fix ee update logic --- bin/easyengine | 174 ++++++++++------------- src/modules/site/update/ee_mod_update.sh | 67 +++++++++ 2 files changed, 145 insertions(+), 96 deletions(-) create mode 100644 src/modules/site/update/ee_mod_update.sh diff --git a/bin/easyengine b/bin/easyengine index cc8aa48d..13f08b24 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -556,118 +556,98 @@ elif [ "$EE_FIRST" = "site" ]; then EE_SITE_CURRENT_TYPE="--php" elif [ "$EE_SITE_CURRENT_TYPE" = "MYSQL" ]; then EE_SITE_CURRENT_TYPE="--mysql" + # Single WordPress elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE BASIC" ]; then - EE_SITE_CURRENT_TYPE="--wp" - EE_SITE_CURRENT_CACHE="--basic" + EE_SITE_CURRENT_TYPE="--wp --basic" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE WP SUPER CACHE" ]; then - EE_SITE_CURRENT_TYPE="--wp" - EE_SITE_CURRENT_CACHE="--wpsc" + EE_SITE_CURRENT_TYPE="--wp --wpsc" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE W3 TOTAL CACHE" ]; then - EE_SITE_CURRENT_TYPE="--wp" - EE_SITE_CURRENT_CACHE="--w3tc" + EE_SITE_CURRENT_TYPE="--wp --w3tc" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE FAST CGI" ]; then - EE_SITE_CURRENT_TYPE="--wp" - EE_SITE_CURRENT_CACHE="--wpfc" + EE_SITE_CURRENT_TYPE="--wp --wpfc" + # WordPress subdirectory + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR BASIC" ]; then + EE_SITE_CURRENT_TYPE="--wpsubdir --basic" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR WP SUPER CACHE" ]; then + EE_SITE_CURRENT_TYPE="--wpsubdir --wpsc" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR W3 TOTAL CACHE" ]; then + EE_SITE_CURRENT_TYPE="--wpsubdir --w3tc" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR FAST CGI" ]; then + EE_SITE_CURRENT_TYPE="--wpsubdir --wpfc" + # WordPress subdomain + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN BASIC" ]; then + EE_SITE_CURRENT_TYPE="--wpsubdomain --basic" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN WP SUPER CACHE" ]; then + EE_SITE_CURRENT_TYPE="--wpsubdomain --wpsc" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN W3 TOTAL CACHE" ]; then + EE_SITE_CURRENT_TYPE="--wpsubdomain --w3tc" + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN FAST CGI" ]; then + EE_SITE_CURRENT_TYPE="--wpsubdomain --wpfc" + fi + + # Detect update website type and cache + if [ "$EE_SITE_CREATE_OPTION" = "--wp" ]; then + if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then + EE_SITE_UPDATE_TYPE="--wp --basic" + elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + EE_SITE_UPDATE_TYPE="--wp --wpsc" + elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then + EE_SITE_UPDATE_TYPE="--wp --w3tc" + elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + EE_SITE_UPDATE_TYPE="--wp --wpfc" + fi + elif [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then + if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then + EE_SITE_UPDATE_TYPE="--wpsubdir --basic" + elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + EE_SITE_UPDATE_TYPE="--wpsubdir --wpsc" + elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then + EE_SITE_UPDATE_TYPE="--wpsubdir --w3tc" + elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + EE_SITE_UPDATE_TYPE="--wpsubdir --wpfc" + fi + elif [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then + EE_SITE_UPDATE_TYPE="--wpsubdomain --basic" + elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + EE_SITE_UPDATE_TYPE="--wpsubdomain --wpsc" + elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then + EE_SITE_UPDATE_TYPE="--wpsubdomain --w3tc" + elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + EE_SITE_UPDATE_TYPE="--wpsubdomain --wpfc" + fi fi # Let's log site current option - ee_lib_echo_escape "EE_SITE_CURRENT_TYPE = $EE_SITE_CURRENT_TYPE \nEE_SITE_CURRENT_CACHE = $EE_SITE_CURRENT_CACHE \nEE_SITE_UPDATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION" &>> $EE_COMMAND_LOG + ee_lib_echo_escape "EE_SITE_CURRENT_TYPE = $EE_SITE_CURRENT_TYPE \nEE_SITE_UPDATE_TYPE = $EE_SITE_UPDATE_TYPE" &>> $EE_COMMAND_LOG # Lets update HTML|PHP website if [[ "$EE_SITE_CURRENT_TYPE" = "--html" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_TYPE" = "--php" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then - # Let's take backup first - ee_mod_site_backup - - # Install required packages - ee_mod_site_packages - - # Let's start update - ee_mod_update_nginx - - # Setup MySQL database - if [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then - 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 - fi - - # Setup WordPress - if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - # Setup WordPress - ee_mod_setup_wordpress - - # Display WordPress credential - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - - # Display WordPress cache plugin settings - ee_mod_plugin_settings - fi + # Lets call update function + ee_mod_update elif [[ "$EE_SITE_CURRENT_TYPE" = "--mysql" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then - # Let's take backup first - ee_mod_site_backup - - # Install required packages - ee_mod_site_packages - - # Let's start update - ee_mod_update_nginx - - # Use same database for WordPress - EE_DB_NAME=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) - EE_DB_USER=$(grep DB_USER $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) - EE_DB_PASS=$(grep DB_PASSWORD $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) - - # Setup WordPress - ee_mod_setup_wordpress - - # Display WordPress credential - echo - ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" - ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" - echo - - # Display WordPress cache plugin settings - ee_mod_plugin_settings + # Lets call update function + ee_mod_update - elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp" && "$EE_SITE_CURRENT_CACHE" != "$EE_SITE_CACHE_OPTION" ]] \ - && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then - # Let's take backup first - ee_mod_site_backup - - # Install required packages - ee_mod_site_packages - - # Let's start update - ee_mod_update_nginx - - # Setup WordPress Network - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - ee_mod_setup_network - fi - - # Install WordPress plugins - ee_mod_plugin_nginx_helper - - if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then - ee_mod_plugin_wpsc - fi - - if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then - ee_mod_plugin_w3tc - fi - - # Display WordPress cache plugin settings - ee_mod_plugin_settings + elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp --basic" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wp --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpfc" ]] \ + && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CURRENT_TYPE" != "EE_SITE_UPDATE_TYPE" ]]; then + # Lets call update function + ee_mod_update + + elif [[ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpfc" ]] \ + && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" && "$EE_SITE_CURRENT_TYPE" != "EE_SITE_UPDATE_TYPE" ]]; then + # Lets call update function + ee_mod_update + + elif [[ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpfc" ]] \ + && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CURRENT_TYPE" != "EE_SITE_UPDATE_TYPE" ]]; then + # Lets call update function + ee_mod_update fi - if [ "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_CREATE_OPTION" ]; then + if [ "$EE_MOD_UPDATE" = "success" ]; then # Adjust permission ee_lib_permissions @@ -679,6 +659,8 @@ elif [ "$EE_FIRST" = "site" ]; then # Display Success Message ee_lib_echo_info "Successfully Updated Website: http://$EE_WWW_DOMAIN" + else + ee_lib_error "Invalid option, exit status = " $? fi elif [ "$EE_SECOND" = "log" ]; then diff --git a/src/modules/site/update/ee_mod_update.sh b/src/modules/site/update/ee_mod_update.sh new file mode 100644 index 00000000..b72d42b6 --- /dev/null +++ b/src/modules/site/update/ee_mod_update.sh @@ -0,0 +1,67 @@ +# Update Websites + +function ee_mod_update() { + # Let's take backup first + ee_mod_site_backup + + # Install required packages + ee_mod_site_packages + + # Let's start update + ee_mod_update_nginx + + # Setup MySQL database for HTML|PHP websites + if [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then + 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 + fi + + # Use same database when update MySQL website to WordPress + if [ "$EE_SITE_CURRENT_TYPE" = "--mysql" ]; then + # Use same database for WordPress + EE_DB_NAME=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) + EE_DB_USER=$(grep DB_USER $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) + EE_DB_PASS=$(grep DB_PASSWORD $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) + fi + + # Setup WordPress + if [[ "$EE_SITE_CURRENT_TYPE" != "--wp" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain" ]] && + [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]]; then + # Setup WordPress + ee_mod_setup_wordpress + + # Display WordPress credential + echo + ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" + ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" + echo + + # Display WordPress cache plugin settings + ee_mod_plugin_settings + else + # Setup WordPress Network + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + ee_mod_setup_network + fi + + # Install WordPress plugins + ee_mod_plugin_nginx_helper + + if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + ee_mod_plugin_wpsc + fi + + if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + ee_mod_plugin_w3tc + fi + + # Display WordPress cache plugin settings + ee_mod_plugin_settings + fi + + # Use this variable to detect and change ownership, reload nginx, + EE_MOD_UPDATE="success" +} \ No newline at end of file From 524426f0f23508ac15715bb912ed256d854af7c0 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 14:00:32 +0530 Subject: [PATCH 24/80] Minor fix --- src/modules/site/update/ee_mod_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/update/ee_mod_update.sh b/src/modules/site/update/ee_mod_update.sh index b72d42b6..8790cd52 100644 --- a/src/modules/site/update/ee_mod_update.sh +++ b/src/modules/site/update/ee_mod_update.sh @@ -41,7 +41,7 @@ function ee_mod_update() { # Display WordPress cache plugin settings ee_mod_plugin_settings - else + elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain" ]] # Setup WordPress Network if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then ee_mod_setup_network From 1950fbcebee3f78d91c26693a186c50ae94393f0 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 14:08:02 +0530 Subject: [PATCH 25/80] Minor fix --- src/modules/site/update/ee_mod_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/update/ee_mod_update.sh b/src/modules/site/update/ee_mod_update.sh index 8790cd52..a558677e 100644 --- a/src/modules/site/update/ee_mod_update.sh +++ b/src/modules/site/update/ee_mod_update.sh @@ -41,7 +41,7 @@ function ee_mod_update() { # Display WordPress cache plugin settings ee_mod_plugin_settings - elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain" ]] + elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain" ]]; then # Setup WordPress Network if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then ee_mod_setup_network From 677d1031238860f7eeae40f3d57a5221f6e5e632 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 14:45:41 +0530 Subject: [PATCH 26/80] Minor fix --- bin/easyengine | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index 13f08b24..19456b35 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -631,17 +631,17 @@ elif [ "$EE_FIRST" = "site" ]; then ee_mod_update elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp --basic" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wp --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpfc" ]] \ - && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CURRENT_TYPE" != "EE_SITE_UPDATE_TYPE" ]]; then + && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then # Lets call update function ee_mod_update elif [[ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpfc" ]] \ - && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" && "$EE_SITE_CURRENT_TYPE" != "EE_SITE_UPDATE_TYPE" ]]; then + && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then # Lets call update function ee_mod_update elif [[ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpfc" ]] \ - && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CURRENT_TYPE" != "EE_SITE_UPDATE_TYPE" ]]; then + && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then # Lets call update function ee_mod_update fi From bb2a3353b823ffba6f3456dc223196b039f11177 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 15:16:06 +0530 Subject: [PATCH 27/80] Minor fix --- src/modules/site/update/ee_mod_update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/site/update/ee_mod_update.sh b/src/modules/site/update/ee_mod_update.sh index a558677e..ec5caaab 100644 --- a/src/modules/site/update/ee_mod_update.sh +++ b/src/modules/site/update/ee_mod_update.sh @@ -28,7 +28,7 @@ function ee_mod_update() { fi # Setup WordPress - if [[ "$EE_SITE_CURRENT_TYPE" != "--wp" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain" ]] && + if [[ "$EE_SITE_CURRENT_TYPE" != "--wp --basic" || "$EE_SITE_CURRENT_TYPE" != "--wp --wpsc" || "$EE_SITE_CURRENT_TYPE" != "--wp --w3tc" || "$EE_SITE_CURRENT_TYPE" != "--wp --wpfc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --basic" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpsc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --w3tc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpfc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --basic" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpsc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --w3tc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpfc" ]] && [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]]; then # Setup WordPress ee_mod_setup_wordpress @@ -41,7 +41,7 @@ function ee_mod_update() { # Display WordPress cache plugin settings ee_mod_plugin_settings - elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain" ]]; then + elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp --basic" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wp --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpfc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpfc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpfc" ]]; then # Setup WordPress Network if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then ee_mod_setup_network From 3f819c8cda37eab20d48cf7267f3c959349bfe49 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 15:53:30 +0530 Subject: [PATCH 28/80] Minor fix --- src/modules/site/update/ee_mod_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/update/ee_mod_update.sh b/src/modules/site/update/ee_mod_update.sh index ec5caaab..12c77475 100644 --- a/src/modules/site/update/ee_mod_update.sh +++ b/src/modules/site/update/ee_mod_update.sh @@ -28,7 +28,7 @@ function ee_mod_update() { fi # Setup WordPress - if [[ "$EE_SITE_CURRENT_TYPE" != "--wp --basic" || "$EE_SITE_CURRENT_TYPE" != "--wp --wpsc" || "$EE_SITE_CURRENT_TYPE" != "--wp --w3tc" || "$EE_SITE_CURRENT_TYPE" != "--wp --wpfc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --basic" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpsc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --w3tc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpfc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --basic" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpsc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --w3tc" || "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpfc" ]] && + if [[ "$EE_SITE_CURRENT_TYPE" != "--wp --basic" && "$EE_SITE_CURRENT_TYPE" != "--wp --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wp --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wp --wpfc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpfc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpfc" ]] && [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]]; then # Setup WordPress ee_mod_setup_wordpress From c4d93fd0cff6fe0d239caee92f70c3564db9211d Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 16:42:21 +0530 Subject: [PATCH 29/80] Fix WordPress multisite update --- bin/easyengine | 12 ++++++------ ..._mod_update.sh => ee_mod_update_website.sh} | 18 +++++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) rename src/modules/site/update/{ee_mod_update.sh => ee_mod_update_website.sh} (79%) diff --git a/bin/easyengine b/bin/easyengine index 19456b35..78453a46 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -624,30 +624,30 @@ elif [ "$EE_FIRST" = "site" ]; then # Lets update HTML|PHP website if [[ "$EE_SITE_CURRENT_TYPE" = "--html" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_TYPE" = "--php" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then # Lets call update function - ee_mod_update + ee_mod_update_website elif [[ "$EE_SITE_CURRENT_TYPE" = "--mysql" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then # Lets call update function - ee_mod_update + ee_mod_update_website elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp --basic" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wp --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpfc" ]] \ && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then # Lets call update function - ee_mod_update + ee_mod_update_website elif [[ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpfc" ]] \ && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then # Lets call update function - ee_mod_update + ee_mod_update_website elif [[ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpfc" ]] \ && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then # Lets call update function - ee_mod_update + ee_mod_update_website fi - if [ "$EE_MOD_UPDATE" = "success" ]; then + if [ "$EE_UPDATE_WEBSITE" = "success" ]; then # Adjust permission ee_lib_permissions diff --git a/src/modules/site/update/ee_mod_update.sh b/src/modules/site/update/ee_mod_update_website.sh similarity index 79% rename from src/modules/site/update/ee_mod_update.sh rename to src/modules/site/update/ee_mod_update_website.sh index 12c77475..148b7342 100644 --- a/src/modules/site/update/ee_mod_update.sh +++ b/src/modules/site/update/ee_mod_update_website.sh @@ -1,6 +1,6 @@ # Update Websites -function ee_mod_update() { +function ee_mod_update_website() { # Let's take backup first ee_mod_site_backup @@ -19,7 +19,7 @@ function ee_mod_update() { &>> /var/www/$EE_DOMAIN/ee-config.php fi - # Use same database when update MySQL website to WordPress + # Use same database when update MySQL website updated to WordPress if [ "$EE_SITE_CURRENT_TYPE" = "--mysql" ]; then # Use same database for WordPress EE_DB_NAME=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) @@ -27,7 +27,7 @@ function ee_mod_update() { EE_DB_PASS=$(grep DB_PASSWORD $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) fi - # Setup WordPress + # Setup/Install WordPress for HTML|PHP|MySQL websites if [[ "$EE_SITE_CURRENT_TYPE" != "--wp --basic" && "$EE_SITE_CURRENT_TYPE" != "--wp --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wp --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wp --wpfc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpfc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpfc" ]] && [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]]; then # Setup WordPress @@ -41,10 +41,14 @@ function ee_mod_update() { # Display WordPress cache plugin settings ee_mod_plugin_settings + + # Update WordPress Websites elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp --basic" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wp --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpfc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpfc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpfc" ]]; then - # Setup WordPress Network - if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - ee_mod_setup_network + # Setup WordPress Network for --wp websites + if [[ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpfc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpfc" ]]; then + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + ee_mod_setup_network + fi fi # Install WordPress plugins @@ -63,5 +67,5 @@ function ee_mod_update() { fi # Use this variable to detect and change ownership, reload nginx, - EE_MOD_UPDATE="success" + EE_UPDATE_WEBSITE="success" } \ No newline at end of file From 6d3be99e87fad6d795204b7eef5f47b1e9f9c3c7 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 17:04:52 +0530 Subject: [PATCH 30/80] Kick out for invalid cache options --- src/modules/site/ee_mod_site_option.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index 4c7f0e55..bc1ba4ee 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -12,6 +12,11 @@ function ee_mod_site_option() fi fi + # Kick out for invalid cache option + if [ "$EE_SITE_CACHE_OPTION" != "--basic" ] || [ "$EE_SITE_CACHE_OPTION" != "--wpsc" ] || [ "$EE_SITE_CACHE_OPTION" != "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" != "--wpfc" ]; then + ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? + fi + # WordPresss subdirectory variables if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdirectory" ]; then EE_SITE_CREATE_OPTION="--wpsubdir" From 709b0e8674dc93ff89b2dea799b41c110eb65c78 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 17:16:12 +0530 Subject: [PATCH 31/80] Kick out for invalid cache options --- src/modules/site/ee_mod_site_option.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index bc1ba4ee..bf096ba6 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -12,11 +12,6 @@ function ee_mod_site_option() fi fi - # Kick out for invalid cache option - if [ "$EE_SITE_CACHE_OPTION" != "--basic" ] || [ "$EE_SITE_CACHE_OPTION" != "--wpsc" ] || [ "$EE_SITE_CACHE_OPTION" != "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" != "--wpfc" ]; then - ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? - fi - # WordPresss subdirectory variables if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdirectory" ]; then EE_SITE_CREATE_OPTION="--wpsubdir" @@ -39,4 +34,9 @@ function ee_mod_site_option() 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 + + # Kick out for invalid cache option + if [[ "$EE_SITE_CACHE_OPTION" != "--basic" || "$EE_SITE_CACHE_OPTION" != "--wpsc" || "$EE_SITE_CACHE_OPTION" != "--w3tc" || "$EE_SITE_CACHE_OPTION" != "--wpfc" ]] && [[ "$EE_SITE_CREATE_OPTION" != "--html" || "$EE_SITE_CREATE_OPTION" != "--php" || "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then + ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? + fi } From d0f87f06e8a2a9ffa1024646f86f0ff298c14314 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 21 Oct 2014 17:47:55 +0530 Subject: [PATCH 32/80] Kick out for invalid cache options --- src/modules/site/ee_mod_site_option.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index bf096ba6..3fff8d35 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -36,7 +36,7 @@ function ee_mod_site_option() fi # Kick out for invalid cache option - if [[ "$EE_SITE_CACHE_OPTION" != "--basic" || "$EE_SITE_CACHE_OPTION" != "--wpsc" || "$EE_SITE_CACHE_OPTION" != "--w3tc" || "$EE_SITE_CACHE_OPTION" != "--wpfc" ]] && [[ "$EE_SITE_CREATE_OPTION" != "--html" || "$EE_SITE_CREATE_OPTION" != "--php" || "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then + if [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--basic" && "$EE_SITE_CACHE_OPTION" != "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? fi } From b7ac09a920660f0dc05512256bcfe283e79fb067 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 15:30:31 +0530 Subject: [PATCH 33/80] Fix plugin delete --- bin/easyengine | 35 ++++++++++++++++--- .../site/update/ee_mod_update_website.sh | 25 ++++++++++--- 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index 78453a46..ac5b523c 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -558,34 +558,59 @@ elif [ "$EE_FIRST" = "site" ]; then EE_SITE_CURRENT_TYPE="--mysql" # Single WordPress elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE BASIC" ]; then + EE_SITE_CURRENT_WP="--wp" + EE_SITE_CURRENT_CACHE="--basic" EE_SITE_CURRENT_TYPE="--wp --basic" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE WP SUPER CACHE" ]; then + EE_SITE_CURRENT_WP="--wp" + EE_SITE_CURRENT_CACHE="--wpsc" EE_SITE_CURRENT_TYPE="--wp --wpsc" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE W3 TOTAL CACHE" ]; then + EE_SITE_CURRENT_WP="--wp" + EE_SITE_CURRENT_CACHE="--w3tc" EE_SITE_CURRENT_TYPE="--wp --w3tc" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE FAST CGI" ]; then + EE_SITE_CURRENT_WP="--wp" + EE_SITE_CURRENT_CACHE="--wpfc" EE_SITE_CURRENT_TYPE="--wp --wpfc" # WordPress subdirectory elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR BASIC" ]; then + EE_SITE_CURRENT_WP="--wpsubdir" + EE_SITE_CURRENT_CACHE="--basic" EE_SITE_CURRENT_TYPE="--wpsubdir --basic" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR WP SUPER CACHE" ]; then + EE_SITE_CURRENT_WP="--wpsubdir" + EE_SITE_CURRENT_CACHE="--wpsc" EE_SITE_CURRENT_TYPE="--wpsubdir --wpsc" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR W3 TOTAL CACHE" ]; then + EE_SITE_CURRENT_WP="--wpsubdir" + EE_SITE_CURRENT_CACHE="--w3tc" EE_SITE_CURRENT_TYPE="--wpsubdir --w3tc" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR FAST CGI" ]; then + EE_SITE_CURRENT_WP="--wpsubdir" + EE_SITE_CURRENT_CACHE="--wpfc" EE_SITE_CURRENT_TYPE="--wpsubdir --wpfc" # WordPress subdomain elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN BASIC" ]; then + EE_SITE_CURRENT_WP="--wpsubdomain" + EE_SITE_CURRENT_CACHE="--basic" EE_SITE_CURRENT_TYPE="--wpsubdomain --basic" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN WP SUPER CACHE" ]; then + EE_SITE_CURRENT_WP="--wpsubdomain" + EE_SITE_CURRENT_CACHE="--wpsc" EE_SITE_CURRENT_TYPE="--wpsubdomain --wpsc" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN W3 TOTAL CACHE" ]; then + EE_SITE_CURRENT_WP="--wpsubdomain" + EE_SITE_CURRENT_CACHE="--w3tc" EE_SITE_CURRENT_TYPE="--wpsubdomain --w3tc" elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN FAST CGI" ]; then + EE_SITE_CURRENT_WP="--wpsubdomain" + EE_SITE_CURRENT_CACHE="--wpfc" EE_SITE_CURRENT_TYPE="--wpsubdomain --wpfc" fi # Detect update website type and cache + # Single WordPress if [ "$EE_SITE_CREATE_OPTION" = "--wp" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then EE_SITE_UPDATE_TYPE="--wp --basic" @@ -596,6 +621,7 @@ elif [ "$EE_FIRST" = "site" ]; then elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then EE_SITE_UPDATE_TYPE="--wp --wpfc" fi + # WordPress subdirectory elif [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then EE_SITE_UPDATE_TYPE="--wpsubdir --basic" @@ -606,6 +632,7 @@ elif [ "$EE_FIRST" = "site" ]; then elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then EE_SITE_UPDATE_TYPE="--wpsubdir --wpfc" fi + # WordPress subdomain elif [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then EE_SITE_UPDATE_TYPE="--wpsubdomain --basic" @@ -619,7 +646,7 @@ elif [ "$EE_FIRST" = "site" ]; then fi # Let's log site current option - ee_lib_echo_escape "EE_SITE_CURRENT_TYPE = $EE_SITE_CURRENT_TYPE \nEE_SITE_UPDATE_TYPE = $EE_SITE_UPDATE_TYPE" &>> $EE_COMMAND_LOG + ee_lib_echo_escape "EE_SITE_CURRENT_WP = $EE_SITE_CURRENT_WP \nEE_SITE_CURRENT_CACHE = $EE_SITE_CURRENT_CACHE \nEE_SITE_CURRENT_TYPE = $EE_SITE_CURRENT_TYPE \nEE_SITE_UPDATE_TYPE = $EE_SITE_UPDATE_TYPE" &>> $EE_COMMAND_LOG # Lets update HTML|PHP website if [[ "$EE_SITE_CURRENT_TYPE" = "--html" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_TYPE" = "--php" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then @@ -630,17 +657,17 @@ elif [ "$EE_FIRST" = "site" ]; then # Lets call update function ee_mod_update_website - elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp --basic" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wp --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpfc" ]] \ + elif [[ "$EE_SITE_CURRENT_WP" = "--wp" ]] \ && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then # Lets call update function ee_mod_update_website - elif [[ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpfc" ]] \ + elif [[ "$EE_SITE_CURRENT_WP" = "--wpsubdir" ]] \ && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then # Lets call update function ee_mod_update_website - elif [[ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpfc" ]] \ + elif [[ "$EE_SITE_CURRENT_WP" = "--wpsubdomain" ]] \ && [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then # Lets call update function ee_mod_update_website diff --git a/src/modules/site/update/ee_mod_update_website.sh b/src/modules/site/update/ee_mod_update_website.sh index 148b7342..f9c72b9b 100644 --- a/src/modules/site/update/ee_mod_update_website.sh +++ b/src/modules/site/update/ee_mod_update_website.sh @@ -28,7 +28,7 @@ function ee_mod_update_website() { fi # Setup/Install WordPress for HTML|PHP|MySQL websites - if [[ "$EE_SITE_CURRENT_TYPE" != "--wp --basic" && "$EE_SITE_CURRENT_TYPE" != "--wp --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wp --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wp --wpfc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpfc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpfc" ]] && + if [[ "$EE_SITE_CURRENT_TYPE" = "--html" || "$EE_SITE_CURRENT_TYPE" = "--php" || "$EE_SITE_CURRENT_TYPE" = "--mysql" ]] && [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]]; then # Setup WordPress ee_mod_setup_wordpress @@ -43,16 +43,33 @@ function ee_mod_update_website() { ee_mod_plugin_settings # Update WordPress Websites - elif [[ "$EE_SITE_CURRENT_TYPE" = "--wp --basic" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wp --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wp --wpfc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpfc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --basic" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpsc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --w3tc" || "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpfc" ]]; then + elif [[ "$EE_SITE_CURRENT_WP" = "--wp" || "$EE_SITE_CURRENT_WP" = "--wpsubdir" || "$EE_SITE_CURRENT_WP" = "--wpsubdomain" ]]; then # Setup WordPress Network for --wp websites - if [[ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpfc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --basic" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpsc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --w3tc" && "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpfc" ]]; then + if [[ "$EE_SITE_CURRENT_WP" = "--wp" ]]; then if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then ee_mod_setup_network fi fi + # Uninstall unwanted plugins + # Current site type: --wp --wpsc + # Update site type: --wpsubdomain --wpsc + # Only delete plugin when current cache is --wpsc and update cache is not --wpsc + if [[ "$EE_SITE_CURRENT_CACHE" = "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--wpsc" ]]; then + ee_lib_echo "Unistalling WP Super Cache plugin, please wait..." + wp plugin --allow-root uninstall wp-super-cache &>> $EE_COMMAND_LOG + fi + + # Delete plugin when current cache is --w3tc|--wpfc and update cache is not --w3tc|--wpfc + if [[ "$EE_SITE_CURRENT_CACHE" = "--w3tc" || "$EE_SITE_CURRENT_CACHE" = "--wpfc" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then + ee_lib_echo "Uninstalling W3 Total Cache plugin, please wait..." + wp plugin --allow-root uninstall w3-total-cache &>> $EE_COMMAND_LOG + fi + # Install WordPress plugins - ee_mod_plugin_nginx_helper + # As nginx-helper is installed all type of WordPress + # We don't need to install it again + #ee_mod_plugin_nginx_helper if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then ee_mod_plugin_wpsc From c347e5c342116d9d3c96399f877672edb445dc4c Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 16:13:37 +0530 Subject: [PATCH 34/80] Fixed invalid options --- src/modules/site/update/ee_mod_update_website.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/site/update/ee_mod_update_website.sh b/src/modules/site/update/ee_mod_update_website.sh index f9c72b9b..ec8c5420 100644 --- a/src/modules/site/update/ee_mod_update_website.sh +++ b/src/modules/site/update/ee_mod_update_website.sh @@ -56,12 +56,14 @@ function ee_mod_update_website() { # Update site type: --wpsubdomain --wpsc # Only delete plugin when current cache is --wpsc and update cache is not --wpsc if [[ "$EE_SITE_CURRENT_CACHE" = "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--wpsc" ]]; then + cd /var/www/$EE_DOMAIN/htdocs/ ee_lib_echo "Unistalling WP Super Cache plugin, please wait..." wp plugin --allow-root uninstall wp-super-cache &>> $EE_COMMAND_LOG fi # Delete plugin when current cache is --w3tc|--wpfc and update cache is not --w3tc|--wpfc - if [[ "$EE_SITE_CURRENT_CACHE" = "--w3tc" || "$EE_SITE_CURRENT_CACHE" = "--wpfc" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then + if [[ "$EE_SITE_CURRENT_CACHE" = "--w3tc" || "$EE_SITE_CURRENT_CACHE" = "--wpfc" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then + cd /var/www/$EE_DOMAIN/htdocs/ ee_lib_echo "Uninstalling W3 Total Cache plugin, please wait..." wp plugin --allow-root uninstall w3-total-cache &>> $EE_COMMAND_LOG fi @@ -71,11 +73,11 @@ function ee_mod_update_website() { # We don't need to install it again #ee_mod_plugin_nginx_helper - if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + if [ "$EE_SITE_CURRENT_CACHE" != "--wpsc" && "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then ee_mod_plugin_wpsc fi - if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then + if [[ "$EE_SITE_CURRENT_CACHE" != "--w3tc" || "$EE_SITE_CURRENT_CACHE" != "--wpfc" ]] && [[ "$EE_SITE_CACHE_OPTION" = "--w3tc" || "$EE_SITE_CACHE_OPTION" = "--wpfc" ]]; then ee_mod_plugin_w3tc fi From f495b5cc7b78cf5b3f92310ab6bb771d0543289a Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 16:14:52 +0530 Subject: [PATCH 35/80] Fixed invalid options --- src/modules/site/ee_mod_site_option.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index 3fff8d35..843d732c 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -36,7 +36,9 @@ function ee_mod_site_option() fi # Kick out for invalid cache option - if [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--basic" && "$EE_SITE_CACHE_OPTION" != "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then + if [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" ]]; then + ee_lib_error "Invalid website type $EE_SITE_CACHE_OPTION, exit status = " $? + elif [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--basic" && "$EE_SITE_CACHE_OPTION" != "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? fi } From ff6735afc1a9e8fd2dc8d40f9d655f3cf9b57762 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 16:30:56 +0530 Subject: [PATCH 36/80] Fix if syntax error --- src/modules/site/update/ee_mod_update_website.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/update/ee_mod_update_website.sh b/src/modules/site/update/ee_mod_update_website.sh index ec8c5420..7c876f9f 100644 --- a/src/modules/site/update/ee_mod_update_website.sh +++ b/src/modules/site/update/ee_mod_update_website.sh @@ -73,7 +73,7 @@ function ee_mod_update_website() { # We don't need to install it again #ee_mod_plugin_nginx_helper - if [ "$EE_SITE_CURRENT_CACHE" != "--wpsc" && "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then + if [[ "$EE_SITE_CURRENT_CACHE" != "--wpsc" && "$EE_SITE_CACHE_OPTION" = "--wpsc" ]]; then ee_mod_plugin_wpsc fi From 47af4d3c024c68be43af9de313ef5ed4c2fe80bc Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 16:39:39 +0530 Subject: [PATCH 37/80] Fixed w3tc plugin install for --wpfc to --w3tc update --- src/modules/site/update/ee_mod_update_website.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/update/ee_mod_update_website.sh b/src/modules/site/update/ee_mod_update_website.sh index 7c876f9f..17224714 100644 --- a/src/modules/site/update/ee_mod_update_website.sh +++ b/src/modules/site/update/ee_mod_update_website.sh @@ -77,7 +77,7 @@ function ee_mod_update_website() { ee_mod_plugin_wpsc fi - if [[ "$EE_SITE_CURRENT_CACHE" != "--w3tc" || "$EE_SITE_CURRENT_CACHE" != "--wpfc" ]] && [[ "$EE_SITE_CACHE_OPTION" = "--w3tc" || "$EE_SITE_CACHE_OPTION" = "--wpfc" ]]; then + if [[ "$EE_SITE_CURRENT_CACHE" != "--w3tc" && "$EE_SITE_CURRENT_CACHE" != "--wpfc" ]] && [[ "$EE_SITE_CACHE_OPTION" = "--w3tc" || "$EE_SITE_CACHE_OPTION" = "--wpfc" ]]; then ee_mod_plugin_w3tc fi From c7b5f084e6ca303d7c31548cbdaa9290b0320f54 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 16:48:12 +0530 Subject: [PATCH 38/80] Fix message --- src/modules/site/ee_mod_site_option.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index 843d732c..822ebf91 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -37,7 +37,7 @@ function ee_mod_site_option() # Kick out for invalid cache option if [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" ]]; then - ee_lib_error "Invalid website type $EE_SITE_CACHE_OPTION, exit status = " $? + ee_lib_error "Invalid website type $EE_SITE_CREATE_OPTION, exit status = " $? elif [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--basic" && "$EE_SITE_CACHE_OPTION" != "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? fi From 84081b82873832885f453dad562ec38c930e9e60 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 16:59:23 +0530 Subject: [PATCH 39/80] Fix invalid cache option for HTML PHP and MYSQL website --- src/modules/site/ee_mod_site_option.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index 822ebf91..8774cc98 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -38,6 +38,8 @@ function ee_mod_site_option() # Kick out for invalid cache option if [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" ]]; then ee_lib_error "Invalid website type $EE_SITE_CREATE_OPTION, exit status = " $? + elif [[ "$EE_SITE_CREATE_OPTION" = "--html" && "$EE_SITE_CREATE_OPTION" = "--php" && "$EE_SITE_CREATE_OPTION" = "--mysql" ]] && [ -n "$EE_SITE_CREATE_OPTION" ]; then + ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION for $EE_SITE_CREATE_OPTION website, exit status = " $? elif [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--basic" && "$EE_SITE_CACHE_OPTION" != "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? fi From 103ad3227725a7aa0d7088f3b6d48c63212b5cec Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 16:59:47 +0530 Subject: [PATCH 40/80] Fix invalid cache option for HTML PHP and MYSQL website --- src/modules/site/ee_mod_site_option.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index 8774cc98..4a2b7a7e 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -38,7 +38,7 @@ function ee_mod_site_option() # Kick out for invalid cache option if [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" ]]; then ee_lib_error "Invalid website type $EE_SITE_CREATE_OPTION, exit status = " $? - elif [[ "$EE_SITE_CREATE_OPTION" = "--html" && "$EE_SITE_CREATE_OPTION" = "--php" && "$EE_SITE_CREATE_OPTION" = "--mysql" ]] && [ -n "$EE_SITE_CREATE_OPTION" ]; then + elif [[ "$EE_SITE_CREATE_OPTION" = "--html" || "$EE_SITE_CREATE_OPTION" = "--php" || "$EE_SITE_CREATE_OPTION" = "--mysql" ]] && [ -n "$EE_SITE_CREATE_OPTION" ]; then ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION for $EE_SITE_CREATE_OPTION website, exit status = " $? elif [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--basic" && "$EE_SITE_CACHE_OPTION" != "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? From 2f4a3a35bab2b210f0397ccbbb923f8f55097f14 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 17:22:39 +0530 Subject: [PATCH 41/80] Remove unwanted file --- .../site/update/ee_mod_update_plugins.sh | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/modules/site/update/ee_mod_update_plugins.sh diff --git a/src/modules/site/update/ee_mod_update_plugins.sh b/src/modules/site/update/ee_mod_update_plugins.sh deleted file mode 100644 index 8a7ce7f0..00000000 --- a/src/modules/site/update/ee_mod_update_plugins.sh +++ /dev/null @@ -1,38 +0,0 @@ -# Update cache plugins - -function ee_mod_update_plugins() -{ - cd /var/www/$EE_DOMAIN/htdocs/ - - # Uninstall W3TC plugin in case converting site to --basic | --wpsc - if [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR FAST CGI" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN FAST CGI" ] \ - && [[ "$EE_SITE_CACHE_OPTION" = "--basic" || "$EE_SITE_CACHE_OPTION" = "--wpsc" ]]; then - ee_lib_echo "Uninstalling W3 Total Cache plugin, please wait..." - wp plugin --allow-root uninstall w3-total-cache &>> $EE_COMMAND_LOG - fi - # Uninstall WPSC plugin in case converting site to --basic | --w3tc | --wpfc - if [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR WP SUPER CACHE" ] \ - || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN WP SUPER CACHE" ] && [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then - ee_lib_echo "Unistalling WP Super Cache plugin, please wait..." - - wp plugin --allow-root uninstall wp-super-cache &>> $EE_COMMAND_LOG - fi - - # Install wpsc plugin in case updating site to --wpsc - if [ "$EE_SITE_CURRENT_OPTION" != "WPSINGLE WP SUPER CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR WP SUPER CACHE" ] \ - && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN WP SUPER CACHE" ] && [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then - ee_mod_plugin_wpsc - ee_mod_plugin_settings - fi - - # Install w3tc plugin in case updating site to --w3tc | --wpfc - if [ "$EE_SITE_CURRENT_OPTION" != "WPSINGLE W3 TOTAL CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR W3 TOTAL CACHE" ] \ - || [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN W3 TOTAL CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSINGLE FAST CGI" ] \ - || [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN FAST CGI" ] \ - && [[ "$EE_SITE_CACHE_OPTION" = "--w3tc" || "$EE_SITE_CACHE_OPTION" = "--wpfc" ]]; then - ee_mod_plugin_w3tc - ee_mod_plugin_settings - fi -} From 481c470608834d717b76cd312a2562cb13c17a79 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 17:33:09 +0530 Subject: [PATCH 42/80] Fix varible name --- src/modules/site/ee_mod_site_option.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index 4a2b7a7e..5bb9a414 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -38,7 +38,7 @@ function ee_mod_site_option() # Kick out for invalid cache option if [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" ]]; then ee_lib_error "Invalid website type $EE_SITE_CREATE_OPTION, exit status = " $? - elif [[ "$EE_SITE_CREATE_OPTION" = "--html" || "$EE_SITE_CREATE_OPTION" = "--php" || "$EE_SITE_CREATE_OPTION" = "--mysql" ]] && [ -n "$EE_SITE_CREATE_OPTION" ]; then + elif [[ "$EE_SITE_CREATE_OPTION" = "--html" || "$EE_SITE_CREATE_OPTION" = "--php" || "$EE_SITE_CREATE_OPTION" = "--mysql" ]] && [ -n "$EE_SITE_CACHE_OPTION" ]; then ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION for $EE_SITE_CREATE_OPTION website, exit status = " $? elif [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--basic" && "$EE_SITE_CACHE_OPTION" != "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? From 007c5a9e60e969b4a1dc21ca19d92c3c8f923d9e Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 18:07:26 +0530 Subject: [PATCH 43/80] Added ee site update example.com --password --- bin/easyengine | 5 ++++- src/modules/site/update/ee_mod_site_update_password.sh | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index ac5b523c..863916d7 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -648,8 +648,11 @@ elif [ "$EE_FIRST" = "site" ]; then # Let's log site current option ee_lib_echo_escape "EE_SITE_CURRENT_WP = $EE_SITE_CURRENT_WP \nEE_SITE_CURRENT_CACHE = $EE_SITE_CURRENT_CACHE \nEE_SITE_CURRENT_TYPE = $EE_SITE_CURRENT_TYPE \nEE_SITE_UPDATE_TYPE = $EE_SITE_UPDATE_TYPE" &>> $EE_COMMAND_LOG + # Update WordPress user password + if [ "$EE_SITE_CREATE_OPTION" = "--password" ]; then + ee_mod_site_update_password # Lets update HTML|PHP website - if [[ "$EE_SITE_CURRENT_TYPE" = "--html" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_TYPE" = "--php" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then + elif [[ "$EE_SITE_CURRENT_TYPE" = "--html" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_TYPE" = "--php" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then # Lets call update function ee_mod_update_website diff --git a/src/modules/site/update/ee_mod_site_update_password.sh b/src/modules/site/update/ee_mod_site_update_password.sh index f8055b57..fc418175 100644 --- a/src/modules/site/update/ee_mod_site_update_password.sh +++ b/src/modules/site/update/ee_mod_site_update_password.sh @@ -12,7 +12,15 @@ ee_mod_site_update_password() if [ $? -eq 0 ]; then read -p "Provide WordPress user name [admin]: " ee_wp_user - if [[ $ee_wp_user = "" ]]; then + + # If user enter ? mark then show list of WordPress users + if [ "$ee_wp_user" = "?" ]; then + ee_lib_echo "List of WordPress users:" + wp --allow-root user list --fields=user_login + read -p "Provide WordPress user name [admin]: " ee_wp_user + fi + + if [ "$ee_wp_user" = "" ]; then ee_wp_user=admin fi From 8504a0c7b5295ffccfecb721f8c0f00c50245416 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 18:26:31 +0530 Subject: [PATCH 44/80] Fix ee site update example.com --password --- bin/easyengine | 2 ++ src/modules/site/ee_mod_site_option.sh | 4 +++- src/modules/site/update/ee_mod_site_update_password.sh | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index 863916d7..425ab1b2 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -689,6 +689,8 @@ elif [ "$EE_FIRST" = "site" ]; then # Display Success Message ee_lib_echo_info "Successfully Updated Website: http://$EE_WWW_DOMAIN" + elif [[ "$EE_SECOND" = "update" && "$EE_SITE_CREATE_OPTION" = "--password" ]]; then + ee_lib_echo "This option is needed for updating WordPress website password" &> /dev/null else ee_lib_error "Invalid option, exit status = " $? fi diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index 5bb9a414..924858f1 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -36,7 +36,9 @@ function ee_mod_site_option() fi # Kick out for invalid cache option - if [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" ]]; then + if [[ "$EE_SECOND" = "update" && "$EE_SITE_CREATE_OPTION" = "--password" ]]; then + ee_lib_echo "This option is needed for updating WordPress website password" &> /dev/null + elif [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" ]]; then ee_lib_error "Invalid website type $EE_SITE_CREATE_OPTION, exit status = " $? elif [[ "$EE_SITE_CREATE_OPTION" = "--html" || "$EE_SITE_CREATE_OPTION" = "--php" || "$EE_SITE_CREATE_OPTION" = "--mysql" ]] && [ -n "$EE_SITE_CACHE_OPTION" ]; then ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION for $EE_SITE_CREATE_OPTION website, exit status = " $? diff --git a/src/modules/site/update/ee_mod_site_update_password.sh b/src/modules/site/update/ee_mod_site_update_password.sh index fc418175..fde5fd04 100644 --- a/src/modules/site/update/ee_mod_site_update_password.sh +++ b/src/modules/site/update/ee_mod_site_update_password.sh @@ -16,7 +16,7 @@ ee_mod_site_update_password() # If user enter ? mark then show list of WordPress users if [ "$ee_wp_user" = "?" ]; then ee_lib_echo "List of WordPress users:" - wp --allow-root user list --fields=user_login + wp --allow-root user list --fields=user_login | grep -v user_login read -p "Provide WordPress user name [admin]: " ee_wp_user fi @@ -35,7 +35,7 @@ ee_mod_site_update_password() ee_lib_error "Password Unchanged. Hint : Your password must be 8 characters long, exit status = " $? fi else - ee_lib_error "Invalid WordPress user $ee_wp_user for $EE_DOMAIN, exit status = " $? + ee_lib_error "Invalid WordPress user $ee_wp_user for $EE_DOMAIN, exit status = " $? fi fi } From 580cf0010d9b17ab24474d5a030d92aa8caa66c2 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 22 Oct 2014 18:50:40 +0530 Subject: [PATCH 45/80] Added success message after password successfully changed --- src/modules/site/update/ee_mod_site_update_password.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/site/update/ee_mod_site_update_password.sh b/src/modules/site/update/ee_mod_site_update_password.sh index fde5fd04..5335ad9d 100644 --- a/src/modules/site/update/ee_mod_site_update_password.sh +++ b/src/modules/site/update/ee_mod_site_update_password.sh @@ -15,7 +15,7 @@ ee_mod_site_update_password() # If user enter ? mark then show list of WordPress users if [ "$ee_wp_user" = "?" ]; then - ee_lib_echo "List of WordPress users:" + ee_lib_echo "Fetching WordPress user list, please wait..." wp --allow-root user list --fields=user_login | grep -v user_login read -p "Provide WordPress user name [admin]: " ee_wp_user fi @@ -30,7 +30,8 @@ ee_mod_site_update_password() read -sp "Provide password for $ee_wp_user user: " ee_wp_pass echo if [[ ${#ee_wp_pass} -ge 8 ]]; then - wp --allow-root user update "${ee_wp_user}" --user_pass=$ee_wp_pass &>> $EE_COMMAND_LOG + wp --allow-root user update "${ee_wp_user}" --user_pass=$ee_wp_pass &>> $EE_COMMAND_LOG && \ + ee_lib_echo "Password updated successfully" else ee_lib_error "Password Unchanged. Hint : Your password must be 8 characters long, exit status = " $? fi From d533f79cc2db507d460ca9eaad415a171b6c04b5 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Wed, 22 Oct 2014 19:02:57 +0530 Subject: [PATCH 46/80] autocompletion for ee site update --password --- config/bash_completion.d/ee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/bash_completion.d/ee b/config/bash_completion.d/ee index 7015fc94..d9244a3a 100644 --- a/config/bash_completion.d/ee +++ b/config/bash_completion.d/ee @@ -115,7 +115,7 @@ function EE_AUTO() if [ "$PREVIOUS2" = "create" ]; then COMPREPLY=( $( compgen -W "--html --php --mysql --wp --wpsubdir --wpsubdomain" -- $CURRENT ) ) elif [ "$PREVIOUS2" = "update" ]; then - COMPREPLY=( $( compgen -W "--php --mysql --wp --wpsubdir --wpsubdomain" -- $CURRENT ) ) + COMPREPLY=( $( compgen -W "--password --php --mysql --wp --wpsubdir --wpsubdomain" -- $CURRENT ) ) elif [ "$PREVIOUS2" = "delete" ]; then COMPREPLY=( $( compgen -W "--db --all --files --no-prompt" -- $CURRENT ) ) fi From 616c3c86b8b9b2501f265d975d2befe1fef5af3e Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 27 Oct 2014 19:25:54 +0530 Subject: [PATCH 47/80] Fixes http://community.rtcamp.com/t/unable-to-download-vimbadmin/3302/4 --- src/vendor/ee_ven_install_vimbadmin.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vendor/ee_ven_install_vimbadmin.sh b/src/vendor/ee_ven_install_vimbadmin.sh index 4f1d23a9..e76ac0a5 100644 --- a/src/vendor/ee_ven_install_vimbadmin.sh +++ b/src/vendor/ee_ven_install_vimbadmin.sh @@ -11,6 +11,9 @@ function ee_ven_install_vimbadmin() # Install ViMbAdmin ee_lib_echo "Installing ViMbAdmin, please wait..." ee_lib_echo "It will take nearly 10-20 minutes, please wait..." + mkdir -p /var/www/22222/htdocs/ \ + || ee_lib_error "Unable to create ViMbAdmin Directory, exit status = " $? + wget -cqO /var/www/22222/htdocs/vimbadmin.tar.gz https://github.com/opensolutions/ViMbAdmin/archive/${EE_VIMBADMIN_VERSION}.tar.gz \ || ee_lib_error "Unable to download ViMbAdmin, exit status = " $? @@ -25,7 +28,7 @@ function ee_ven_install_vimbadmin() || ee_lib_error "Unable to install ViMbAdmin, exit status = " $? # Fix permissions - chown -R $EE_PHP_USER:$EE_PHP_USER /var/www/22222/htdocs/vimbadmin \ + chown -R $EE_PHP_USER:$EE_PHP_USER /var/www/22222/ \ || ee_lib_error "Unable to change ownership for ViMbAdmin, exit status = " $? # Remove unwanted files From f49b9e9251e85ba290472f04147903ed2c7aa606 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 28 Oct 2014 15:34:26 +0530 Subject: [PATCH 48/80] Fixes http://community.rtcamp.com/t/aliases-in-vimbadmin-seem-to-be-ignored/3163/6 --- src/modules/stack/install/mail/ee_mod_setup_postfix.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/stack/install/mail/ee_mod_setup_postfix.sh b/src/modules/stack/install/mail/ee_mod_setup_postfix.sh index 6ffbf518..bc5b81c6 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_postfix.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_postfix.sh @@ -44,6 +44,7 @@ function ee_mod_setup_postfix() postconf -e "virtual_gid_maps = static:5000" postconf -e "virtual_mailbox_domains = mysql:/etc/postfix/mysql/virtual_domains_maps.cf" postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf" + postconf -e "virtual_alias_maps = mysql:/etc/postfix/mysql/virtual_alias_maps.cf" #postconf "message_size_limit = 20971520" From d98fa4538578f74b5e96a42d9d9f2718ca7686ed Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 28 Oct 2014 17:23:59 +0530 Subject: [PATCH 49/80] Fixes CVE-2014-3566 (Poodle Bug) #327 --- src/modules/stack/install/ee_mod_setup_nginx.sh | 2 +- src/modules/stack/install/mail/ee_mod_setup_dovecot.sh | 3 +++ src/modules/stack/install/mail/ee_mod_setup_postfix.sh | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/stack/install/ee_mod_setup_nginx.sh b/src/modules/stack/install/ee_mod_setup_nginx.sh index b280d4dc..4257c6b7 100644 --- a/src/modules/stack/install/ee_mod_setup_nginx.sh +++ b/src/modules/stack/install/ee_mod_setup_nginx.sh @@ -21,7 +21,7 @@ function ee_mod_setup_nginx() # Disable nginx version # Set custom header # SSL Settings - sed -i "s/http {/http {\n\t##\n\t# EasyEngine Settings\n\t##\n\n\tserver_tokens off;\n\treset_timedout_connection on;\n\tadd_header X-Powered-By \"EasyEngine $EE_VERSION\";\n\tadd_header rt-Fastcgi-Cache \$upstream_cache_status;\n\n\t# Limit Request\n\tlimit_req_status 403;\n\tlimit_req_zone \$binary_remote_addr zone=one:10m rate=1r\/s;\n\n\t# Proxy Settings\n\t# set_real_ip_from\tproxy-server-ip;\n\t# real_ip_header\tX-Forwarded-For;\n\n\tfastcgi_read_timeout 300;\n\tclient_max_body_size 100m;\n\n\t# SSL Settings\n\tssl_session_cache shared:SSL:20m;\n\tssl_session_timeout 10m;\n\tssl_prefer_server_ciphers on;\n\tssl_ciphers HIGH:\!aNULL:\!MD5:\!kEDH;\n\n/" /etc/nginx/nginx.conf + sed -i "s/http {/http {\n\t##\n\t# EasyEngine Settings\n\t##\n\n\tserver_tokens off;\n\treset_timedout_connection on;\n\tadd_header X-Powered-By \"EasyEngine $EE_VERSION\";\n\tadd_header rt-Fastcgi-Cache \$upstream_cache_status;\n\n\t# Limit Request\n\tlimit_req_status 403;\n\tlimit_req_zone \$binary_remote_addr zone=one:10m rate=1r\/s;\n\n\t# Proxy Settings\n\t# set_real_ip_from\tproxy-server-ip;\n\t# real_ip_header\tX-Forwarded-For;\n\n\tfastcgi_read_timeout 300;\n\tclient_max_body_size 100m;\n\n\t# SSL Settings\n\tssl_session_cache shared:SSL:20m;\n\tssl_session_timeout 10m;\n\tssl_prefer_server_ciphers on;\n\tssl_ciphers HIGH:\!aNULL:\!MD5:\!kEDH;\n\t# Fix POODLE attack\n\tssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n\n/" /etc/nginx/nginx.conf # Adjust nginx keepalive_timeout sed -i "s/keepalive_timeout.*/keepalive_timeout 30;/" /etc/nginx/nginx.conf diff --git a/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh b/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh index 2b1e62ad..b395a664 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh @@ -30,6 +30,9 @@ function ee_mod_setup_dovecot() sed -i "s/#\!include auth-sql.conf.ext/\!include auth-sql.conf.ext/" /etc/dovecot/conf.d/10-auth.conf \ || ee_lib_error "Unable to setup 10-auth.conf file, exit status = " $? + # Configuring 10-ssl.conf, Disable SSLv2 and SSLv3, Fixes POODLE Bug + sed -i "s/#ssl_protocols =.*/ssl_protocols = \!SSLv2 \!SSLv3/" /etc/dovecot/conf.d/10-ssl.conf + # Configuring dovecot-sql.conf.ext cp -v /usr/share/easyengine/mail/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext &>> $EE_COMMAND_LOG \ || ee_lib_error "Unable to copy dovecot-sql.conf.ext, exit status = " $? diff --git a/src/modules/stack/install/mail/ee_mod_setup_postfix.sh b/src/modules/stack/install/mail/ee_mod_setup_postfix.sh index bc5b81c6..8beab678 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_postfix.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_postfix.sh @@ -33,6 +33,12 @@ function ee_mod_setup_postfix() postconf -e "smtpd_relay_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination" + # Disable SSL for POODLE + postconf -e "smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3" + postconf -e "smtp_tls_mandatory_protocols=!SSLv2,!SSLv3" + postconf -e "smtpd_tls_protocols=!SSLv2,!SSLv3" + postconf -e "smtp_tls_protocols=!SSLv2,!SSLv3" + # other destination domains should be handled using virtual domains postconf -e "mydestination = localhost" From f1184894729fef0bd07ef4e58d546e5d0ef9f2bf Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 30 Oct 2014 15:25:12 +0530 Subject: [PATCH 50/80] Fix log --- src/lib/ee_lib_stack_packages.sh | 6 ++++++ src/lib/ee_lib_variables.sh | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/ee_lib_stack_packages.sh b/src/lib/ee_lib_stack_packages.sh index 332fd1f9..f5d97054 100644 --- a/src/lib/ee_lib_stack_packages.sh +++ b/src/lib/ee_lib_stack_packages.sh @@ -11,6 +11,12 @@ function ee_lib_stack_packages() if [ "$EE_PACKAGE_NAME" != "" ]; then # Export EE_DISPLAY variable to Display ee http auth after site creation. export EE_DISPLAY=false + + # Log only single time + # ee site create example.com called ee stack install nginx + # So in log file all logs written twice + export EE_LOG=false + # The following command creates its own sub-shell # and our ee_lib_error function only exit from that sub-shell # so we need to exit from parent shell also diff --git a/src/lib/ee_lib_variables.sh b/src/lib/ee_lib_variables.sh index 1d6eaf83..d74c65d1 100644 --- a/src/lib/ee_lib_variables.sh +++ b/src/lib/ee_lib_variables.sh @@ -18,7 +18,15 @@ readonly EE_VIMBADMIN_VERSION='3.0.10' # EasyEngine Date variable for backup readonly EE_DATE=$(date +%d%b%Y%H%M%S) -EE_COMMAND_LOG=/var/log/easyengine/ee.log +# Log only single time +# ee site create example.com called ee stack install nginx +# So in log file all logs written twice +if [ -n "$EE_LOG" ]; then + EE_COMMAND_LOG=/dev/null +else + EE_COMMAND_LOG=/var/log/easyengine/ee.log +fi + readonly EE_LOG_DIR=/var/log/easyengine readonly EE_ERROR_LOG=/var/log/easyengine/error.log readonly EE_LINUX_DISTRO=$(lsb_release -i |awk '{print $3}') From 6f74cba8897e542f56a911b77ec9bc786b8aa326 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 30 Oct 2014 15:29:56 +0530 Subject: [PATCH 51/80] ee stack purge will remove mysql before so in that case we dont need to through any error for removing slow_query_log databse --- src/vendor/ee_ven_remove_utils.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vendor/ee_ven_remove_utils.sh b/src/vendor/ee_ven_remove_utils.sh index 5772c4da..ec6f4067 100644 --- a/src/vendor/ee_ven_remove_utils.sh +++ b/src/vendor/ee_ven_remove_utils.sh @@ -8,6 +8,5 @@ function ee_ven_remove_utils() || ee_lib_error "Unable to remove EasyEngine (ee) admin utilities" # Drop Anemometer database - mysql -e "drop database if exists slow_query_log" \ - || ee_lib_error "Unable to drop slow_query_log database, exit status = " $? + mysql -e "drop database if exists slow_query_log" &>> $EE_COMMAND_LOG } From 2738b706b57ba6eedd5635a516adf83af15d416a Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 30 Oct 2014 15:33:32 +0530 Subject: [PATCH 52/80] Update comment --- src/lib/ee_lib_stack_packages.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/ee_lib_stack_packages.sh b/src/lib/ee_lib_stack_packages.sh index f5d97054..48f14f98 100644 --- a/src/lib/ee_lib_stack_packages.sh +++ b/src/lib/ee_lib_stack_packages.sh @@ -14,7 +14,8 @@ function ee_lib_stack_packages() # Log only single time # ee site create example.com called ee stack install nginx - # So in log file all logs written twice + # So when ee stack install nginx run in sub-shell the value of EE_COMMAND_LOG=/dev/null + # So in log file all logs written single time only export EE_LOG=false # The following command creates its own sub-shell From 36acb261cfde00d7f1adab8e629541f5c3ee5d9b Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 30 Oct 2014 16:04:42 +0530 Subject: [PATCH 53/80] Fix double autoremove message --- src/lib/ee_lib_autoremove.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ee_lib_autoremove.sh b/src/lib/ee_lib_autoremove.sh index ab10a207..bdc9ae6a 100644 --- a/src/lib/ee_lib_autoremove.sh +++ b/src/lib/ee_lib_autoremove.sh @@ -3,5 +3,5 @@ function ee_lib_autoremove() { ee_lib_echo "Removing unwanted packages, please wait..." - $EE_APT_GET autoremove | tee -ai $EE_COMMAND_LOG + $EE_APT_GET autoremove } \ No newline at end of file From 4ea54e76972cf4d4651aced8bcecc2ae56ccced8 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 30 Oct 2014 16:19:19 +0530 Subject: [PATCH 54/80] Fix log messages --- src/lib/ee_lib_stack_packages.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lib/ee_lib_stack_packages.sh b/src/lib/ee_lib_stack_packages.sh index 48f14f98..2a726bfd 100644 --- a/src/lib/ee_lib_stack_packages.sh +++ b/src/lib/ee_lib_stack_packages.sh @@ -3,6 +3,11 @@ function ee_lib_stack_packages() { local ee_stack_package + # Log only single time + # ee site create example.com called ee stack install nginx + # So when ee stack install nginx run in sub-shell the value of EE_COMMAND_LOG=/dev/null + # So in log file all logs written single time only + export EE_LOG=false for ee_stack_package in $@;do # Check NGINX installed & install if not @@ -12,12 +17,6 @@ function ee_lib_stack_packages() # Export EE_DISPLAY variable to Display ee http auth after site creation. export EE_DISPLAY=false - # Log only single time - # ee site create example.com called ee stack install nginx - # So when ee stack install nginx run in sub-shell the value of EE_COMMAND_LOG=/dev/null - # So in log file all logs written single time only - export EE_LOG=false - # The following command creates its own sub-shell # and our ee_lib_error function only exit from that sub-shell # so we need to exit from parent shell also From 47680cac73c876bedaa76849af4c4f91105b3ea0 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 30 Oct 2014 17:13:00 +0530 Subject: [PATCH 55/80] Adding Dovecot installtion to log file --- src/modules/stack/install/mail/ee_mod_install_dovecot.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/stack/install/mail/ee_mod_install_dovecot.sh b/src/modules/stack/install/mail/ee_mod_install_dovecot.sh index 09225e4b..fafb37d8 100644 --- a/src/modules/stack/install/mail/ee_mod_install_dovecot.sh +++ b/src/modules/stack/install/mail/ee_mod_install_dovecot.sh @@ -11,12 +11,13 @@ function ee_mod_install_dovecot() debconf-set-selections <<< "dovecot-core dovecot-core/create-ssl-cert boolean yes" debconf-set-selections <<< "dovecot-core dovecot-core/ssl-cert-name string $(hostname -f)" + # 2>&1 is needed as config file is written in STDEER # Debian 6 doesn't provide Dovecot 2.x if [ "$EE_DEBIAN_VERSION" == "squeeze" ]; then - $EE_APT_GET -t squeeze-backports install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved \ + $EE_APT_GET -t squeeze-backports install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved 2>&1 \ || ee_lib_error "Unable to install Dovecot, exit status = " $? else - $EE_APT_GET install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved \ + $EE_APT_GET install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved 2>&1 \ || ee_lib_error "Unable to install Dovecot, exit status = " $? fi From b4c5b25f6a69783cf2e52690dcc5502344f6d76b Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 30 Oct 2014 17:14:09 +0530 Subject: [PATCH 56/80] Fix Yoast plugin for wordpress multisite subdir setup --- config/nginx/common/wpcommon.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/nginx/common/wpcommon.conf b/config/nginx/common/wpcommon.conf index eb6c4918..91450a79 100644 --- a/config/nginx/common/wpcommon.conf +++ b/config/nginx/common/wpcommon.conf @@ -27,8 +27,10 @@ location /wp-content/uploads/ { location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ { rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent; rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last; - rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last; - rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; + + # Rules for yoast sitemap with wp|wpsubdir|wpsubdomain + rewrite ^.*/sitemap_index\.xml$ /index.php?sitemap=1 last; + rewrite ^.*/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; # Following lines are options. Needed for WordPress seo addons rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last; From 61306ce7cabfab9fa44131c9414e32cb2d6dc0ba Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 30 Oct 2014 17:29:21 +0530 Subject: [PATCH 57/80] Disable MySQL performance_schema by default #326 --- src/modules/stack/install/ee_mod_setup_mysql.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/stack/install/ee_mod_setup_mysql.sh b/src/modules/stack/install/ee_mod_setup_mysql.sh index b83ffd8a..a8ba0263 100644 --- a/src/modules/stack/install/ee_mod_setup_mysql.sh +++ b/src/modules/stack/install/ee_mod_setup_mysql.sh @@ -6,11 +6,11 @@ function ee_mod_setup_mysql() # Setting wait_timeout = 30 & interactive_timeout = 60 if [ ! -f /etc/mysql/my.cnf ]; then - echo -e "[mysqld] \nwait_timeout = 30 \ninteractive_timeout = 60" > /etc/mysql/my.cnf + echo -e "[mysqld] \nwait_timeout = 30 \ninteractive_timeout = 60 \nperformance_schema = 0" > /etc/mysql/my.cnf else grep "_timeout" /etc/mysql/my.cnf &>> $EE_COMMAND_LOG if [ $? -ne 0 ]; then - sed -i "/#max_connections/a wait_timeout = 30 \ninteractive_timeout = 60" /etc/mysql/my.cnf + sed -i "/#max_connections/a wait_timeout = 30 \ninteractive_timeout = 60 \nperformance_schema = 0" /etc/mysql/my.cnf fi fi } From 7f5b6a1d27c3c58d00513fbfdbdae3fce3bd4cff Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 30 Oct 2014 17:35:24 +0530 Subject: [PATCH 58/80] Install postfix before wp-cli for wordpress sites --- src/modules/site/ee_mod_site_packages.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/site/ee_mod_site_packages.sh b/src/modules/site/ee_mod_site_packages.sh index 9cf69368..66a19a42 100644 --- a/src/modules/site/ee_mod_site_packages.sh +++ b/src/modules/site/ee_mod_site_packages.sh @@ -17,10 +17,11 @@ function ee_mod_site_packages() ee_lib_stack_packages mysql fi + # Check & Install Postfix Packages + ee_lib_stack_packages postfix + if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then # Install WP-CLI ee_ven_install_wpcli fi - # Check & Install Postfix Packages - ee_lib_stack_packages postfix } From b3a4baebbe8a520d858b83c32e8ed59962667c4e Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 30 Oct 2014 17:38:56 +0530 Subject: [PATCH 59/80] Minor fix --- bin/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install b/bin/install index 5238f341..b26838ac 100644 --- a/bin/install +++ b/bin/install @@ -124,7 +124,7 @@ if [ -z "$BRANCH" ]; then BRANCH=stable else # Cross check EasyEngine (ee) branch name - git ls-remote --heads https://github.com/rtCamp/easyengine | grep $BRANCH &>> $EE_INSTALL_LOG + git ls-remote --heads https://github.com/rtCamp/easyengine | grep ${BRANCH}$ &>> $EE_INSTALL_LOG if [ $? -ne 0 ]; then ee_lib_error "The $BRANCH branch does not exist, please provide the correct branch name, exit status = " $? fi From 8a745e33ded04bde8f43cbec974e6bffe66ad219 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Thu, 30 Oct 2014 18:20:00 +0530 Subject: [PATCH 60/80] Minor update --- src/lib/ee_lib_variables.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/ee_lib_variables.sh b/src/lib/ee_lib_variables.sh index d74c65d1..1b5c2153 100644 --- a/src/lib/ee_lib_variables.sh +++ b/src/lib/ee_lib_variables.sh @@ -20,7 +20,8 @@ readonly EE_DATE=$(date +%d%b%Y%H%M%S) # Log only single time # ee site create example.com called ee stack install nginx -# So in log file all logs written twice +# So when ee stack install nginx run in sub-shell the value of EE_COMMAND_LOG=/dev/null +# So in log file all logs written single time only if [ -n "$EE_LOG" ]; then EE_COMMAND_LOG=/dev/null else From 25347cb40aa0b4a313a3a04919bb1805086c7ca3 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 31 Oct 2014 16:28:20 +0530 Subject: [PATCH 61/80] Fix log files --- bin/easyengine | 2 +- src/lib/ee_lib_stack_packages.sh | 2 +- src/lib/ee_lib_variables.sh | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index 425ab1b2..9d723302 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -868,7 +868,7 @@ fi } -EasyEngine $@ | tee -ai $EE_COMMAND_LOG +EasyEngine $@ | tee -ai $EE_TEE_LOG # If any command fails its return non-zero exit code [EasyEngine $@] diff --git a/src/lib/ee_lib_stack_packages.sh b/src/lib/ee_lib_stack_packages.sh index 2a726bfd..f17df84d 100644 --- a/src/lib/ee_lib_stack_packages.sh +++ b/src/lib/ee_lib_stack_packages.sh @@ -5,7 +5,7 @@ function ee_lib_stack_packages() local ee_stack_package # Log only single time # ee site create example.com called ee stack install nginx - # So when ee stack install nginx run in sub-shell the value of EE_COMMAND_LOG=/dev/null + # So when ee stack install nginx run in sub-shell the value of EE_TEE_LOG=/dev/null # So in log file all logs written single time only export EE_LOG=false diff --git a/src/lib/ee_lib_variables.sh b/src/lib/ee_lib_variables.sh index 1b5c2153..45a7cb1e 100644 --- a/src/lib/ee_lib_variables.sh +++ b/src/lib/ee_lib_variables.sh @@ -20,14 +20,15 @@ readonly EE_DATE=$(date +%d%b%Y%H%M%S) # Log only single time # ee site create example.com called ee stack install nginx -# So when ee stack install nginx run in sub-shell the value of EE_COMMAND_LOG=/dev/null +# So when ee stack install nginx run in sub-shell the value of EE_TEE_LOG=/dev/null # So in log file all logs written single time only if [ -n "$EE_LOG" ]; then - EE_COMMAND_LOG=/dev/null + EE_TEE_LOG=/dev/null else - EE_COMMAND_LOG=/var/log/easyengine/ee.log + EE_TEE_LOG=/var/log/easyengine/ee.log fi +EE_COMMAND_LOG=/var/log/easyengine/ee.log readonly EE_LOG_DIR=/var/log/easyengine readonly EE_ERROR_LOG=/var/log/easyengine/error.log readonly EE_LINUX_DISTRO=$(lsb_release -i |awk '{print $3}') From de30c680d981392aedf4d3b5cfe40e0f0502a7cd Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Mon, 3 Nov 2014 11:46:46 +0530 Subject: [PATCH 62/80] Change Fast CGI name to FastCGI --- bin/easyengine | 6 +++--- templates/nginx/wp/wpfc.conf | 2 +- templates/nginx/wpsubdir/wpfc.conf | 2 +- templates/nginx/wpsubdomain/wpfc.conf | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index 9d723302..f8513416 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -569,7 +569,7 @@ elif [ "$EE_FIRST" = "site" ]; then EE_SITE_CURRENT_WP="--wp" EE_SITE_CURRENT_CACHE="--w3tc" EE_SITE_CURRENT_TYPE="--wp --w3tc" - elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE FAST CGI" ]; then + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE FAST CGI" ] || [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE FASTCGI" ]; then EE_SITE_CURRENT_WP="--wp" EE_SITE_CURRENT_CACHE="--wpfc" EE_SITE_CURRENT_TYPE="--wp --wpfc" @@ -586,7 +586,7 @@ elif [ "$EE_FIRST" = "site" ]; then EE_SITE_CURRENT_WP="--wpsubdir" EE_SITE_CURRENT_CACHE="--w3tc" EE_SITE_CURRENT_TYPE="--wpsubdir --w3tc" - elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR FAST CGI" ]; then + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR FAST CGI" ] || [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR FASTCGI" ]; then EE_SITE_CURRENT_WP="--wpsubdir" EE_SITE_CURRENT_CACHE="--wpfc" EE_SITE_CURRENT_TYPE="--wpsubdir --wpfc" @@ -603,7 +603,7 @@ elif [ "$EE_FIRST" = "site" ]; then EE_SITE_CURRENT_WP="--wpsubdomain" EE_SITE_CURRENT_CACHE="--w3tc" EE_SITE_CURRENT_TYPE="--wpsubdomain --w3tc" - elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN FAST CGI" ]; then + elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN FAST CGI" ] || [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN FASTCGI" ]; then EE_SITE_CURRENT_WP="--wpsubdomain" EE_SITE_CURRENT_CACHE="--wpfc" EE_SITE_CURRENT_TYPE="--wpsubdomain --wpfc" diff --git a/templates/nginx/wp/wpfc.conf b/templates/nginx/wp/wpfc.conf index ba35bfae..68c33a51 100644 --- a/templates/nginx/wp/wpfc.conf +++ b/templates/nginx/wp/wpfc.conf @@ -1,4 +1,4 @@ -# WPSINGLE FAST CGI NGINX CONFIGURATION +# WPSINGLE FASTCGI NGINX CONFIGURATION server { diff --git a/templates/nginx/wpsubdir/wpfc.conf b/templates/nginx/wpsubdir/wpfc.conf index 6e59806c..556cefda 100644 --- a/templates/nginx/wpsubdir/wpfc.conf +++ b/templates/nginx/wpsubdir/wpfc.conf @@ -1,4 +1,4 @@ -# WPSUBDIR FAST CGI NGINX CONFIGURATION +# WPSUBDIR FASTCGI NGINX CONFIGURATION server { diff --git a/templates/nginx/wpsubdomain/wpfc.conf b/templates/nginx/wpsubdomain/wpfc.conf index 56e93a95..a2e02c85 100644 --- a/templates/nginx/wpsubdomain/wpfc.conf +++ b/templates/nginx/wpsubdomain/wpfc.conf @@ -1,4 +1,4 @@ -# WPSUBDOMAIN FAST CGI NGINX CONFIGURATION +# WPSUBDOMAIN FASTCGI NGINX CONFIGURATION server { From 8832246052a7bcbf16d18f5f36973d6bcb74c967 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Mon, 3 Nov 2014 15:06:32 +0530 Subject: [PATCH 63/80] Fix variable names --- bin/easyengine | 2 +- src/modules/site/ee_mod_site_backup.sh | 3 ++- .../site/update/ee_mod_update_nginx.sh | 25 ++++++++----------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index f8513416..7391a5c2 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -646,7 +646,7 @@ elif [ "$EE_FIRST" = "site" ]; then fi # Let's log site current option - ee_lib_echo_escape "EE_SITE_CURRENT_WP = $EE_SITE_CURRENT_WP \nEE_SITE_CURRENT_CACHE = $EE_SITE_CURRENT_CACHE \nEE_SITE_CURRENT_TYPE = $EE_SITE_CURRENT_TYPE \nEE_SITE_UPDATE_TYPE = $EE_SITE_UPDATE_TYPE" &>> $EE_COMMAND_LOG + ee_lib_echo_escape "EE_SITE_CURRENT_WP = $EE_SITE_CURRENT_WP \nEE_SITE_CURRENT_CACHE = $EE_SITE_CURRENT_CACHE \nEE_SITE_CURRENT_TYPE = $EE_SITE_CURRENT_TYPE \n\nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_SITE_UPDATE_TYPE = $EE_SITE_UPDATE_TYPE" &>> $EE_COMMAND_LOG # Update WordPress user password if [ "$EE_SITE_CREATE_OPTION" = "--password" ]; then diff --git a/src/modules/site/ee_mod_site_backup.sh b/src/modules/site/ee_mod_site_backup.sh index 347a00a7..13001912 100644 --- a/src/modules/site/ee_mod_site_backup.sh +++ b/src/modules/site/ee_mod_site_backup.sh @@ -16,7 +16,7 @@ function ee_mod_site_backup() || ee_lib_error "Failed: Backup NGINX configuration, exit status =" $? # Move htdocs - if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]; then + if [ "$EE_SITE_CURRENT_TYPE" = "--html" ] || [ "$EE_SITE_CURRENT_TYPE" = "--php" ] || [ "$EE_SITE_CURRENT_TYPE" = "--mysql" ]; then ee_lib_echo "Backup webroot, please wait..." mv $ee_webroot/htdocs $ee_webroot/backup/$EE_DATE/ \ || ee_lib_error "Failed: Backup webroot, exit status =" $? @@ -25,6 +25,7 @@ function ee_mod_site_backup() fi # Database backup + # Check ee-config.php or wp-config.php present if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/') ]; then local ee_db_name=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) ee_lib_echo "Backup Database, please wait..." diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index 1a6c5fc4..30c0f4c4 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -2,11 +2,8 @@ function ee_mod_update_nginx() { - # Find out information about current NGINX configuration - EE_SITE_CURRENT_OPTION=$(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) - # Git commit - ee_lib_git /etc/nginx/ "Before ee site update: $EE_DOMAIN running on $EE_SITE_CURRENT_OPTION" + ee_lib_git /etc/nginx/ "Before ee site update: $EE_DOMAIN running on $EE_SITE_CURRENT_TYPE" # Update NGINX configuration ee_lib_echo "Updating $EE_DOMAIN, please wait..." @@ -30,7 +27,7 @@ function ee_mod_update_nginx() sed -i "s'$ee_nginx_current_header'$ee_nginx_update_header'" /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? # Update NGINX conf for HTML site - if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ]; then + if [ "$EE_SITE_CURRENT_TYPE" = "--html" ]; then sed -i 's/access\.log/access.log rt_cache/' /etc/nginx/sites-available/$EE_DOMAIN && \ sed -i '/index index.html index.htm;$/c \\tindex index.php index.htm index.html;' /etc/nginx/sites-available/$EE_DOMAIN && \ sed -i '/location \/ {/,/}/d ' /etc/nginx/sites-available/$EE_DOMAIN \ @@ -55,7 +52,7 @@ function ee_mod_update_nginx() fi # Update PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) to --wpsc --w3tc --wpfc options - elif [ "$EE_SITE_CURRENT_OPTION" = "PHP" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR BASIC" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN BASIC" ]; then + elif [ "$EE_SITE_CURRENT_TYPE" = "--php" ] || [ "$EE_SITE_CURRENT_TYPE" = "--mysql" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wp --basic" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --basic" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --basic" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then sed -i 's/include common\/php.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? @@ -68,7 +65,7 @@ function ee_mod_update_nginx() fi # Update --wpsc (--wp/--wpsubdir/--wpsubdomain) to --basic --w3tc --wpfc options - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR WP SUPER CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN WP SUPER CACHE" ]; then + elif [ "$EE_SITE_CURRENT_TYPE" = "--wp --wpsc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpsc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpsc" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then sed -i 's/include common\/wpsc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? @@ -81,7 +78,7 @@ function ee_mod_update_nginx() fi # Update --w3tc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --wpfc options - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR W3 TOTAL CACHE" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN W3 TOTAL CACHE" ]; then + elif [ "$EE_SITE_CURRENT_TYPE" = "--wp --w3tc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --w3tc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --w3tc" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then sed -i 's/include common\/w3tc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? @@ -94,7 +91,7 @@ function ee_mod_update_nginx() fi # Update --wpfc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --w3tc options - elif [ "$EE_SITE_CURRENT_OPTION" = "WPSINGLE FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDIR FAST CGI" ] || [ "$EE_SITE_CURRENT_OPTION" = "WPSUBDOMAIN FAST CGI" ]; then + elif [ "$EE_SITE_CURRENT_TYPE" = "--wp --wpfc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpfc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpfc" ]; then if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then sed -i 's/include common\/wpfc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? @@ -108,7 +105,7 @@ function ee_mod_update_nginx() fi # Add WordPress common file wpcommon.conf for HTML PHP & MYSQL sites - if [[ "$EE_SITE_CURRENT_OPTION" = "HTML" || "$EE_SITE_CURRENT_OPTION" = "PHP" || "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]] && \ + if [[ "$EE_SITE_CURRENT_TYPE" = "--html" || "$EE_SITE_CURRENT_TYPE" = "--php" || "$EE_SITE_CURRENT_TYPE" = "--mysql" ]] && \ [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]]; then sed -i '/include common\/locations.conf/i \\tinclude common\/wpcommon.conf;' /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? fi @@ -116,10 +113,10 @@ function ee_mod_update_nginx() # Update server_name for HTML PHP MYSQL WP (single site) only # Don't execute for WordPress Multisite if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] \ - && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR BASIC" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN BASIC" ] \ - && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR WP SUPER CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN WP SUPER CACHE" ] \ - && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR W3 TOTAL CACHE" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN W3 TOTAL CACHE" ] \ - && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDIR FAST CGI" ] && [ "$EE_SITE_CURRENT_OPTION" != "WPSUBDOMAIN FAST CGI" ]; then + && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --basic" ] && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --basic" ] \ + && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpsc" ] && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpsc" ] \ + && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --w3tc" ] && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --w3tc" ] \ + && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpfc" ] && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpfc" ]; then sed -i "s'server_name $EE_DOMAIN www.$EE_DOMAIN;'server_name $EE_DOMAIN *.$EE_DOMAIN;'" /etc/nginx/sites-available/$EE_DOMAIN && \ sed -i '/server_name.*;/i \\t# Uncomment the following line for domain mapping;\n\t# listen 80 default_server;\n' /etc/nginx/sites-available/$EE_DOMAIN && \ From 59ed59290ff258901a991316f344e8257e4259dc Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Mon, 3 Nov 2014 16:00:29 +0530 Subject: [PATCH 64/80] Fix wpsc.conf typo mistake --- src/modules/site/update/ee_mod_update_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/site/update/ee_mod_update_nginx.sh b/src/modules/site/update/ee_mod_update_nginx.sh index 30c0f4c4..aa5156fe 100644 --- a/src/modules/site/update/ee_mod_update_nginx.sh +++ b/src/modules/site/update/ee_mod_update_nginx.sh @@ -70,7 +70,7 @@ function ee_mod_update_nginx() sed -i 's/include common\/wpsc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then - sed -i 's/include common\/wpfc.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ + sed -i 's/include common\/wpsc.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ || ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then sed -i 's/include common\/wpsc.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ From d00493bad32f51947ee101d1232904f26ccd6283 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Wed, 5 Nov 2014 12:58:15 +0530 Subject: [PATCH 65/80] Added Ubuntu 14.10 support --- bin/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/install b/bin/install index b26838ac..38ff5d48 100644 --- a/bin/install +++ b/bin/install @@ -52,9 +52,9 @@ if [ "$EE_LINUX_DISTRO" != "Ubuntu" ] && [ "$EE_LINUX_DISTRO" != "Debian" ]; the fi # EasyEngine (ee) only support all Ubuntu/Debian distro except the distro reached EOL -lsb_release -d | egrep -e "12.04|14.04|squeeze|wheezy" &>> /dev/null +lsb_release -d | egrep -e "12.04|14.04|14.10|squeeze|wheezy" &>> /dev/null if [ "$?" -ne "0" ]; then - ee_lib_echo_fail "EasyEngine (ee) only support Ubuntu 12.04/14.04 and Debian 6.x/7.x" + ee_lib_echo_fail "EasyEngine (ee) only support Ubuntu 12.04/14.04/14.10 and Debian 6.x/7.x" exit 100 fi From c82dd14a8fa164bd58fdf715568e13fc7566e68c Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 14:14:01 +0530 Subject: [PATCH 66/80] Fixed Swap file permission --- src/lib/ee_lib_swap.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/ee_lib_swap.sh b/src/lib/ee_lib_swap.sh index 5f9edba0..f375afac 100644 --- a/src/lib/ee_lib_swap.sh +++ b/src/lib/ee_lib_swap.sh @@ -24,6 +24,11 @@ function ee_lib_swap() # Add entry into /etc/fstab echo "/ee-swapfile none swap sw 0 0" >> /etc/fstab \ || ee_lib_error "Unable to add entry into /etc/fstab, exit status = " $? + + # Change Permission for swapfile + chown root:root /ee-swapfile && + chmod 0600 /ee-swapfile \ + || ee_lib_error "Unable to change Swapfile permission, exit status = " $? fi fi } From 8dd2535c662488798f45432dd28f3dd1309a40ad Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 14:16:14 +0530 Subject: [PATCH 67/80] Fixed Swap file permission --- src/lib/ee_lib_swap.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/ee_lib_swap.sh b/src/lib/ee_lib_swap.sh index f375afac..1cb20de7 100644 --- a/src/lib/ee_lib_swap.sh +++ b/src/lib/ee_lib_swap.sh @@ -17,6 +17,11 @@ function ee_lib_swap() mkswap /ee-swapfile &>> $EE_COMMAND_LOG \ || ee_lib_error "Unable to create swapfile, exit status = " $? + # Change Permission for swapfile + chown root:root /ee-swapfile && + chmod 0600 /ee-swapfile \ + || ee_lib_error "Unable to change Swapfile permission, exit status = " $? + # On the Swap swapon /ee-swapfile &>> $EE_COMMAND_LOG \ || ee_lib_error "Unable to on Swap, exit status = " $? @@ -24,11 +29,6 @@ function ee_lib_swap() # Add entry into /etc/fstab echo "/ee-swapfile none swap sw 0 0" >> /etc/fstab \ || ee_lib_error "Unable to add entry into /etc/fstab, exit status = " $? - - # Change Permission for swapfile - chown root:root /ee-swapfile && - chmod 0600 /ee-swapfile \ - || ee_lib_error "Unable to change Swapfile permission, exit status = " $? fi fi } From 406048494b9d8053b655e958d565c384bc565684 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 14:34:10 +0530 Subject: [PATCH 68/80] Fixed Poodle bug issue for Ubuntu 12.04 --- .../stack/install/mail/ee_mod_setup_dovecot.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh b/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh index b395a664..76126c8e 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh @@ -22,7 +22,7 @@ function ee_mod_setup_dovecot() # Configuring 10-mail.conf sed -i "s/mail_location = mbox:~\/mail:INBOX=\/var\/mail\/%u/mail_location = maildir:\/var\/vmail\/%d\/%n/" /etc/dovecot/conf.d/10-mail.conf \ || ee_lib_error "Unable to configure Dovecot mail_location, exit status = " $? - + # Configuring 10-auth.conf sed -i "s/#disable_plaintext_auth = yes/disable_plaintext_auth = no/" /etc/dovecot/conf.d/10-auth.conf && \ sed -i "s/auth_mechanisms = plain/auth_mechanisms = plain login/" /etc/dovecot/conf.d/10-auth.conf && \ @@ -31,7 +31,14 @@ function ee_mod_setup_dovecot() || ee_lib_error "Unable to setup 10-auth.conf file, exit status = " $? # Configuring 10-ssl.conf, Disable SSLv2 and SSLv3, Fixes POODLE Bug - sed -i "s/#ssl_protocols =.*/ssl_protocols = \!SSLv2 \!SSLv3/" /etc/dovecot/conf.d/10-ssl.conf + grep ssl_protocols /etc/dovecot/conf.d/10-ssl.conf &>> $EE_COMMAND_LOG + if [ $? -eq 0 ]; then + # For Ubuntu 14.04, Debian 6 and Debian 7 10-ssl.conf file contains commented #ssl_protocol variable + sed -i "s/#ssl_protocols =.*/ssl_protocols = \!SSLv2 \!SSLv3/" /etc/dovecot/conf.d/10-ssl.conf + else + # For Ubuntu 12.04 10-ssl.conf file does not contain commented #ssl-protocols variable + echo 'ssl_protocols = !SSLv2 !SSLv3' >> /etc/dovecot/conf.d/10-ssl.conf + fi # Configuring dovecot-sql.conf.ext cp -v /usr/share/easyengine/mail/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext &>> $EE_COMMAND_LOG \ From 9540be5b1b42b49d9e9cf951ce62b6f16f10451a Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 15:01:12 +0530 Subject: [PATCH 69/80] Fixed Travis Ref:https://github.com/travis-ci/travis-ci/issues/2934 --- .travis.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index e96328bc..68678607 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ language: bash before_install: - +- chmod 066 ~/.gnupg/gpg.conf before_script: - sudo apt-get -qq purge mysql* graphviz* @@ -40,7 +40,7 @@ script: - sudo bash ee site create site2.com --wpsc - sudo bash ee site create site2.net --wp --wpsc -- sudo bash ee site create site2.org --wpsc --wp +- sudo bash ee site create site2.org --wpsc --wp - sudo bash ee site create site3.com --w3tc - sudo bash ee site create site3.net --wp --w3tc @@ -48,7 +48,7 @@ script: - sudo bash ee site create site4.com --wpfc - sudo bash ee site create site4.net --wp --wpfc -- sudo bash ee site create site4.org --wpfc --wp +- sudo bash ee site create site4.org --wpfc --wp - sudo bash ee site create site5.com --wpsubdir - sudo bash ee site create site5.net --wpsubdir --basic @@ -100,9 +100,9 @@ script: - sudo bash ee debug --nginx site1.com - sudo bash ee debug --nginx site1.com --stop -- sudo bash ee debug -rewrite +- sudo bash ee debug -rewrite - sudo bash ee debug -rewrite --stop -- sudo bash ee debug -rewrite site1.com +- sudo bash ee debug -rewrite site1.com - sudo bash ee debug -rewrite site1.com --stop - sudo bash ee debug --php @@ -148,4 +148,3 @@ script: - sudo wp --allow-root --info - From 517c2f023b0aa4c619dd8f71e37be4be54551960 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 15:38:23 +0530 Subject: [PATCH 70/80] Fixed Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 68678607..bda58e9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ language: bash before_install: -- chmod 066 ~/.gnupg/gpg.conf +- chmod 600 ~/.gnupg/gpg.conf before_script: - sudo apt-get -qq purge mysql* graphviz* From 71a3562c211ca019acaaa83a0f85fd5a78e0779c Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 16:49:56 +0530 Subject: [PATCH 71/80] Fixed Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bda58e9d..b1a89d48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ language: bash before_install: -- chmod 600 ~/.gnupg/gpg.conf +- sudo bash -c 'chmod 600 /root/.gnupg/gpg.conf' before_script: - sudo apt-get -qq purge mysql* graphviz* From 7394c8ba9e9ccccf11e168b2345086a1ae034a2e Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 16:52:48 +0530 Subject: [PATCH 72/80] Fixed Travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b1a89d48..2c65bbbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,8 @@ language: bash before_install: -- sudo bash -c 'chmod 600 /root/.gnupg/gpg.conf' +- chmod 600 ~/.gnupg/gpg.conf +- ls -al ~/.gnupg/gpg.conf before_script: - sudo apt-get -qq purge mysql* graphviz* From 8d916d045dfc31718d50a8317639bdd83f7ab7f4 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 16:57:28 +0530 Subject: [PATCH 73/80] Fixed Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2c65bbbb..2d469844 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ language: bash before_install: +- ls -al ~/.gnupg/gpg.conf - chmod 600 ~/.gnupg/gpg.conf - ls -al ~/.gnupg/gpg.conf From e7a4c805154891d45d830d53875377364603b7ea Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 17:04:17 +0530 Subject: [PATCH 74/80] Fixed Travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2d469844..8b7be13b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ before_install: - ls -al ~/.gnupg/gpg.conf - chmod 600 ~/.gnupg/gpg.conf - ls -al ~/.gnupg/gpg.conf +- sudo chown travis:travis ~/.gnupg/gpg.conf +- ls -al ~/.gnupg/gpg.conf before_script: - sudo apt-get -qq purge mysql* graphviz* From 460cdfcf2e2fff2737e084897ef6ce263cd3eac2 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 17:37:30 +0530 Subject: [PATCH 75/80] Fixed Travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8b7be13b..b27b35e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,8 @@ before_install: - ls -al ~/.gnupg/gpg.conf - sudo chown travis:travis ~/.gnupg/gpg.conf - ls -al ~/.gnupg/gpg.conf +- sudo chgrp -R travis ~/.gnupg +- ls -al ~/.gnupg/gpg.conf before_script: - sudo apt-get -qq purge mysql* graphviz* From 1a592d80ed976a63a7fdfa21b72a83631f96ea4b Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 17:50:03 +0530 Subject: [PATCH 76/80] Fixed Travis --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b27b35e2..0df1e3e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,12 +11,10 @@ language: bash before_install: -- ls -al ~/.gnupg/gpg.conf +- sudo chown -R travis ~travis/.gnupg - chmod 600 ~/.gnupg/gpg.conf - ls -al ~/.gnupg/gpg.conf -- sudo chown travis:travis ~/.gnupg/gpg.conf -- ls -al ~/.gnupg/gpg.conf -- sudo chgrp -R travis ~/.gnupg +- chmod 700 ~/.gnupg - ls -al ~/.gnupg/gpg.conf before_script: From 20641b93a504bff92ae7061243f62d2b82a36fdf Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 5 Nov 2014 19:01:46 +0530 Subject: [PATCH 77/80] Fixed Travis.. finnaly.. --- .travis.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0df1e3e0..ad15332d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,20 +8,13 @@ notifications: language: bash - - before_install: -- sudo chown -R travis ~travis/.gnupg -- chmod 600 ~/.gnupg/gpg.conf -- ls -al ~/.gnupg/gpg.conf -- chmod 700 ~/.gnupg -- ls -al ~/.gnupg/gpg.conf +- rm -rf ~/.gnupg before_script: - sudo apt-get -qq purge mysql* graphviz* - sudo apt-get -qq autoremove - script: - sudo echo -e "[user]\n\tname = Mitesh Shah\n\temail = root@localhost.com" > ~/.gitconfig - sudo echo "Travis Banch = $TRAVIS_BRANCH" From 30cfd57826b605af6438b6a341dc0f990e362a94 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 6 Nov 2014 13:16:31 +0530 Subject: [PATCH 78/80] Fixed PHP log issue --- src/modules/stack/install/ee_mod_install_php.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/stack/install/ee_mod_install_php.sh b/src/modules/stack/install/ee_mod_install_php.sh index db30fadd..a3738ef7 100644 --- a/src/modules/stack/install/ee_mod_install_php.sh +++ b/src/modules/stack/install/ee_mod_install_php.sh @@ -5,5 +5,5 @@ function ee_mod_install_php() ee_lib_echo "Installing PHP, please wait..." $EE_APT_GET install php5-common php5-mysqlnd php5-xmlrpc \ php5-curl php5-gd php5-cli php5-fpm php5-imap php5-mcrypt php5-xdebug \ - php5-memcache memcached php5-geoip || ee_lib_error "Unable to install PHP5, exit status = " $? + php5-memcache memcached php5-geoip 2>&1 || ee_lib_error "Unable to install PHP5, exit status = " $? } From b31b501233dbb1b2aa8b605539fe8d3d2985c36e Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 6 Nov 2014 16:36:37 +0530 Subject: [PATCH 79/80] Removed from wpsc.conf #330 --- config/nginx/common/wpsc.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/nginx/common/wpsc.conf b/config/nginx/common/wpsc.conf index ccbb4216..26982e3d 100644 --- a/config/nginx/common/wpsc.conf +++ b/config/nginx/common/wpsc.conf @@ -24,7 +24,9 @@ if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_lo # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { - try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php$args; + # If we add index.php?$args its break WooCommerce like plugins + # Ref: #330 + try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php; } location ~ \.php$ { From 4cdf055ec442d28cdbb73b5d79034987c5590579 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 6 Nov 2014 16:48:48 +0530 Subject: [PATCH 80/80] Display DB_HOST in ee site info --- src/modules/site/ee_mod_site_info.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/site/ee_mod_site_info.sh b/src/modules/site/ee_mod_site_info.sh index fdbff096..805c8d51 100644 --- a/src/modules/site/ee_mod_site_info.sh +++ b/src/modules/site/ee_mod_site_info.sh @@ -7,7 +7,7 @@ function ee_mod_site_info() local ee_access_log=$(grep access_log /etc/nginx/sites-available/$EE_DOMAIN | grep "/var/log/nginx/" | awk '{print($2)}' | cut -d ';' -f1) local ee_error_log=$(grep error_log /etc/nginx/sites-available/$EE_DOMAIN | grep "/var/log/nginx/" | awk '{print($2)}' | cut -d ';' -f1) local ee_webroot=$(grep root /etc/nginx/sites-available/$EE_DOMAIN | grep htdocs | awk '{print($2)}' | cut -d ';' -f1) - + ee_lib_echo "Information about $EE_DOMAIN:" ee_lib_echo_escape "\nNginx configuration\t \033[37m$ee_site_info ($ee_site_status)" ee_lib_echo_escape "access_log\t\t \033[37m$ee_access_log" @@ -16,17 +16,19 @@ function ee_mod_site_info() if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/') ]; then local ee_db_name=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) + local ee_db_host=$(grep DB_HOST $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) local ee_db_user=$(grep DB_USER $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) local ee_db_pass=$(grep DB_PASS $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) + ee_lib_echo_escape "DB_HOST\t\t\t \033[37m$ee_db_host" ee_lib_echo_escape "DB_NAME\t\t\t \033[37m$ee_db_name" ee_lib_echo_escape "DB_USER\t\t\t \033[37m$ee_db_user" ee_lib_echo_escape "DB_PASS\t\t\t \033[37m$ee_db_pass" - + if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/wp-config.php/') ]; then local ee_table_prefix=$(grep table_prefix $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/wp-config.php/') | cut -d"'" -f2) ee_lib_echo_escape "table_prefix\t\t \033[37m$ee_table_prefix" - fi + fi fi }