From faea70a387dd95568a02fb2947b0a7f36ab24b4b Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Wed, 8 Oct 2014 15:05:58 +0530 Subject: [PATCH] functions created --- src/modules/site/ee_mod_site_option.sh | 57 +++++++++++++----------- src/modules/site/ee_mod_site_packages.sh | 40 +++++++++-------- 2 files changed, 52 insertions(+), 45 deletions(-) diff --git a/src/modules/site/ee_mod_site_option.sh b/src/modules/site/ee_mod_site_option.sh index fd1b4d39..4c7f0e55 100644 --- a/src/modules/site/ee_mod_site_option.sh +++ b/src/modules/site/ee_mod_site_option.sh @@ -1,34 +1,37 @@ # Auto switch site options -if [ "$EE_SITE_CREATE_OPTION" = "--basic" ] || [ "$EE_SITE_CREATE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpfc" ]; then - if [ "$EE_SITE_CACHE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdirectory" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdom" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdomain" ]; then - EE_SITE_CREATE_OPTION=$EE_FIFTH - EE_SITE_CACHE_OPTION=$EE_FOURTH - else - EE_SITE_CREATE_OPTION=--wp - EE_SITE_CACHE_OPTION=$EE_FOURTH +function ee_mod_site_option() +{ + if [ "$EE_SITE_CREATE_OPTION" = "--basic" ] || [ "$EE_SITE_CREATE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpfc" ]; then + if [ "$EE_SITE_CACHE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdirectory" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdom" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdomain" ]; then + EE_SITE_CREATE_OPTION=$EE_FIFTH + EE_SITE_CACHE_OPTION=$EE_FOURTH + else + EE_SITE_CREATE_OPTION=--wp + EE_SITE_CACHE_OPTION=$EE_FOURTH + fi fi -fi -# WordPresss subdirectory variables -if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdirectory" ]; then - EE_SITE_CREATE_OPTION="--wpsubdir" - EE_NETWORK_ACTIVATE="--network" -fi + # WordPresss subdirectory variables + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdirectory" ]; then + EE_SITE_CREATE_OPTION="--wpsubdir" + EE_NETWORK_ACTIVATE="--network" + fi -# WordPress sub-domain variables -if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdom" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - EE_SITE_CREATE_OPTION="--wpsubdomain" - EE_NETWORK_ACTIVATE="--network" - EE_WP_SUBDOMAIN="--subdomains" -fi + # WordPress sub-domain variables + if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdom" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + EE_SITE_CREATE_OPTION="--wpsubdomain" + EE_NETWORK_ACTIVATE="--network" + EE_WP_SUBDOMAIN="--subdomains" + fi -# Use default whenever possible -if [ "$EE_SITE_CREATE_OPTION" = "" ]; then - EE_SITE_CREATE_OPTION=--html -fi + # Use default whenever possible + if [ "$EE_SITE_CREATE_OPTION" = "" ]; then + EE_SITE_CREATE_OPTION=--html + fi -# For WordPress sites if $EE_SITE_CACHE_OPTION is empty then used --basic as a $EE_SITE_CACHE_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 + # For WordPress sites if $EE_SITE_CACHE_OPTION is empty then used --basic as a $EE_SITE_CACHE_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 +} diff --git a/src/modules/site/ee_mod_site_packages.sh b/src/modules/site/ee_mod_site_packages.sh index edf448cf..76421c93 100644 --- a/src/modules/site/ee_mod_site_packages.sh +++ b/src/modules/site/ee_mod_site_packages.sh @@ -1,21 +1,25 @@ -# Install required packages -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 - # Check & Install NGINX Packages - ee_lib_stack_packages nginx -fi -if [ "$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 - # Check & Install PHP Packages - ee_lib_stack_packages php -fi -if [ "$EE_SITE_CREATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then - # Check & Install Percona MySQL Packages +function ee_mod_site_packages() +{ + # Install required packages + + 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 + # Check & Install NGINX Packages + ee_lib_stack_packages nginx + fi + if [ "$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 + # Check & Install PHP Packages + ee_lib_stack_packages php + fi + if [ "$EE_SITE_CREATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then + # Check & Install Percona MySQL Packages ee_lib_stack_packages mysql -fi + fi -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 + 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 +}