improve install script & site.py
* remove php7.2 installation * cleanup code * improve code quality according to shellcheck warnings
This commit is contained in:
46
install
46
install
@@ -150,26 +150,6 @@ wo_install_dep()
|
|||||||
sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2;/g' /etc/nginx/nginx.conf
|
sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2;/g' /etc/nginx/nginx.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$wo_linux_distro" == "Ubuntu" ]; then
|
|
||||||
add-apt-repository -y 'ppa:ondrej/php'
|
|
||||||
wo_lib_echo "Updating the PHP repository for some neat PHP 7.2 support"
|
|
||||||
apt-get update &>> /dev/null
|
|
||||||
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1
|
|
||||||
mkdir -p /var/log/php/7.2/
|
|
||||||
touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log
|
|
||||||
systemctl php7.2-fpm restart &>> /dev/null
|
|
||||||
|
|
||||||
elif [ "$wo_linux_distro" == "Debian" ]; then
|
|
||||||
apt-get install apt-transport-https lsb-release ca-certificates locales locales-all -y
|
|
||||||
export LC_ALL=en_US.UTF-8
|
|
||||||
export LANG=en_US.UTF-8
|
|
||||||
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
|
||||||
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
|
|
||||||
apt-get update &>> /dev/null
|
|
||||||
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1
|
|
||||||
systemctl php7.2-fpm restart &>> /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Webp mapping
|
# Webp mapping
|
||||||
###
|
###
|
||||||
@@ -475,11 +455,11 @@ wo_update_latest()
|
|||||||
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom nginx-ee
|
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom nginx-ee
|
||||||
service nginx restart &>> /dev/null
|
service nginx restart &>> /dev/null
|
||||||
fi
|
fi
|
||||||
dpkg --get-selections | grep -v deinstall | grep nginx-common
|
CHECK_NGINX_COMMON=$(dpkg --get-selections | grep -v deinstall | grep nginx-common)
|
||||||
if [ $? -eq 0 ]; then
|
if [ -n "$CHECK_NGINX_COMMON" ]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
dpkg --get-selections | grep -v deinstall | grep nginx-mainline
|
CHECK_NGINX_MAILINE=$(dpkg --get-selections | grep -v deinstall | grep nginx-mainline)
|
||||||
if [ $? -eq 0 ]; then
|
if [ -n "$CHECK_NGINX_MAILINE" ]; then
|
||||||
apt-get remove -y nginx-mainline
|
apt-get remove -y nginx-mainline
|
||||||
fi
|
fi
|
||||||
service nginx stop &>> /dev/null
|
service nginx stop &>> /dev/null
|
||||||
@@ -503,11 +483,11 @@ wo_update_latest()
|
|||||||
apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom
|
apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom
|
||||||
systemctl restart nginx &>> /dev/null
|
systemctl restart nginx &>> /dev/null
|
||||||
fi
|
fi
|
||||||
dpkg --get-selections | grep -v deinstall | grep nginx-common
|
CHECK_NGINX_COMMON=$(dpkg --get-selections | grep -v deinstall | grep nginx-common)
|
||||||
if [ $? -eq 0 ]; then
|
if [ -n "$CHECK_NGINX_COMMON" ]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
dpkg --get-selections | grep -v deinstall | grep nginx-mainline
|
CHECK_NGINX_MAILINE=$(dpkg --get-selections | grep -v deinstall | grep nginx-mainline)
|
||||||
if [ $? -eq 0 ]; then
|
if [ -n "$CHECK_NGINX_MAILINE" ]; then
|
||||||
apt-get remove -y nginx-mainline
|
apt-get remove -y nginx-mainline
|
||||||
fi
|
fi
|
||||||
systemctl stop nginx &>> /dev/null
|
systemctl stop nginx &>> /dev/null
|
||||||
@@ -525,8 +505,8 @@ wo_update_latest()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Fix HHVM autostart on reboot
|
# Fix HHVM autostart on reboot
|
||||||
dpkg --get-selections | grep -v deinstall | grep hhvm &>> /dev/null
|
CHECK_HHVM_INSTALL=$(dpkg --get-selections | grep -v deinstall | grep hhvm &>> /dev/null)
|
||||||
if [ $? -eq 0 ]; then
|
if [ -n "$CHECK_HHVM_INSTALL" ]; then
|
||||||
update-rc.d hhvm defaults &>> /dev/null
|
update-rc.d hhvm defaults &>> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -654,6 +634,8 @@ wo_update_latest()
|
|||||||
systemctl php7.2-fpm restart &>> /dev/null
|
systemctl php7.2-fpm restart &>> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#Fix for SSL cert --all
|
||||||
|
|
||||||
# Fix for SSL cert --all
|
# Fix for SSL cert --all
|
||||||
crontab -l | grep -q '\-\-min_expiry_limit'
|
crontab -l | grep -q '\-\-min_expiry_limit'
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
@@ -683,6 +665,8 @@ wo_git_init()
|
|||||||
git add -A .
|
git add -A .
|
||||||
git commit -am "Installed/Updated to WordOps" &>> /dev/null
|
git commit -am "Installed/Updated to WordOps" &>> /dev/null
|
||||||
|
|
||||||
|
#PHP under git version control
|
||||||
|
|
||||||
# PHP under git version control
|
# PHP under git version control
|
||||||
[ -d /etc/php ] && {
|
[ -d /etc/php ] && {
|
||||||
cd /etc/php || exit 1
|
cd /etc/php || exit 1
|
||||||
@@ -711,7 +695,7 @@ else
|
|||||||
read -p "Update WordOps to $wo_version_new (y/n): " wo_ans
|
read -p "Update WordOps to $wo_version_new (y/n): " wo_ans
|
||||||
if [ "$wo_ans" = "y" ] || [ "$wo_ans" = "Y" ]; then
|
if [ "$wo_ans" = "y" ] || [ "$wo_ans" = "Y" ]; then
|
||||||
wo_install_dep | tee -ai $wo_install_log
|
wo_install_dep | tee -ai $wo_install_log
|
||||||
wo_sync_db 2&>>1 $EE_INSTALL_LOG
|
wo_sync_db >> $EE_INSTALL_LOG 2>&1
|
||||||
secure_wo_db | tee -ai $EE_INSTALL_LOG
|
secure_wo_db | tee -ai $EE_INSTALL_LOG
|
||||||
wo_upgrade_php | tee -ai $wo_install_log
|
wo_upgrade_php | tee -ai $wo_install_log
|
||||||
wo_install | tee -ai $wo_install_log
|
wo_install | tee -ai $wo_install_log
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class WOCleanController(CementBaseController):
|
|||||||
self.clean_opcache()
|
self.clean_opcache()
|
||||||
if self.app.pargs.redis:
|
if self.app.pargs.redis:
|
||||||
self.clean_redis()
|
self.clean_redis()
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def clean_redis(self):
|
def clean_redis(self):
|
||||||
"""This function clears Redis cache"""
|
"""This function clears Redis cache"""
|
||||||
@@ -97,6 +98,7 @@ class WOCleanController(CementBaseController):
|
|||||||
" or install them with `wo stack install --admin`")
|
" or install them with `wo stack install --admin`")
|
||||||
Log.error(self, "Unable to clean opcache", False)
|
Log.error(self, "Unable to clean opcache", False)
|
||||||
|
|
||||||
|
|
||||||
def load(app):
|
def load(app):
|
||||||
# register the plugin class.. this only happens if the plugin is enabled
|
# register the plugin class.. this only happens if the plugin is enabled
|
||||||
handler.register(WOCleanController)
|
handler.register(WOCleanController)
|
||||||
|
|||||||
@@ -759,8 +759,8 @@ class WODebugController(CementBaseController):
|
|||||||
self.debug_fpm()
|
self.debug_fpm()
|
||||||
if self.app.pargs.php73:
|
if self.app.pargs.php73:
|
||||||
self.debug_php73()
|
self.debug_php73()
|
||||||
if self.app.pargs.fpm7:
|
if self.app.pargs.fpm73:
|
||||||
self.debug_fpm7()
|
self.debug_fpm73()
|
||||||
if self.app.pargs.mysql:
|
if self.app.pargs.mysql:
|
||||||
# MySQL debug will not work for remote MySQL
|
# MySQL debug will not work for remote MySQL
|
||||||
if WOVariables.wo_mysql_host is "localhost":
|
if WOVariables.wo_mysql_host is "localhost":
|
||||||
|
|||||||
@@ -455,7 +455,8 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
|
|
||||||
if data and self.app.pargs.php73:
|
if data and self.app.pargs.php73:
|
||||||
if (self.app.pargs.experimental):
|
if (self.app.pargs.experimental):
|
||||||
Log.info(self, "Do you wish to install PHP 7.3 now for {0}?".format(wo_domain))
|
Log.info(
|
||||||
|
self, "Do you wish to install PHP 7.3 now for {0}?".format(wo_domain))
|
||||||
|
|
||||||
# Check prompt
|
# Check prompt
|
||||||
check_prompt = input("Type \"y\" to continue [n]:")
|
check_prompt = input("Type \"y\" to continue [n]:")
|
||||||
@@ -536,7 +537,8 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
hashbucket(self)
|
hashbucket(self)
|
||||||
except SiteError as e:
|
except SiteError as e:
|
||||||
# call cleanup actions on failure
|
# call cleanup actions on failure
|
||||||
Log.info(self, Log.FAIL + "There was a serious error encountered...")
|
Log.info(self, Log.FAIL +
|
||||||
|
"There was a serious error encountered...")
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
doCleanupAction(self, domain=wo_domain,
|
doCleanupAction(self, domain=wo_domain,
|
||||||
webroot=data['webroot'])
|
webroot=data['webroot'])
|
||||||
@@ -548,7 +550,8 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
addNewSite(self, wo_domain, stype, cache, wo_site_webroot)
|
addNewSite(self, wo_domain, stype, cache, wo_site_webroot)
|
||||||
# Service Nginx Reload
|
# Service Nginx Reload
|
||||||
if not WOService.reload_service(self, 'nginx'):
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
Log.info(self, Log.FAIL + "There was a serious error encountered...")
|
Log.info(self, Log.FAIL +
|
||||||
|
"There was a serious error encountered...")
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
doCleanupAction(self, domain=wo_domain)
|
doCleanupAction(self, domain=wo_domain)
|
||||||
deleteSiteInfo(self, wo_domain)
|
deleteSiteInfo(self, wo_domain)
|
||||||
@@ -568,7 +571,6 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
else:
|
else:
|
||||||
php_version = "7.2"
|
php_version = "7.2"
|
||||||
|
|
||||||
|
|
||||||
addNewSite(self, wo_domain, stype, cache, wo_site_webroot,
|
addNewSite(self, wo_domain, stype, cache, wo_site_webroot,
|
||||||
hhvm=hhvm, php_version=php_version)
|
hhvm=hhvm, php_version=php_version)
|
||||||
|
|
||||||
@@ -584,7 +586,8 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
except SiteError as e:
|
except SiteError as e:
|
||||||
# call cleanup actions on failure
|
# call cleanup actions on failure
|
||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.info(self, Log.FAIL + "There was a serious error encountered...")
|
Log.info(self, Log.FAIL +
|
||||||
|
"There was a serious error encountered...")
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
doCleanupAction(self, domain=wo_domain,
|
doCleanupAction(self, domain=wo_domain,
|
||||||
webroot=data['webroot'],
|
webroot=data['webroot'],
|
||||||
@@ -613,7 +616,8 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.debug(self, "Error occured while generating "
|
Log.debug(self, "Error occured while generating "
|
||||||
"wo-config.php")
|
"wo-config.php")
|
||||||
Log.info(self, Log.FAIL + "There was a serious error encountered...")
|
Log.info(self, Log.FAIL +
|
||||||
|
"There was a serious error encountered...")
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
doCleanupAction(self, domain=wo_domain,
|
doCleanupAction(self, domain=wo_domain,
|
||||||
webroot=data['webroot'],
|
webroot=data['webroot'],
|
||||||
@@ -636,7 +640,8 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
except SiteError as e:
|
except SiteError as e:
|
||||||
# call cleanup actions on failure
|
# call cleanup actions on failure
|
||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.info(self, Log.FAIL + "There was a serious error encountered...")
|
Log.info(self, Log.FAIL +
|
||||||
|
"There was a serious error encountered...")
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
doCleanupAction(self, domain=wo_domain,
|
doCleanupAction(self, domain=wo_domain,
|
||||||
webroot=data['webroot'],
|
webroot=data['webroot'],
|
||||||
@@ -649,7 +654,8 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
|
|
||||||
# Service Nginx Reload call cleanup if failed to reload nginx
|
# Service Nginx Reload call cleanup if failed to reload nginx
|
||||||
if not WOService.reload_service(self, 'nginx'):
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
Log.info(self, Log.FAIL + "There was a serious error encountered...")
|
Log.info(self, Log.FAIL +
|
||||||
|
"There was a serious error encountered...")
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
doCleanupAction(self, domain=wo_domain,
|
doCleanupAction(self, domain=wo_domain,
|
||||||
webroot=data['webroot'])
|
webroot=data['webroot'])
|
||||||
@@ -672,7 +678,8 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
setwebrootpermissions(self, data['webroot'])
|
setwebrootpermissions(self, data['webroot'])
|
||||||
except SiteError as e:
|
except SiteError as e:
|
||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.info(self, Log.FAIL + "There was a serious error encountered...")
|
Log.info(self, Log.FAIL +
|
||||||
|
"There was a serious error encountered...")
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
doCleanupAction(self, domain=wo_domain,
|
doCleanupAction(self, domain=wo_domain,
|
||||||
webroot=data['webroot'])
|
webroot=data['webroot'])
|
||||||
@@ -707,7 +714,8 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
if self.app.pargs.letsencrypt:
|
if self.app.pargs.letsencrypt:
|
||||||
if (self.app.pargs.experimental):
|
if (self.app.pargs.experimental):
|
||||||
if stype in ['wpsubdomain']:
|
if stype in ['wpsubdomain']:
|
||||||
Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.")
|
Log.warn(
|
||||||
|
self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.")
|
||||||
|
|
||||||
Log.info(self, "Letsencrypt is currently in beta phase."
|
Log.info(self, "Letsencrypt is currently in beta phase."
|
||||||
" \nDo you wish"
|
" \nDo you wish"
|
||||||
@@ -740,9 +748,11 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
" https://{0}".format(wo_domain))
|
" https://{0}".format(wo_domain))
|
||||||
|
|
||||||
if (SSL.getExpirationDays(self, wo_domain) > 0):
|
if (SSL.getExpirationDays(self, wo_domain) > 0):
|
||||||
Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.")
|
Log.info(self, "Your cert will expire within " +
|
||||||
|
str(SSL.getExpirationDays(self, wo_domain)) + " days.")
|
||||||
else:
|
else:
|
||||||
Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ")
|
Log.warn(
|
||||||
|
self, "Your cert already EXPIRED ! .PLEASE renew soon . ")
|
||||||
|
|
||||||
# Add nginx conf folder into GIT
|
# Add nginx conf folder into GIT
|
||||||
WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)],
|
WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)],
|
||||||
@@ -755,8 +765,6 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
" http://{0}".format(wo_domain))
|
" http://{0}".format(wo_domain))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WOSiteUpdateController(CementBaseController):
|
class WOSiteUpdateController(CementBaseController):
|
||||||
class Meta:
|
class Meta:
|
||||||
label = 'update'
|
label = 'update'
|
||||||
@@ -852,7 +860,6 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
letsencrypt = False
|
letsencrypt = False
|
||||||
php73 = None
|
php73 = None
|
||||||
|
|
||||||
|
|
||||||
data = dict()
|
data = dict()
|
||||||
try:
|
try:
|
||||||
stype, cache = detSitePar(vars(pargs))
|
stype, cache = detSitePar(vars(pargs))
|
||||||
@@ -1065,10 +1072,12 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
if (expiry_days <= min_expiry_days):
|
if (expiry_days <= min_expiry_days):
|
||||||
renewLetsEncrypt(self, wo_domain)
|
renewLetsEncrypt(self, wo_domain)
|
||||||
else:
|
else:
|
||||||
Log.error(self,"You have more than 30 days with the current certificate - refusing to run.")
|
Log.error(
|
||||||
|
self, "You have more than 30 days with the current certificate - refusing to run.")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Log.error(self,"Cannot renew - HTTPS is not configured for the given site. Install LE first...")
|
Log.error(
|
||||||
|
self, "Cannot renew - HTTPS is not configured for the given site. Install LE first...")
|
||||||
|
|
||||||
if not WOService.reload_service(self, 'nginx'):
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
Log.error(self, "service nginx reload failed. "
|
Log.error(self, "service nginx reload failed. "
|
||||||
@@ -1076,11 +1085,14 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
Log.info(self, "SUCCESS: Certificate was successfully renewed For"
|
Log.info(self, "SUCCESS: Certificate was successfully renewed For"
|
||||||
" https://{0}".format(wo_domain))
|
" https://{0}".format(wo_domain))
|
||||||
if (SSL.getExpirationDays(self, wo_domain) > 0):
|
if (SSL.getExpirationDays(self, wo_domain) > 0):
|
||||||
Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.")
|
Log.info(self, "Your cert will expire within " +
|
||||||
Log.info(self, "Expiration date: " + str(SSL.getExpirationDate(self,wo_domain)))
|
str(SSL.getExpirationDays(self, wo_domain)) + " days.")
|
||||||
|
Log.info(self, "Expiration date: " +
|
||||||
|
str(SSL.getExpirationDate(self, wo_domain)))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Log.warn(self, "The certificate seems to be already expired. Please renew it as soon as possible...")
|
Log.warn(
|
||||||
|
self, "The certificate seems to be already expired. Please renew it as soon as possible...")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if pargs.all and pargs.letsencrypt == "renew":
|
if pargs.all and pargs.letsencrypt == "renew":
|
||||||
@@ -1098,16 +1110,20 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
Log.info(self, "SUCCESS: Certificate was successfully renewed For"
|
Log.info(self, "SUCCESS: Certificate was successfully renewed For"
|
||||||
" https://{0}".format(wo_domain))
|
" https://{0}".format(wo_domain))
|
||||||
else:
|
else:
|
||||||
Log.info(self,"You have more than 30 days with the current certificate - refusing to run.\n")
|
Log.info(
|
||||||
|
self, "You have more than 30 days with the current certificate - refusing to run.\n")
|
||||||
|
|
||||||
if (SSL.getExpirationDays(self, wo_domain) > 0):
|
if (SSL.getExpirationDays(self, wo_domain) > 0):
|
||||||
Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.")
|
Log.info(self, "Your cert will expire within " +
|
||||||
Log.info(self, "Expiration date: \n\n" + str(SSL.getExpirationDate(self,wo_domain)))
|
str(SSL.getExpirationDays(self, wo_domain)) + " days.")
|
||||||
|
Log.info(self, "Expiration date: \n\n" +
|
||||||
|
str(SSL.getExpirationDate(self, wo_domain)))
|
||||||
return 0
|
return 0
|
||||||
# else:
|
# else:
|
||||||
# Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ")
|
# Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ")
|
||||||
else:
|
else:
|
||||||
Log.info(self,"SSL not configured for site http://{0}".format(wo_domain))
|
Log.info(
|
||||||
|
self, "SSL not configured for site http://{0}".format(wo_domain))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if pargs.all and pargs.letsencrypt == "off":
|
if pargs.all and pargs.letsencrypt == "off":
|
||||||
@@ -1165,7 +1181,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
if pargs.hhvm == "on" or pargs.letsencrypt == "on" or pargs.php73 == "on":
|
if pargs.hhvm == "on" or pargs.letsencrypt == "on" or pargs.php73 == "on":
|
||||||
if pargs.php73 == "on":
|
if pargs.php73 == "on":
|
||||||
if (not pargs.experimental):
|
if (not pargs.experimental):
|
||||||
Log.info(self, "Do you wish to enable PHP 7.3 now for {0}?".format(wo_domain))
|
Log.info(
|
||||||
|
self, "Do you wish to enable PHP 7.3 now for {0}?".format(wo_domain))
|
||||||
|
|
||||||
check_prompt = input("Type \"y\" to continue [n]:")
|
check_prompt = input("Type \"y\" to continue [n]:")
|
||||||
if check_prompt != "Y" and check_prompt != "y":
|
if check_prompt != "Y" and check_prompt != "y":
|
||||||
@@ -1204,7 +1221,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
if (not pargs.experimental):
|
if (not pargs.experimental):
|
||||||
|
|
||||||
if oldsitetype in ['wpsubdomain']:
|
if oldsitetype in ['wpsubdomain']:
|
||||||
Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.")
|
Log.warn(
|
||||||
|
self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.")
|
||||||
|
|
||||||
Log.info(self, "Letsencrypt is currently in beta phase."
|
Log.info(self, "Letsencrypt is currently in beta phase."
|
||||||
" \nDo you wish"
|
" \nDo you wish"
|
||||||
@@ -1222,8 +1240,6 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
data['letsencrypt'] = True
|
data['letsencrypt'] = True
|
||||||
letsencrypt = True
|
letsencrypt = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if pargs.wpredis and data['currcachetype'] != 'wpredis':
|
if pargs.wpredis and data['currcachetype'] != 'wpredis':
|
||||||
if (not pargs.experimental):
|
if (not pargs.experimental):
|
||||||
Log.info(self, "Redis is experimental feature and it may not"
|
Log.info(self, "Redis is experimental feature and it may not"
|
||||||
@@ -1310,9 +1326,11 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
" https://{0}".format(wo_domain))
|
" https://{0}".format(wo_domain))
|
||||||
|
|
||||||
if (SSL.getExpirationDays(self, wo_domain) > 0):
|
if (SSL.getExpirationDays(self, wo_domain) > 0):
|
||||||
Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,wo_domain)) + " days.")
|
Log.info(self, "Your cert will expire within " +
|
||||||
|
str(SSL.getExpirationDays(self, wo_domain)) + " days.")
|
||||||
else:
|
else:
|
||||||
Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ")
|
Log.warn(
|
||||||
|
self, "Your cert already EXPIRED ! .PLEASE renew soon . ")
|
||||||
|
|
||||||
elif data['letsencrypt'] is False:
|
elif data['letsencrypt'] is False:
|
||||||
if os.path.isfile("{0}/conf/nginx/ssl.conf"
|
if os.path.isfile("{0}/conf/nginx/ssl.conf"
|
||||||
@@ -1331,7 +1349,6 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
Log.info(self, "Successfully Disabled SSl for Site "
|
Log.info(self, "Successfully Disabled SSl for Site "
|
||||||
" http://{0}".format(wo_domain))
|
" http://{0}".format(wo_domain))
|
||||||
|
|
||||||
|
|
||||||
# Add nginx conf folder into GIT
|
# Add nginx conf folder into GIT
|
||||||
WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)],
|
WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)],
|
||||||
msg="Adding letsencrypts config of site: {0}"
|
msg="Adding letsencrypts config of site: {0}"
|
||||||
@@ -1412,7 +1429,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
(data['wpfc'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpfc'])):
|
(data['wpfc'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpfc'])):
|
||||||
try:
|
try:
|
||||||
plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":1,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_fastcgi","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}'
|
plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":1,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_fastcgi","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}'
|
||||||
setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data)
|
setupwp_plugin(
|
||||||
|
self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data)
|
||||||
except SiteError as e:
|
except SiteError as e:
|
||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.info(self, Log.FAIL + "Update nginx-helper settings failed. "
|
Log.info(self, Log.FAIL + "Update nginx-helper settings failed. "
|
||||||
@@ -1424,7 +1442,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
(data['wpredis'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpredis'])):
|
(data['wpredis'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpredis'])):
|
||||||
try:
|
try:
|
||||||
plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":1,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_redis","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}'
|
plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":1,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_redis","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}'
|
||||||
setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data)
|
setupwp_plugin(
|
||||||
|
self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data)
|
||||||
except SiteError as e:
|
except SiteError as e:
|
||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.info(self, Log.FAIL + "Update nginx-helper settings failed. "
|
Log.info(self, Log.FAIL + "Update nginx-helper settings failed. "
|
||||||
@@ -1434,7 +1453,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":0,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_redis","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}'
|
plugin_data = '{"log_level":"INFO","log_filesize":5,"enable_purge":0,"enable_map":0,"enable_log":0,"enable_stamp":0,"purge_homepage_on_new":1,"purge_homepage_on_edit":1,"purge_homepage_on_del":1,"purge_archive_on_new":1,"purge_archive_on_edit":0,"purge_archive_on_del":0,"purge_archive_on_new_comment":0,"purge_archive_on_deleted_comment":0,"purge_page_on_mod":1,"purge_page_on_new_comment":1,"purge_page_on_deleted_comment":1,"cache_method":"enable_redis","purge_method":"get_request","redis_hostname":"127.0.0.1","redis_port":"6379","redis_prefix":"nginx-cache:"}'
|
||||||
setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data)
|
setupwp_plugin(
|
||||||
|
self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data)
|
||||||
except SiteError as e:
|
except SiteError as e:
|
||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.info(self, Log.FAIL + "Update nginx-helper settings failed. "
|
Log.info(self, Log.FAIL + "Update nginx-helper settings failed. "
|
||||||
@@ -1477,12 +1497,16 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
if installwp_plugin(self, 'redis-cache', data):
|
if installwp_plugin(self, 'redis-cache', data):
|
||||||
# search for wp-config.php
|
# search for wp-config.php
|
||||||
if WOFileUtils.isexist(self, "{0}/wp-config.php".format(wo_site_webroot)):
|
if WOFileUtils.isexist(self, "{0}/wp-config.php".format(wo_site_webroot)):
|
||||||
config_path = '{0}/wp-config.php'.format(wo_site_webroot)
|
config_path = '{0}/wp-config.php'.format(
|
||||||
|
wo_site_webroot)
|
||||||
elif WOFileUtils.isexist(self, "{0}/htdocs/wp-config.php".format(wo_site_webroot)):
|
elif WOFileUtils.isexist(self, "{0}/htdocs/wp-config.php".format(wo_site_webroot)):
|
||||||
config_path = '{0}/htdocs/wp-config.php'.format(wo_site_webroot)
|
config_path = '{0}/htdocs/wp-config.php'.format(
|
||||||
|
wo_site_webroot)
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "Updating wp-config.php failed. File could not be located.")
|
Log.debug(
|
||||||
Log.error(self,"wp-config.php could not be located !!")
|
self, "Updating wp-config.php failed. File could not be located.")
|
||||||
|
Log.error(
|
||||||
|
self, "wp-config.php could not be located !!")
|
||||||
raise SiteError
|
raise SiteError
|
||||||
|
|
||||||
if WOShellExec.cmd_exec(self, "grep -q \"WP_CACHE_KEY_SALT\" {0}"
|
if WOShellExec.cmd_exec(self, "grep -q \"WP_CACHE_KEY_SALT\" {0}"
|
||||||
@@ -1636,7 +1660,8 @@ class WOSiteDeleteController(CementBaseController):
|
|||||||
mark_db_delete_prompt = True
|
mark_db_delete_prompt = True
|
||||||
Log.info(self, "Deleting Database, {0}, user {1}"
|
Log.info(self, "Deleting Database, {0}, user {1}"
|
||||||
.format(wo_db_name, wo_db_user))
|
.format(wo_db_name, wo_db_user))
|
||||||
deleteDB(self, wo_db_name, wo_db_user, wo_mysql_grant_host, False)
|
deleteDB(self, wo_db_name, wo_db_user,
|
||||||
|
wo_mysql_grant_host, False)
|
||||||
updateSiteInfo(self, wo_domain,
|
updateSiteInfo(self, wo_domain,
|
||||||
db_name='deleted',
|
db_name='deleted',
|
||||||
db_user='deleted',
|
db_user='deleted',
|
||||||
|
|||||||
Reference in New Issue
Block a user