Fix wo site update site.tld --wpce not installing plugin
This commit is contained in:
@@ -626,84 +626,56 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
"and please try again")
|
"and please try again")
|
||||||
|
|
||||||
# Setup WordPress if Wordpress site
|
# Setup WordPress if Wordpress site
|
||||||
if (data['wp'] and (not pargs.vhostonly)):
|
if data['wp']:
|
||||||
try:
|
if not pargs.vhostonly:
|
||||||
wo_wp_creds = setupwordpress(self, data)
|
try:
|
||||||
# Add database information for site into database
|
wo_wp_creds = setupwordpress(self, data)
|
||||||
updateSiteInfo(self, wo_domain,
|
# Add database information for site into database
|
||||||
db_name=data['wo_db_name'],
|
updateSiteInfo(self, wo_domain,
|
||||||
db_user=data['wo_db_user'],
|
db_name=data['wo_db_name'],
|
||||||
db_password=data['wo_db_pass'],
|
db_user=data['wo_db_user'],
|
||||||
db_host=data['wo_db_host'])
|
db_password=data['wo_db_pass'],
|
||||||
except SiteError as e:
|
db_host=data['wo_db_host'])
|
||||||
# call cleanup actions on failure
|
except SiteError as e:
|
||||||
Log.debug(self, str(e))
|
# call cleanup actions on failure
|
||||||
Log.info(self, Log.FAIL +
|
Log.debug(self, str(e))
|
||||||
"There was a serious error encountered...")
|
Log.info(self, Log.FAIL +
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
"There was a serious error encountered...")
|
||||||
doCleanupAction(self, domain=wo_domain,
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
webroot=data['webroot'],
|
doCleanupAction(self, domain=wo_domain,
|
||||||
dbname=data['wo_db_name'],
|
webroot=data['webroot'],
|
||||||
dbuser=data['wo_db_user'],
|
dbname=data['wo_db_name'],
|
||||||
dbhost=data['wo_mysql_grant_host'])
|
dbuser=data['wo_db_user'],
|
||||||
deleteSiteInfo(self, wo_domain)
|
dbhost=data['wo_mysql_grant_host'])
|
||||||
Log.error(self, "Check the log for details: "
|
deleteSiteInfo(self, wo_domain)
|
||||||
"`tail /var/log/wo/wordops.log` "
|
Log.error(self, "Check the log for details: "
|
||||||
"and please try again")
|
"`tail /var/log/wo/wordops.log` "
|
||||||
|
"and please try again")
|
||||||
if (data['wp'] and (pargs.vhostonly)):
|
else:
|
||||||
try:
|
try:
|
||||||
wo_wp_creds = setupwordpress(self, data)
|
wo_wp_creds = setupwordpress(
|
||||||
# Add database information for site into database
|
self, data, vhostonly=True)
|
||||||
updateSiteInfo(self, wo_domain, db_name=data['wo_db_name'],
|
# Add database information for site into database
|
||||||
db_user=data['wo_db_user'],
|
updateSiteInfo(self, wo_domain,
|
||||||
db_password=data['wo_db_pass'],
|
db_name=data['wo_db_name'],
|
||||||
db_host=data['wo_db_host'])
|
db_user=data['wo_db_user'],
|
||||||
except SiteError as e:
|
db_password=data['wo_db_pass'],
|
||||||
# call cleanup actions on failure
|
db_host=data['wo_db_host'])
|
||||||
Log.debug(self, str(e))
|
except SiteError as e:
|
||||||
Log.info(self, Log.FAIL +
|
# call cleanup actions on failure
|
||||||
"There was a serious error encountered...")
|
Log.debug(self, str(e))
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
Log.info(self, Log.FAIL +
|
||||||
doCleanupAction(self, domain=wo_domain,
|
"There was a serious error encountered...")
|
||||||
webroot=data['webroot'],
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
dbname=data['wo_db_name'],
|
doCleanupAction(self, domain=wo_domain,
|
||||||
dbuser=data['wo_db_user'],
|
webroot=data['webroot'],
|
||||||
dbhost=data['wo_db_host'])
|
dbname=data['wo_db_name'],
|
||||||
deleteSiteInfo(self, wo_domain)
|
dbuser=data['wo_db_user'],
|
||||||
Log.error(self, "Check the log for details: "
|
dbhost=data['wo_mysql_grant_host'])
|
||||||
"`tail /var/log/wo/wordops.log` "
|
deleteSiteInfo(self, wo_domain)
|
||||||
"and please try again")
|
Log.error(self, "Check the log for details: "
|
||||||
try:
|
"`tail /var/log/wo/wordops.log` "
|
||||||
wodbconfig = open("{0}/wo-config.php"
|
"and please try again")
|
||||||
.format(wo_site_webroot),
|
|
||||||
encoding='utf-8', mode='w')
|
|
||||||
wodbconfig.write("<?php \ndefine('DB_NAME', '{0}');"
|
|
||||||
"\ndefine('DB_USER', '{1}'); "
|
|
||||||
"\ndefine('DB_PASSWORD', '{2}');"
|
|
||||||
"\ndefine('DB_HOST', '{3}');\n?>"
|
|
||||||
.format(data['wo_db_name'],
|
|
||||||
data['wo_db_user'],
|
|
||||||
data['wo_db_pass'],
|
|
||||||
data['wo_db_host']))
|
|
||||||
wodbconfig.close()
|
|
||||||
|
|
||||||
except IOError as e:
|
|
||||||
Log.debug(self, str(e))
|
|
||||||
Log.debug(self, "Error occured while generating "
|
|
||||||
"wo-config.php")
|
|
||||||
Log.info(self, Log.FAIL +
|
|
||||||
"There was a serious error encountered...")
|
|
||||||
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
|
||||||
doCleanupAction(self, domain=wo_domain,
|
|
||||||
webroot=data['webroot'],
|
|
||||||
dbname=data['wo_db_name'],
|
|
||||||
dbuser=data['wo_db_user'],
|
|
||||||
dbhost=data['wo_db_host'])
|
|
||||||
deleteSiteInfo(self, wo_domain)
|
|
||||||
Log.error(self, "Check the log for details: "
|
|
||||||
"`tail /var/log/wo/wordops.log` "
|
|
||||||
"and please try again")
|
|
||||||
|
|
||||||
# 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'):
|
||||||
@@ -1557,7 +1529,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
"and please try again")
|
"and please try again")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if ((oldcachetype in ['wpsc', 'basic', 'wpredis', 'wprocket', 'wpce'] and
|
if ((oldcachetype in ['wpsc', 'basic', 'wpredis', 'wprocket',
|
||||||
|
'wpce'] and
|
||||||
(data['wpfc'])) or (oldsitetype == 'wp' and
|
(data['wpfc'])) or (oldsitetype == 'wp' and
|
||||||
data['multisite'] and data['wpfc'])):
|
data['multisite'] and data['wpfc'])):
|
||||||
try:
|
try:
|
||||||
@@ -1584,9 +1557,9 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
"redis_port": "6379",
|
"redis_port": "6379",
|
||||||
"redis_prefix": "nginx-cache:"}
|
"redis_prefix": "nginx-cache:"}
|
||||||
plugin_data = json.dumps(plugin_data_object)
|
plugin_data = json.dumps(plugin_data_object)
|
||||||
setupwp_plugin(
|
setupwp_plugin(self, 'nginx-helper',
|
||||||
self, 'nginx-helper',
|
'rt_wp_nginx_helper_options',
|
||||||
'rt_wp_nginx_helper_options', plugin_data, data)
|
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 "
|
Log.info(self, Log.FAIL + "Update nginx-helper "
|
||||||
@@ -1596,7 +1569,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
"and please try again")
|
"and please try again")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
elif ((oldcachetype in ['wpsc', 'basic', 'wpfc', 'wprocket', 'wpce'] and
|
elif ((oldcachetype in ['wpsc', 'basic', 'wpfc',
|
||||||
|
'wprocket', 'wpce'] and
|
||||||
(data['wpredis'])) or (oldsitetype == 'wp' and
|
(data['wpredis'])) or (oldsitetype == 'wp' and
|
||||||
data['multisite'] and
|
data['multisite'] and
|
||||||
data['wpredis'])):
|
data['wpredis'])):
|
||||||
@@ -1624,9 +1598,9 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
"redis_port": "6379",
|
"redis_port": "6379",
|
||||||
"redis_prefix": "nginx-cache:"}
|
"redis_prefix": "nginx-cache:"}
|
||||||
plugin_data = json.dumps(plugin_data_object)
|
plugin_data = json.dumps(plugin_data_object)
|
||||||
setupwp_plugin(
|
setupwp_plugin(self, 'nginx-helper',
|
||||||
self, 'nginx-helper',
|
'rt_wp_nginx_helper_options',
|
||||||
'rt_wp_nginx_helper_options', plugin_data, data)
|
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 "
|
Log.info(self, Log.FAIL + "Update nginx-helper "
|
||||||
@@ -1635,37 +1609,9 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
" `tail /var/log/wo/wordops.log` "
|
" `tail /var/log/wo/wordops.log` "
|
||||||
"and please try again")
|
"and please try again")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
elif ((oldcachetype in ['wpsc', 'basic', 'wpfc', 'wprocket', 'wpredis'] and
|
|
||||||
(data['wpce'])) or (oldsitetype == 'wp' and
|
|
||||||
data['multisite'] and
|
|
||||||
data['wpce'])):
|
|
||||||
try:
|
|
||||||
plugin_data_object = {"expires": 24,
|
|
||||||
"new_post": 1,
|
|
||||||
"new_comment": 0,
|
|
||||||
"webp": 0,
|
|
||||||
"clear_on_upgrade": 1,
|
|
||||||
"compress": 0,
|
|
||||||
"excl_ids": "",
|
|
||||||
"excl_regexp": "",
|
|
||||||
"excl_cookies": "",
|
|
||||||
"incl_attributes": "",
|
|
||||||
"minify_html": 1}
|
|
||||||
plugin_data = json.dumps(plugin_data_object)
|
|
||||||
setupwp_plugin(
|
|
||||||
self, 'cache-enabler',
|
|
||||||
'cache-enabler', plugin_data, data)
|
|
||||||
except SiteError as e:
|
|
||||||
Log.debug(self, str(e))
|
|
||||||
Log.info(self, Log.FAIL + "Update cache-enabler "
|
|
||||||
"settings failed. "
|
|
||||||
"Check the log for details:"
|
|
||||||
" `tail /var/log/wo/wordops.log` "
|
|
||||||
"and please try again")
|
|
||||||
return 1
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
# disable nginx-helper
|
||||||
plugin_data_object = {"log_level": "INFO",
|
plugin_data_object = {"log_level": "INFO",
|
||||||
"log_filesize": 5,
|
"log_filesize": 5,
|
||||||
"enable_purge": 0,
|
"enable_purge": 0,
|
||||||
@@ -1701,6 +1647,36 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
"and please try again")
|
"and please try again")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
if ((oldcachetype in ['wpsc', 'basic', 'wpfc', 'wprocket', 'wpredis'] and
|
||||||
|
(data['wpce'])) or (oldsitetype == 'wp' and
|
||||||
|
data['multisite'] and
|
||||||
|
data['wpce'])):
|
||||||
|
try:
|
||||||
|
installwp_plugin(self, 'cache-enabler', data)
|
||||||
|
# setup cache-enabler
|
||||||
|
plugin_data_object = {"expires": 24,
|
||||||
|
"new_post": 1,
|
||||||
|
"new_comment": 0,
|
||||||
|
"webp": 0,
|
||||||
|
"clear_on_upgrade": 1,
|
||||||
|
"compress": 0,
|
||||||
|
"excl_ids": "",
|
||||||
|
"excl_regexp": "",
|
||||||
|
"excl_cookies": "",
|
||||||
|
"incl_attributes": "",
|
||||||
|
"minify_html": 1}
|
||||||
|
plugin_data = json.dumps(plugin_data_object)
|
||||||
|
setupwp_plugin(self, 'cache-enabler',
|
||||||
|
'cache-enabler', plugin_data, data)
|
||||||
|
except SiteError as e:
|
||||||
|
Log.debug(self, str(e))
|
||||||
|
Log.info(self, Log.FAIL + "Update cache-enabler "
|
||||||
|
"settings failed. "
|
||||||
|
"Check the log for details:"
|
||||||
|
" `tail /var/log/wo/wordops.log` "
|
||||||
|
"and please try again")
|
||||||
|
return 1
|
||||||
|
|
||||||
if oldcachetype == 'wpsc' and not data['wpsc']:
|
if oldcachetype == 'wpsc' and not data['wpsc']:
|
||||||
try:
|
try:
|
||||||
uninstallwp_plugin(self, 'wp-super-cache', data)
|
uninstallwp_plugin(self, 'wp-super-cache', data)
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ def setupdatabase(self, data):
|
|||||||
return(data)
|
return(data)
|
||||||
|
|
||||||
|
|
||||||
def setupwordpress(self, data):
|
def setupwordpress(self, data, vhostonly=False):
|
||||||
wo_domain_name = data['site_name']
|
wo_domain_name = data['site_name']
|
||||||
wo_site_webroot = data['webroot']
|
wo_site_webroot = data['webroot']
|
||||||
prompt_wpprefix = self.app.config.get('wordpress', 'prefix')
|
prompt_wpprefix = self.app.config.get('wordpress', 'prefix')
|
||||||
@@ -531,13 +531,13 @@ def setupwordpress(self, data):
|
|||||||
"enable_purge": 1,
|
"enable_purge": 1,
|
||||||
"enable_map": "0",
|
"enable_map": "0",
|
||||||
"enable_log": 0,
|
"enable_log": 0,
|
||||||
"enable_stamp": 0,
|
"enable_stamp": 1,
|
||||||
"purge_homepage_on_new": 1,
|
"purge_homepage_on_new": 1,
|
||||||
"purge_homepage_on_edit": 1,
|
"purge_homepage_on_edit": 1,
|
||||||
"purge_homepage_on_del": 1,
|
"purge_homepage_on_del": 1,
|
||||||
"purge_archive_on_new": 1,
|
"purge_archive_on_new": 1,
|
||||||
"purge_archive_on_edit": 0,
|
"purge_archive_on_edit": 1,
|
||||||
"purge_archive_on_del": 0,
|
"purge_archive_on_del": 1,
|
||||||
"purge_archive_on_new_comment": 0,
|
"purge_archive_on_new_comment": 0,
|
||||||
"purge_archive_on_deleted_comment": 0,
|
"purge_archive_on_deleted_comment": 0,
|
||||||
"purge_page_on_mod": 1,
|
"purge_page_on_mod": 1,
|
||||||
@@ -557,13 +557,13 @@ def setupwordpress(self, data):
|
|||||||
"enable_purge": 1,
|
"enable_purge": 1,
|
||||||
"enable_map": "0",
|
"enable_map": "0",
|
||||||
"enable_log": 0,
|
"enable_log": 0,
|
||||||
"enable_stamp": 0,
|
"enable_stamp": 1,
|
||||||
"purge_homepage_on_new": 1,
|
"purge_homepage_on_new": 1,
|
||||||
"purge_homepage_on_edit": 1,
|
"purge_homepage_on_edit": 1,
|
||||||
"purge_homepage_on_del": 1,
|
"purge_homepage_on_del": 1,
|
||||||
"purge_archive_on_new": 1,
|
"purge_archive_on_new": 1,
|
||||||
"purge_archive_on_edit": 0,
|
"purge_archive_on_edit": 1,
|
||||||
"purge_archive_on_del": 0,
|
"purge_archive_on_del": 1,
|
||||||
"purge_archive_on_new_comment": 0,
|
"purge_archive_on_new_comment": 0,
|
||||||
"purge_archive_on_deleted_comment": 0,
|
"purge_archive_on_deleted_comment": 0,
|
||||||
"purge_page_on_mod": 1,
|
"purge_page_on_mod": 1,
|
||||||
@@ -588,6 +588,7 @@ def setupwordpress(self, data):
|
|||||||
|
|
||||||
"""Install Cache-Enabler"""
|
"""Install Cache-Enabler"""
|
||||||
if data['wpce']:
|
if data['wpce']:
|
||||||
|
installwp_plugin(self, 'cache-enabler', data)
|
||||||
plugin_data_object = {"expires": 24,
|
plugin_data_object = {"expires": 24,
|
||||||
"new_post": 1,
|
"new_post": 1,
|
||||||
"new_comment": 0,
|
"new_comment": 0,
|
||||||
@@ -603,6 +604,13 @@ def setupwordpress(self, data):
|
|||||||
setupwp_plugin(self, 'cache-enabler', 'cache-enabler',
|
setupwp_plugin(self, 'cache-enabler', 'cache-enabler',
|
||||||
plugin_data, data)
|
plugin_data, data)
|
||||||
|
|
||||||
|
if vhostonly:
|
||||||
|
try:
|
||||||
|
WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root "
|
||||||
|
.format(WOVariables.wo_wpcli_path) +
|
||||||
|
"db clean --yes\"")
|
||||||
|
WOFileUtils.rm(self, "{0}/htdocs/*".format(wo_site_webroot))
|
||||||
|
|
||||||
wp_creds = dict(wp_user=wo_wp_user, wp_pass=wo_wp_pass,
|
wp_creds = dict(wp_user=wo_wp_user, wp_pass=wo_wp_pass,
|
||||||
wp_email=wo_wp_email)
|
wp_email=wo_wp_email)
|
||||||
|
|
||||||
@@ -988,6 +996,16 @@ def display_cache_settings(self, data):
|
|||||||
"\thttp://{0}/wp-admin/options-general.php?"
|
"\thttp://{0}/wp-admin/options-general.php?"
|
||||||
"page=nginx".format(data['site_name']))
|
"page=nginx".format(data['site_name']))
|
||||||
|
|
||||||
|
if data['wpce']:
|
||||||
|
if data['multisite']:
|
||||||
|
Log.info(self, "Nginx-Helper configuration :"
|
||||||
|
"\thttp://{0}/wp-admin/network/settings.php?"
|
||||||
|
"page=cache-enabler".format(data['site_name']))
|
||||||
|
else:
|
||||||
|
Log.info(self, "Nginx-Helper configuration :"
|
||||||
|
"\thttp://{0}/wp-admin/options-general.php?"
|
||||||
|
"page=cache-enabler".format(data['site_name']))
|
||||||
|
|
||||||
|
|
||||||
def logwatch(self, logfiles):
|
def logwatch(self, logfiles):
|
||||||
import zlib
|
import zlib
|
||||||
|
|||||||
Reference in New Issue
Block a user