bug fix: sub folder wp manager installations

This commit is contained in:
Usman Nasir
2021-02-15 20:57:30 +05:00
parent b6c8f72517
commit e922b47a8c
4 changed files with 306 additions and 55 deletions

View File

@@ -36,7 +36,17 @@ class StagingSetup(multi.Thread):
website = Websites.objects.get(domain=masterDomain)
masterPath = '/home/%s/public_html' % (masterDomain)
try:
import json
from cloudAPI.models import WPDeployments
wpd = WPDeployments.objects.get(owner=website)
path = json.loads(wpd.config)['path']
masterPath = '/home/%s/public_html/%s' % (masterDomain, path)
replaceDomain = '%s/%s' % (masterDomain, path)
except:
masterPath = '/home/%s/public_html' % (masterDomain)
replaceDomain = masterDomain
configPath = '%s/wp-config.php' % (masterPath)
## Check if WP Detected on Main Site
@@ -114,10 +124,10 @@ class StagingSetup(multi.Thread):
## Search and replace url
command = 'wp search-replace --allow-root --path=%s "%s" "%s"' % (path, masterDomain, domain)
command = 'wp search-replace --allow-root --path=%s "%s" "%s"' % (path, replaceDomain, domain)
ProcessUtilities.executioner(command)
command = 'wp search-replace --allow-root --path=%s "www.%s" "%s"' % (path, masterDomain, domain)
command = 'wp search-replace --allow-root --path=%s "www.%s" "%s"' % (path, replaceDomain, domain)
ProcessUtilities.executioner(command)
logging.statusWriter(tempStatusPath, 'Fixing permissions..,90')
@@ -147,7 +157,17 @@ class StagingSetup(multi.Thread):
child = ChildDomains.objects.get(domain=childDomain)
masterPath = '/home/%s/public_html' % (child.master.domain)
try:
import json
from cloudAPI.models import WPDeployments
wpd = WPDeployments.objects.get(owner=child.master)
path = json.loads(wpd.config)['path']
masterPath = '/home/%s/public_html/%s' % (child.master.domain, path)
replaceDomain = '%s/%s' % (child.master.domain, path)
except:
masterPath = '/home/%s/public_html' % (child.master.domain)
replaceDomain = child.master.domain
command = 'chmod 755 /home/%s/public_html' % (child.master.domain)
ProcessUtilities.executioner(command)
@@ -185,10 +205,10 @@ class StagingSetup(multi.Thread):
## Search and replace url
command = 'wp search-replace --allow-root --path=%s "%s" "%s"' % (masterPath, child.domain, child.master.domain)
command = 'wp search-replace --allow-root --path=%s "%s" "%s"' % (masterPath, child.domain, replaceDomain)
ProcessUtilities.executioner(command)
command = 'wp search-replace --allow-root --path=%s "www.%s" "%s"' % (masterPath, child.domain, child.master.domain)
command = 'wp search-replace --allow-root --path=%s "www.%s" "%s"' % (masterPath, child.domain, replaceDomain)
ProcessUtilities.executioner(command)
from filemanager.filemanager import FileManager
@@ -201,6 +221,15 @@ class StagingSetup(multi.Thread):
logging.statusWriter(tempStatusPath, 'Completed,[200]')
http = []
finalHTTP = []
for items in http:
if items.find('x-litespeed-cache') > -1 or items.find('x-lsadc-cache') > -1 or items.find('x-qc-cache') > -1:
finalHTTP.append('<strong>%s</strong>' % (items))
else:
finalHTTP.append(items)
return 0
except BaseException as msg:
mesg = '%s. [404]' % (str(msg))