Browse Source

Merge Next branch

next
gau1991 10 years ago
parent
commit
13cd5c16f9
  1. 21
      .travis.yml
  2. 312
      bin/easyengine
  3. 6
      bin/install
  4. 2
      config/bash_completion.d/ee
  5. 6
      config/nginx/common/wpcommon.conf
  6. 4
      config/nginx/common/wpsc.conf
  7. 2
      src/lib/ee_lib_autoremove.sh
  8. 6
      src/lib/ee_lib_stack_packages.sh
  9. 5
      src/lib/ee_lib_swap.sh
  10. 10
      src/lib/ee_lib_variables.sh
  11. 35
      src/modules/site/create/ee_mod_plugin_settings.sh
  12. 20
      src/modules/site/create/ee_mod_setup_wordpress.sh
  13. 37
      src/modules/site/ee_mod_site_backup.sh
  14. 2
      src/modules/site/ee_mod_site_info.sh
  15. 11
      src/modules/site/ee_mod_site_option.sh
  16. 5
      src/modules/site/ee_mod_site_packages.sh
  17. 13
      src/modules/site/update/ee_mod_site_update_password.sh
  18. 93
      src/modules/site/update/ee_mod_update_domain.sh
  19. 129
      src/modules/site/update/ee_mod_update_nginx.sh
  20. 31
      src/modules/site/update/ee_mod_update_plugins.sh
  21. 90
      src/modules/site/update/ee_mod_update_website.sh
  22. 2
      src/modules/stack/install/ee_mod_install_php.sh
  23. 4
      src/modules/stack/install/ee_mod_setup_mysql.sh
  24. 2
      src/modules/stack/install/ee_mod_setup_nginx.sh
  25. 5
      src/modules/stack/install/mail/ee_mod_install_dovecot.sh
  26. 10
      src/modules/stack/install/mail/ee_mod_setup_dovecot.sh
  27. 7
      src/modules/stack/install/mail/ee_mod_setup_postfix.sh
  28. 5
      src/vendor/ee_ven_install_vimbadmin.sh
  29. 3
      src/vendor/ee_ven_remove_utils.sh
  30. 2
      templates/nginx/wp/wpfc.conf
  31. 2
      templates/nginx/wpsubdir/wpfc.conf
  32. 2
      templates/nginx/wpsubdomain/wpfc.conf

21
.travis.yml

@ -8,16 +8,13 @@ notifications:
language: bash language: bash
before_install: before_install:
- rm -rf ~/.gnupg
before_script: before_script:
- sudo apt-get -qq purge mysql* graphviz* - sudo apt-get -qq purge mysql* graphviz*
- sudo apt-get -qq autoremove - sudo apt-get -qq autoremove
script: script:
- sudo echo -e "[user]\n\tname = Mitesh Shah\n\temail = root@localhost.com" > ~/.gitconfig - sudo echo -e "[user]\n\tname = Mitesh Shah\n\temail = root@localhost.com" > ~/.gitconfig
- sudo echo "Travis Banch = $TRAVIS_BRANCH" - sudo echo "Travis Banch = $TRAVIS_BRANCH"
@ -133,21 +130,6 @@ script:
- sudo bash ee site update 1.com --wp - sudo bash ee site update 1.com --wp
- sudo bash ee site update 2.com --wpsubdir - 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.com --no-prompt
- sudo ee site delete site12.net --no-prompt - sudo ee site delete site12.net --no-prompt
@ -163,4 +145,3 @@ script:
- sudo wp --allow-root --info - sudo wp --allow-root --info

312
bin/easyengine

@ -425,7 +425,7 @@ elif [ "$EE_FIRST" = "site" ]; then
ee_mod_setup_database ee_mod_setup_database
# Add Database Information On ee-config.php # Add Database Information On ee-config.php
echo -e "<?php \ndefine('DB_NAME', '$EE_DB_NAME'); \ndefine('DB_USER', '$EE_DB_USER'); \ndefine('DB_PASSWORD', '$EE_DB_PASS'); \ndefine('DB_HOST', '$EE_MYSQL_HOST'); \n?>" \ echo -e "<?php \ndefine('DB_NAME', '$EE_DB_NAME'); \ndefine('DB_USER', '$EE_DB_USER'); \ndefine('DB_PASSWORD', '$EE_DB_PASS'); \ndefine('DB_HOST', '$EE_MYSQL_HOST');\n?>" \
&>> /var/www/$EE_DOMAIN/ee-config.php &>> /var/www/$EE_DOMAIN/ee-config.php
fi fi
@ -444,9 +444,6 @@ elif [ "$EE_FIRST" = "site" ]; then
ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" 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 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 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 # Configure variable
EE_NGINX_CONF=$(echo $EE_SITE_CREATE_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
@ -459,22 +456,6 @@ elif [ "$EE_FIRST" = "site" ]; then
# Setup WordPress # Setup WordPress
ee_mod_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 # Adjust permission
ee_lib_permissions ee_lib_permissions
@ -496,38 +477,8 @@ elif [ "$EE_FIRST" = "site" ]; then
ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS"
echo echo
# Configure WordPress plugin settings # Display WordPress cache plugin settings
if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then ee_mod_plugin_settings
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 Success Message # Display Success Message
ee_lib_echo_info "Successfully created new website: http://$EE_WWW_DOMAIN" ee_lib_echo_info "Successfully created new website: http://$EE_WWW_DOMAIN"
@ -585,140 +536,148 @@ elif [ "$EE_FIRST" = "site" ]; then
# Check the website name is empty or not # Check the website name is empty or not
ee_lib_check_domain ee_lib_check_domain
# Check the website exist
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 = " $?
# Update WordPress user password
if [ "$EE_SITE_CREATE_OPTION" = "--password" ]; then
ee_mod_site_update_password
else
# Auto switch site options # Auto switch site options
ee_mod_site_option 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) # Let's use variable name as per action
if [ "$EE_SITE_CREATE_OPTION" = "--html" ] || [ "$EE_SITE_CREATE_OPTION" = "--php" ] || [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then # EE_SITE_CREATE_OPTION=$EE_SITE_CREATE_OPTION
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
# Install required packages # Check the website exist or not
ee_mod_site_packages ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null \
|| ee_lib_error "The $EE_DOMAIN does not exist, exit status = " $?
# Lets update HTML|PHP|MySQL website
if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]; then # Find out information about current NGINX configuration
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)
# Update NGINX configuration for $EE_DOMAIN # Detect current website type and cache
if [[ "$EE_SITE_CREATE_OPTION" = "--php" && "$EE_SITE_CURRENT_OPTION" != "PHP" ]] || [[ "$EE_SITE_CREATE_OPTION" = "--mysql" && "$EE_SITE_CURRENT_OPTION" != "MYSQL" ]] \ if [ "$EE_SITE_CURRENT_TYPE" = "HTML" ]; then
|| [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then EE_SITE_CURRENT_TYPE="--html"
ee_mod_update_domain elif [ "$EE_SITE_CURRENT_TYPE" = "PHP" ]; then
else EE_SITE_CURRENT_TYPE="--php"
ee_lib_error "$EE_DOMAIN already with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options, exit status" $? elif [ "$EE_SITE_CURRENT_TYPE" = "MYSQL" ]; then
fi EE_SITE_CURRENT_TYPE="--mysql"
# Single WordPress
# Setup WordPress elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE BASIC" ]; then
if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then EE_SITE_CURRENT_WP="--wp"
if [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ]; then EE_SITE_CURRENT_CACHE="--basic"
# 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_SITE_CURRENT_TYPE="--wp --basic"
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) elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE WP SUPER CACHE" ]; then
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_SITE_CURRENT_WP="--wp"
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) 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" ] || [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE FASTCGI" ]; 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" ] || [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR FASTCGI" ]; 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" ] || [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN FASTCGI" ]; 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"
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
# WordPress subdirectory
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
# WordPress subdomain
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
ee_mod_setup_wordpress
fi fi
# Setup WordPress Network # Let's log site current option
if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then 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
ee_mod_setup_network
fi
# Install WordPress plugins # Update WordPress user password
if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then if [ "$EE_SITE_CREATE_OPTION" = "--password" ]; then
ee_mod_plugin_nginx_helper ee_mod_site_update_password
fi # Lets update HTML|PHP website
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
# Update cache plugins elif [[ "$EE_SITE_CURRENT_TYPE" = "--mysql" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then
ee_mod_update_plugins # Lets call update function
ee_mod_update_website
# Setup MySQL database elif [[ "$EE_SITE_CURRENT_WP" = "--wp" ]] \
if [[ "$EE_SITE_CREATE_OPTION" = "--mysql" && "$EE_SITE_CURRENT_OPTION" != "MYSQL" ]]; 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
ee_mod_setup_database # Lets call update function
ee_mod_update_website
# Add Database Information On ee-config.php elif [[ "$EE_SITE_CURRENT_WP" = "--wpsubdir" ]] \
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');" \ && [[ "$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
&>> /var/www/$EE_DOMAIN/ee-config.php # Lets call update function
fi ee_mod_update_website
if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then elif [[ "$EE_SITE_CURRENT_WP" = "--wpsubdomain" ]] \
# Display WordPress credential && [[ "$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
echo # Lets call update function
ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" ee_mod_update_website
ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS"
echo
fi 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" ]] \ if [ "$EE_UPDATE_WEBSITE" = "success" ]; then
|| [[ "$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
else
ee_lib_error "Invalid update option, exit status =" $?
fi
# Adjust permission # Adjust permission
ee_lib_permissions ee_lib_permissions
@ -730,7 +689,12 @@ elif [ "$EE_FIRST" = "site" ]; then
# Display Success Message # Display Success Message
ee_lib_echo_info "Successfully Updated Website: http://$EE_WWW_DOMAIN" 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 fi
elif [ "$EE_SECOND" = "log" ]; then elif [ "$EE_SECOND" = "log" ]; then
# Display logs for websites # Display logs for websites
ee_mod_site_log ${@:3} ee_mod_site_log ${@:3}
@ -886,8 +850,8 @@ elif [ "$EE_FIRST" = "import-slow-log" ];then
# EasyEngine update # EasyEngine update
elif [ "$EE_FIRST" = "update" ]; then elif [ "$EE_FIRST" = "update" ]; then
ee_lib_echo "Checking EasyEngine(ee) update, please wait..." ee_lib_echo "Run following command to update EasyEngine"
wget --no-check-certificate -qO eeup http://rt.cx/eeup && sudo bash eeup ee_lib_echo_info "wget --no-check-certificate -qO eeup http://rt.cx/eeup && sudo bash eeup"
else else
ee_lib_echo "EasyEngine (ee) commands:" ee_lib_echo "EasyEngine (ee) commands:"
@ -904,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 $@] # If any command fails its return non-zero exit code [EasyEngine $@]

6
bin/install

@ -52,9 +52,9 @@ if [ "$EE_LINUX_DISTRO" != "Ubuntu" ] && [ "$EE_LINUX_DISTRO" != "Debian" ]; the
fi fi
# EasyEngine (ee) only support all Ubuntu/Debian distro except the distro reached EOL # 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 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 exit 100
fi fi
@ -124,7 +124,7 @@ if [ -z "$BRANCH" ]; then
BRANCH=stable BRANCH=stable
else else
# Cross check EasyEngine (ee) branch name # 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 if [ $? -ne 0 ]; then
ee_lib_error "The $BRANCH branch does not exist, please provide the correct branch name, exit status = " $? ee_lib_error "The $BRANCH branch does not exist, please provide the correct branch name, exit status = " $?
fi fi

2
config/bash_completion.d/ee

@ -115,7 +115,7 @@ function EE_AUTO()
if [ "$PREVIOUS2" = "create" ]; then if [ "$PREVIOUS2" = "create" ]; then
COMPREPLY=( $( compgen -W "--html --php --mysql --wp --wpsubdir --wpsubdomain" -- $CURRENT ) ) COMPREPLY=( $( compgen -W "--html --php --mysql --wp --wpsubdir --wpsubdomain" -- $CURRENT ) )
elif [ "$PREVIOUS2" = "update" ]; then 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 elif [ "$PREVIOUS2" = "delete" ]; then
COMPREPLY=( $( compgen -W "--db --all --files --no-prompt" -- $CURRENT ) ) COMPREPLY=( $( compgen -W "--db --all --files --no-prompt" -- $CURRENT ) )
fi fi

6
config/nginx/common/wpcommon.conf

@ -27,8 +27,10 @@ location /wp-content/uploads/ {
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ { location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent; rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last; 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 # Following lines are options. Needed for WordPress seo addons
rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last; rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last;

4
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 # Use cached or actual file if they exists, Otherwise pass request to WordPress
location / { 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$ { location ~ \.php$ {

2
src/lib/ee_lib_autoremove.sh

@ -3,5 +3,5 @@
function ee_lib_autoremove() function ee_lib_autoremove()
{ {
ee_lib_echo "Removing unwanted packages, please wait..." ee_lib_echo "Removing unwanted packages, please wait..."
$EE_APT_GET autoremove | tee -ai $EE_COMMAND_LOG $EE_APT_GET autoremove
} }

6
src/lib/ee_lib_stack_packages.sh

@ -3,6 +3,11 @@
function ee_lib_stack_packages() function ee_lib_stack_packages()
{ {
local ee_stack_package 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_TEE_LOG=/dev/null
# So in log file all logs written single time only
export EE_LOG=false
for ee_stack_package in $@;do for ee_stack_package in $@;do
# Check NGINX installed & install if not # Check NGINX installed & install if not
@ -11,6 +16,7 @@ function ee_lib_stack_packages()
if [ "$EE_PACKAGE_NAME" != "" ]; then if [ "$EE_PACKAGE_NAME" != "" ]; then
# Export EE_DISPLAY variable to Display ee http auth after site creation. # Export EE_DISPLAY variable to Display ee http auth after site creation.
export EE_DISPLAY=false export EE_DISPLAY=false
# The following command creates its own sub-shell # The following command creates its own sub-shell
# and our ee_lib_error function only exit from that sub-shell # and our ee_lib_error function only exit from that sub-shell
# so we need to exit from parent shell also # so we need to exit from parent shell also

5
src/lib/ee_lib_swap.sh

@ -17,6 +17,11 @@ function ee_lib_swap()
mkswap /ee-swapfile &>> $EE_COMMAND_LOG \ mkswap /ee-swapfile &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to create swapfile, exit status = " $? || 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 # On the Swap
swapon /ee-swapfile &>> $EE_COMMAND_LOG \ swapon /ee-swapfile &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to on Swap, exit status = " $? || ee_lib_error "Unable to on Swap, exit status = " $?

10
src/lib/ee_lib_variables.sh

@ -18,6 +18,16 @@ readonly EE_VIMBADMIN_VERSION='3.0.10'
# EasyEngine Date variable for backup # EasyEngine Date variable for backup
readonly EE_DATE=$(date +%d%b%Y%H%M%S) 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_TEE_LOG=/dev/null
# So in log file all logs written single time only
if [ -n "$EE_LOG" ]; then
EE_TEE_LOG=/dev/null
else
EE_TEE_LOG=/var/log/easyengine/ee.log
fi
EE_COMMAND_LOG=/var/log/easyengine/ee.log EE_COMMAND_LOG=/var/log/easyengine/ee.log
readonly EE_LOG_DIR=/var/log/easyengine readonly EE_LOG_DIR=/var/log/easyengine
readonly EE_ERROR_LOG=/var/log/easyengine/error.log readonly EE_ERROR_LOG=/var/log/easyengine/error.log

35
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
}

20
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 # else current mysql site is to be updated
if [ "$EE_DB_NAME" = "" ] && [ "$EE_DB_USER" = "" ] && [ "$EE_DB_PASS" = "" ]; then if [ "$EE_DB_NAME" = "" ] && [ "$EE_DB_USER" = "" ] && [ "$EE_DB_PASS" = "" ]; then
ee_mod_setup_database 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 fi
# Default WordPress prefix or custom prefix # Default WordPress prefix or custom prefix
@ -121,4 +124,21 @@ function ee_mod_setup_wordpress()
ee_lib_echo "Updating WordPress permalink, please wait..." ee_lib_echo "Updating WordPress permalink, please wait..."
wp rewrite structure --allow-root /%year%/%monthnum%/%day%/%postname%/ &>> $EE_COMMAND_LOG \ 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 = " $? || 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
} }

37
src/modules/site/ee_mod_site_backup.sh

@ -5,33 +5,40 @@ function ee_mod_site_backup()
# Backup directory setup # Backup directory setup
local ee_webroot=$(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/\/htdocs//') 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 if [ ! -d $ee_webroot/backup/$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 =" $? mkdir -p $ee_webroot/backup/$EE_DATE || ee_lib_error "Fail to create backup directory, exit status =" $?
fi 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 # Move htdocs
if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then if [ "$EE_SITE_CURRENT_TYPE" = "--html" ] || [ "$EE_SITE_CURRENT_TYPE" = "--php" ] || [ "$EE_SITE_CURRENT_TYPE" = "--mysql" ]; then
ee_lib_echo "Backup webroot at $ee_webroot/backup/htdocs/$EE_DATE/, please wait..." ee_lib_echo "Backup webroot, 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 =" $? mv $ee_webroot/htdocs $ee_webroot/backup/$EE_DATE/ \
mkdir -p $ee_webroot/htdocs || 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 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 # 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 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_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..." ee_lib_echo "Backup Database, please wait..."
mysqldump $ee_db_name > $ee_webroot/backup/db/$EE_DATE/${ee_db_name}.sql \ mysqldump $ee_db_name > $ee_webroot/backup/$EE_DATE/${ee_db_name}.sql \
|| ee_lib_error "Unable to dump ${ee_db_name}, exit status =" $? || ee_lib_error "Failed: Backup Database, exit status =" $?
# Move ee-config.php and copy wp-config.php to backup # Move ee-config.php and copy wp-config.php to backup
if [ -f $ee_webroot/ee-config.php ]; then 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 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
fi fi
} }

2
src/modules/site/ee_mod_site_info.sh

@ -16,9 +16,11 @@ 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 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_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_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) 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_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_USER\t\t\t \033[37m$ee_db_user"
ee_lib_echo_escape "DB_PASS\t\t\t \033[37m$ee_db_pass" ee_lib_echo_escape "DB_PASS\t\t\t \033[37m$ee_db_pass"

11
src/modules/site/ee_mod_site_option.sh

@ -34,4 +34,15 @@ 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 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 EE_SITE_CACHE_OPTION=--basic
fi fi
# Kick out for invalid cache option
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 = " $?
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
} }

5
src/modules/site/ee_mod_site_packages.sh

@ -17,10 +17,11 @@ function ee_mod_site_packages()
ee_lib_stack_packages mysql ee_lib_stack_packages mysql
fi 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 if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then
# Install WP-CLI # Install WP-CLI
ee_ven_install_wpcli ee_ven_install_wpcli
fi fi
# Check & Install Postfix Packages
ee_lib_stack_packages postfix
} }

13
src/modules/site/update/ee_mod_site_update_password.sh

@ -12,7 +12,15 @@ ee_mod_site_update_password()
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
read -p "Provide WordPress user name [admin]: " ee_wp_user 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 "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
if [ "$ee_wp_user" = "" ]; then
ee_wp_user=admin ee_wp_user=admin
fi fi
@ -22,7 +30,8 @@ ee_mod_site_update_password()
read -sp "Provide password for $ee_wp_user user: " ee_wp_pass read -sp "Provide password for $ee_wp_user user: " ee_wp_pass
echo echo
if [[ ${#ee_wp_pass} -ge 8 ]]; then 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 else
ee_lib_error "Password Unchanged. Hint : Your password must be 8 characters long, exit status = " $? ee_lib_error "Password Unchanged. Hint : Your password must be 8 characters long, exit status = " $?
fi fi

93
src/modules/site/update/ee_mod_update_domain.sh

@ -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
}

129
src/modules/site/update/ee_mod_update_nginx.sh

@ -0,0 +1,129 @@
# Update NGINX configuration for $EE_DOMAIN
function ee_mod_update_nginx()
{
# Git commit
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..."
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_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_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_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 =" $?
# Update NGINX conf for HTML site
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 \
|| 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_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_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_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_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_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_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 =" $?
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_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_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $?
fi
# Update --wpsc (--wp/--wpsubdir/--wpsubdomain) to --basic --w3tc --wpfc options
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 =" $?
elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then
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 \
|| 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_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 =" $?
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_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_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $?
fi
# Update --wpfc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --w3tc options
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 =" $?
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_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_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_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
# 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_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 && \
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_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
}

31
src/modules/site/update/ee_mod_update_plugins.sh

@ -1,31 +0,0 @@
# Update cache plugins
function ee_mod_update_plugins()
{
cd /var/www/$EE_DOMAIN/htdocs/
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
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
ee_lib_echo "Unistalling WP Super Cache plugin, please wait..."
wp plugin --allow-root uninstall wp-super-cache &>> $EE_COMMAND_LOG
fi
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
fi
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_mod_plugin_w3tc
fi
}

90
src/modules/site/update/ee_mod_update_website.sh

@ -0,0 +1,90 @@
# Update Websites
function ee_mod_update_website() {
# 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 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)
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/Install WordPress for HTML|PHP|MySQL websites
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
# 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
# Update WordPress Websites
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_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
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
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
# Install WordPress plugins
# 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_CURRENT_CACHE" != "--wpsc" && "$EE_SITE_CACHE_OPTION" = "--wpsc" ]]; then
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
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_UPDATE_WEBSITE="success"
}

2
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_lib_echo "Installing PHP, please wait..."
$EE_APT_GET install php5-common php5-mysqlnd php5-xmlrpc \ $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-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 = " $?
} }

4
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 # Setting wait_timeout = 30 & interactive_timeout = 60
if [ ! -f /etc/mysql/my.cnf ]; then 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 else
grep "_timeout" /etc/mysql/my.cnf &>> $EE_COMMAND_LOG grep "_timeout" /etc/mysql/my.cnf &>> $EE_COMMAND_LOG
if [ $? -ne 0 ]; then 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
fi fi
} }

2
src/modules/stack/install/ee_mod_setup_nginx.sh

@ -21,7 +21,7 @@ function ee_mod_setup_nginx()
# Disable nginx version # Disable nginx version
# Set custom header # Set custom header
# SSL Settings # 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 # Adjust nginx keepalive_timeout
sed -i "s/keepalive_timeout.*/keepalive_timeout 30;/" /etc/nginx/nginx.conf sed -i "s/keepalive_timeout.*/keepalive_timeout 30;/" /etc/nginx/nginx.conf

5
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/create-ssl-cert boolean yes"
debconf-set-selections <<< "dovecot-core dovecot-core/ssl-cert-name string $(hostname -f)" 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 # Debian 6 doesn't provide Dovecot 2.x
if [ "$EE_DEBIAN_VERSION" == "squeeze" ]; then 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 = " $? || ee_lib_error "Unable to install Dovecot, exit status = " $?
else 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 = " $? || ee_lib_error "Unable to install Dovecot, exit status = " $?
fi fi

10
src/modules/stack/install/mail/ee_mod_setup_dovecot.sh

@ -30,6 +30,16 @@ 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 \ 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 = " $? || ee_lib_error "Unable to setup 10-auth.conf file, exit status = " $?
# Configuring 10-ssl.conf, Disable SSLv2 and SSLv3, Fixes POODLE Bug
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 # Configuring dovecot-sql.conf.ext
cp -v /usr/share/easyengine/mail/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext &>> $EE_COMMAND_LOG \ 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 = " $? || ee_lib_error "Unable to copy dovecot-sql.conf.ext, exit status = " $?

7
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" 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 # other destination domains should be handled using virtual domains
postconf -e "mydestination = localhost" postconf -e "mydestination = localhost"
@ -44,6 +50,7 @@ function ee_mod_setup_postfix()
postconf -e "virtual_gid_maps = static:5000" postconf -e "virtual_gid_maps = static:5000"
postconf -e "virtual_mailbox_domains = mysql:/etc/postfix/mysql/virtual_domains_maps.cf" 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_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" #postconf "message_size_limit = 20971520"

5
src/vendor/ee_ven_install_vimbadmin.sh

@ -11,6 +11,9 @@ function ee_ven_install_vimbadmin()
# Install ViMbAdmin # Install ViMbAdmin
ee_lib_echo "Installing ViMbAdmin, please wait..." ee_lib_echo "Installing ViMbAdmin, please wait..."
ee_lib_echo "It will take nearly 10-20 minutes, 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 \ 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 = " $? || 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 = " $? || ee_lib_error "Unable to install ViMbAdmin, exit status = " $?
# Fix permissions # 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 = " $? || ee_lib_error "Unable to change ownership for ViMbAdmin, exit status = " $?
# Remove unwanted files # Remove unwanted files

3
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" || ee_lib_error "Unable to remove EasyEngine (ee) admin utilities"
# Drop Anemometer database # Drop Anemometer database
mysql -e "drop database if exists slow_query_log" \ mysql -e "drop database if exists slow_query_log" &>> $EE_COMMAND_LOG
|| ee_lib_error "Unable to drop slow_query_log database, exit status = " $?
} }

2
templates/nginx/wp/wpfc.conf

@ -1,4 +1,4 @@
# WPSINGLE FAST CGI NGINX CONFIGURATION # WPSINGLE FASTCGI NGINX CONFIGURATION
server { server {

2
templates/nginx/wpsubdir/wpfc.conf

@ -1,4 +1,4 @@
# WPSUBDIR FAST CGI NGINX CONFIGURATION # WPSUBDIR FASTCGI NGINX CONFIGURATION
server { server {

2
templates/nginx/wpsubdomain/wpfc.conf

@ -1,4 +1,4 @@
# WPSUBDOMAIN FAST CGI NGINX CONFIGURATION # WPSUBDOMAIN FASTCGI NGINX CONFIGURATION
server { server {

Loading…
Cancel
Save