mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 15:26:13 +01:00
backuptestfinal2
This commit is contained in:
@@ -3180,214 +3180,644 @@ $parameters = array(
|
|||||||
############## Existing site
|
############## Existing site
|
||||||
if (DomainName == "" and int(self.extraArgs['DesSiteID']) != -1):
|
if (DomainName == "" and int(self.extraArgs['DesSiteID']) != -1):
|
||||||
wpsite = WPSites.objects.get(pk=DesSiteID)
|
wpsite = WPSites.objects.get(pk=DesSiteID)
|
||||||
VHuser = wpsite.owner.externalApp
|
webobj = Websites.objects.get(pk=wpsite.owner_id)
|
||||||
PhpVersion = wpsite.owner.phpSelection
|
ag = WPSites.objects.filter(owner=webobj).count()
|
||||||
newWPpath = wpsite.path
|
if ag > 0:
|
||||||
newurl = wpsite.FinalURL
|
###Website found --> Wpsite Found
|
||||||
|
finalurl = "%s%s" % (webobj.domain, oldurl[oldurl.find('/'):])
|
||||||
|
|
||||||
#### Check If sub dir in old web site
|
|
||||||
try:
|
|
||||||
oldpath = config['WPsitepath']
|
|
||||||
abc = oldpath.split("/")
|
|
||||||
pathexta = abc[4]
|
|
||||||
if pathexta != "":
|
|
||||||
home = "0"
|
|
||||||
else:
|
|
||||||
home = "1"
|
|
||||||
except BaseException as msg:
|
|
||||||
home = "1"
|
|
||||||
|
|
||||||
### get WPsite Database name and usr
|
|
||||||
php = PHPManager.getPHPString(PhpVersion)
|
|
||||||
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
|
||||||
|
|
||||||
|
|
||||||
######Get DBname
|
|
||||||
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path=%s' % (VHuser, FinalPHPPath, newWPpath)
|
|
||||||
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
|
||||||
|
|
||||||
if stdout.find('Error:') > -1:
|
|
||||||
raise BaseException(stdout)
|
|
||||||
else:
|
|
||||||
Finaldbname = stdout.rstrip("\n")
|
|
||||||
|
|
||||||
######Get DBuser
|
|
||||||
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path=%s' % (VHuser, FinalPHPPath, newWPpath)
|
|
||||||
|
|
||||||
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
|
||||||
|
|
||||||
if stdout.find('Error:') > -1:
|
|
||||||
raise BaseException(stdout)
|
|
||||||
else:
|
|
||||||
Finaldbuser = stdout.rstrip("\n")
|
|
||||||
|
|
||||||
|
|
||||||
#####Get DBpsswd
|
|
||||||
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_PASSWORD --skip-plugins --skip-themes --path=%s' % (VHuser, FinalPHPPath, newWPpath)
|
|
||||||
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
|
||||||
|
|
||||||
if stdout.find('Error:') > -1:
|
|
||||||
raise BaseException(stdout)
|
|
||||||
else:
|
|
||||||
Finaldbpasswd = stdout.rstrip("\n")
|
|
||||||
|
|
||||||
|
|
||||||
### Create secure folder
|
|
||||||
|
|
||||||
ACLManager.CreateSecureDir()
|
|
||||||
RandomPath = str(randint(1000, 9999))
|
|
||||||
self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', RandomPath)
|
|
||||||
|
|
||||||
command = f'mkdir -p {self.tempPath}'
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
|
||||||
|
|
||||||
if result == 0:
|
|
||||||
raise BaseException(stdout)
|
|
||||||
|
|
||||||
command = f'chown -R {wpsite.owner.externalApp}:{wpsite.owner.externalApp} {self.tempPath}'
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
|
||||||
|
|
||||||
if result == 0:
|
|
||||||
raise BaseException(stdout)
|
|
||||||
|
|
||||||
logging.statusWriter(self.tempStatusPath, 'Extracting Backup File...,30')
|
|
||||||
|
|
||||||
###First copy backup file to temp and then Unzip
|
|
||||||
command = "sudo -u %s cp -R /home/backup/%s* %s" % (VHuser, BackUpFileName, self.tempPath)
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
|
||||||
|
|
||||||
if result == 0:
|
|
||||||
raise BaseException(stdout)
|
|
||||||
|
|
||||||
#### Make temp dir ab for unzip
|
|
||||||
command ="sudo -u %s mkdir %s/ab"%(VHuser,self.tempPath)
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
|
||||||
|
|
||||||
if result == 0:
|
|
||||||
raise BaseException(stdout)
|
|
||||||
|
|
||||||
command = "sudo -u %s tar -xvf %s/%s.tar.gz -C %s/ab" % (VHuser, self.tempPath, BackUpFileName, self.tempPath)
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
|
||||||
|
|
||||||
if result == 0:
|
|
||||||
raise BaseException(stdout)
|
|
||||||
|
|
||||||
|
|
||||||
logging.statusWriter(self.tempStatusPath, 'Copying Data File...,50')
|
|
||||||
###Copy backup content to newsite
|
|
||||||
if home == "0":
|
|
||||||
#### Check If sub dir in New web site
|
|
||||||
try:
|
try:
|
||||||
kl = newWPpath.split("/")
|
WPobj = WPSites.objects.get(FinalURL=finalurl, owner=webobj)
|
||||||
newpathexta = kl[4]
|
###Website found --> WPsite Found --> Final URL Match
|
||||||
if newpathexta != "":
|
#### Do not create Ne site
|
||||||
newsubdir = "0"
|
### get WPsite Database name and usr
|
||||||
|
VHuser = wpsite.owner.externalApp
|
||||||
|
PhpVersion = WPobj.owner.phpSelection
|
||||||
|
newWPpath = WPobj.path
|
||||||
|
php = PHPManager.getPHPString(PhpVersion)
|
||||||
|
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||||
|
|
||||||
|
######Get DBname
|
||||||
|
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path=%s' % (
|
||||||
|
VHuser, FinalPHPPath, newWPpath)
|
||||||
|
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
else:
|
else:
|
||||||
newsubdir = "1"
|
Finaldbname = stdout.rstrip("\n")
|
||||||
except BaseException as msg:
|
|
||||||
newsubdir = "1"
|
|
||||||
|
|
||||||
if newsubdir == "0":
|
######Get DBuser
|
||||||
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
|
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path=%s' % (
|
||||||
###first split back to publich_html then mak dir and te copy
|
VHuser, FinalPHPPath, newWPpath)
|
||||||
b = newWPpath.rstrip('/')
|
|
||||||
newwebpath = b.rstrip(newpathexta)
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
command = "sudo -u %s mkdir %s%s" % (VHuser, newwebpath, pathexta)
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
else:
|
||||||
|
Finaldbuser = stdout.rstrip("\n")
|
||||||
|
|
||||||
|
#####Get DBpsswd
|
||||||
|
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_PASSWORD --skip-plugins --skip-themes --path=%s' % (
|
||||||
|
VHuser, FinalPHPPath, newWPpath)
|
||||||
|
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
else:
|
||||||
|
Finaldbpasswd = stdout.rstrip("\n")
|
||||||
|
|
||||||
|
### Create secure folder
|
||||||
|
|
||||||
|
ACLManager.CreateSecureDir()
|
||||||
|
RandomPath = str(randint(1000, 9999))
|
||||||
|
self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', RandomPath)
|
||||||
|
|
||||||
|
command = f'mkdir -p {self.tempPath}'
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
if result == 0:
|
if result == 0:
|
||||||
raise BaseException(stdout)
|
raise BaseException(stdout)
|
||||||
Webnewpath = str(newwebpath) + str(pathexta)
|
|
||||||
|
|
||||||
else:
|
command = f'chown -R {wpsite.owner.externalApp}:{wpsite.owner.externalApp} {self.tempPath}'
|
||||||
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
|
|
||||||
###make dir of sub folder in existing site
|
|
||||||
command = "sudo -u %s mkdir %s%s" % (VHuser, newWPpath, pathexta)
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
if result == 0:
|
if result == 0:
|
||||||
raise BaseException(stdout)
|
raise BaseException(stdout)
|
||||||
Webnewpath = str(newWPpath) + str(pathexta)
|
|
||||||
|
|
||||||
else:
|
logging.statusWriter(self.tempStatusPath, 'Extracting Backup File...,30')
|
||||||
|
|
||||||
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
|
###First copy backup file to temp and then Unzip
|
||||||
Webnewpath = newWPpath
|
command = "sudo -u %s cp -R /home/backup/%s* %s" % (VHuser, BackUpFileName, self.tempPath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
#### Make temp dir ab for unzip
|
||||||
|
command = "sudo -u %s mkdir %s/ab" % (VHuser, self.tempPath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
command = "sudo -u %s tar -xvf %s/%s.tar.gz -C %s/ab" % (
|
||||||
|
VHuser, self.tempPath, BackUpFileName, self.tempPath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
|
||||||
|
|
||||||
|
command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, newWPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, newWPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
# dump Mysql file in unzippath path
|
||||||
|
unzippath2 = "%s/ab/usr/local/CyberCP/tmp/%s/%s" % (
|
||||||
|
self.tempPath, oldtemppath, DumpFileName)
|
||||||
|
command = "mysql -u root %s < %s" % (Finaldbname, unzippath2)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Restoreing Data Base...,70')
|
||||||
|
#####SetUp DataBase Settings
|
||||||
|
##set DBName
|
||||||
|
command = "sudo -u %s %s /usr/bin/wp config set DB_NAME %s --skip-plugins --skip-themes --path=%s" % (
|
||||||
|
VHuser, FinalPHPPath, Finaldbname, newWPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
##set DBuser
|
||||||
|
command = "sudo -u %s %s /usr/bin/wp config set DB_USER %s --skip-plugins --skip-themes --path=%s" % (
|
||||||
|
VHuser, FinalPHPPath, Finaldbuser, newWPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
##set DBpasswd
|
||||||
|
command = "sudo -u %s %s /usr/bin/wp config set DB_PASSWORD %s --skip-plugins --skip-themes --path=%s" % (
|
||||||
|
VHuser, FinalPHPPath, Finaldbpasswd, newWPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Replacing URLs...,90')
|
||||||
|
########Now Replace URL's
|
||||||
|
command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path=%s "%s" "%s"' % (
|
||||||
|
VHuser, newWPpath, oldurl, finalurl)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --allow-root --path=%s "https://www.%s" "http://%s"' % (
|
||||||
|
VHuser, newWPpath, finalurl, finalurl)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
# ##Remove temppath
|
||||||
|
command = f'rm -rf {self.tempPath}'
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
except:
|
||||||
|
####Website found --> WPsite Found --> Final URL Not Match
|
||||||
|
####Create new obj and call wordpressnew
|
||||||
|
DataToPass = {}
|
||||||
|
|
||||||
|
DataToPass['title'] = config['WPtitle']
|
||||||
|
DataToPass['WPVersion'] = "6.0"
|
||||||
|
DataToPass['adminUser'] = config['WebVHuser']
|
||||||
|
DataToPass['Email'] = config['WebadminEmail']
|
||||||
|
DataToPass['PasswordByPass'] = config['DatabaseUser']
|
||||||
|
DataToPass['AutomaticUpdates'] = config['WPAutoUpdates']
|
||||||
|
DataToPass['Plugins'] = config['WPPluginUpdates']
|
||||||
|
DataToPass['Themes'] = config['WPThemeUpdates']
|
||||||
|
DataToPass['websiteOwner'] = WebOwner
|
||||||
|
DataToPass['package'] = packegs
|
||||||
|
|
||||||
|
# create path
|
||||||
|
try:
|
||||||
|
abc = config['WPsitepath'].split("/")
|
||||||
|
wppamndath = abc[4]
|
||||||
|
home = "0"
|
||||||
|
except:
|
||||||
|
abc = config['WPsitepath'].split("/")
|
||||||
|
wppamndath = abc[3]
|
||||||
|
home = "1"
|
||||||
|
DataToPass['domain'] = webobj.domain
|
||||||
|
DataToPass['path'] = wppamndath
|
||||||
|
DataToPass['home'] = home
|
||||||
|
Furlofnewp = "%s/%s" % (webobj.domain, wppamndath)
|
||||||
|
|
||||||
|
try:
|
||||||
|
website = Websites.objects.get(domain=DomainName)
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Web Site Already Exist.[404]')
|
||||||
|
except:
|
||||||
|
ab = WebsiteManager()
|
||||||
|
coreResult = ab.submitWorpressCreation(userID, DataToPass)
|
||||||
|
coreResult1 = json.loads((coreResult).content)
|
||||||
|
logging.writeToFile("WP Creating website result....%s" % coreResult1)
|
||||||
|
reutrntempath = coreResult1['tempStatusPath']
|
||||||
|
while (1):
|
||||||
|
lastLine = open(reutrntempath, 'r').read()
|
||||||
|
logging.writeToFile("Error WP creating lastline ....... %s" % lastLine)
|
||||||
|
if lastLine.find('[200]') > -1:
|
||||||
|
break
|
||||||
|
elif lastLine.find('[404]') > -1:
|
||||||
|
logging.statusWriter(self.tempStatusPath,
|
||||||
|
'Failed to WordPress: error: %s. [404]' % lastLine)
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Creating WordPress....,20')
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
##### Now resting start
|
||||||
|
newWPobj = WPSites.objects.get(FinalURL=Furlofnewp)
|
||||||
|
## get WPsite Database name and usr
|
||||||
|
Newurl = newWPobj.FinalURL
|
||||||
|
WPpath = newWPobj.path
|
||||||
|
VHuser = newWPobj.owner.externalApp
|
||||||
|
PhpVersion = newWPobj.owner.phpSelection
|
||||||
|
php = PHPManager.getPHPString(PhpVersion)
|
||||||
|
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||||
|
|
||||||
|
######Get DBname
|
||||||
|
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path=%s' % (
|
||||||
|
VHuser, FinalPHPPath, WPpath)
|
||||||
|
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
else:
|
||||||
|
Finaldbname = stdout.rstrip("\n")
|
||||||
|
|
||||||
|
######Get DBuser
|
||||||
|
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path=%s' % (
|
||||||
|
VHuser, FinalPHPPath, WPpath)
|
||||||
|
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
else:
|
||||||
|
Finaldbuser = stdout.rstrip("\n")
|
||||||
|
|
||||||
|
#####Get DBpsswd
|
||||||
|
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_PASSWORD --skip-plugins --skip-themes --path=%s' % (
|
||||||
|
VHuser, FinalPHPPath, WPpath)
|
||||||
|
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
else:
|
||||||
|
Finaldbpasswd = stdout.rstrip("\n")
|
||||||
|
|
||||||
|
### Create secure folder
|
||||||
|
|
||||||
|
ACLManager.CreateSecureDir()
|
||||||
|
RandomPath = str(randint(1000, 9999))
|
||||||
|
self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', RandomPath)
|
||||||
|
|
||||||
|
command = f'mkdir -p {self.tempPath}'
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
command = f'chown -R {newWPobj.owner.externalApp}:{newWPobj.owner.externalApp} {self.tempPath}'
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Extracting Backup File...,30')
|
||||||
|
|
||||||
|
###First copy backup file to temp and then Unzip
|
||||||
|
command = "sudo -u %s cp -R /home/backup/%s* %s" % (
|
||||||
|
VHuser, BackUpFileName, self.tempPath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
#### Make temp dir ab for unzip
|
||||||
|
command = "sudo -u %s mkdir %s/ab" % (VHuser, self.tempPath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
command = "sudo -u %s tar -xvf %s/%s.tar.gz -C %s/ab" % (
|
||||||
|
VHuser, self.tempPath, BackUpFileName, self.tempPath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
|
||||||
|
|
||||||
|
command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, WPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, WPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
# dump Mysql file in unzippath path
|
||||||
|
unzippath2 = "%s/ab/usr/local/CyberCP/tmp/%s/%s" % (
|
||||||
|
self.tempPath, oldtemppath, DumpFileName)
|
||||||
|
command = "mysql -u root %s < %s" % (Finaldbname, unzippath2)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Restoreing Data Base...,70')
|
||||||
|
#####SetUp DataBase Settings
|
||||||
|
##set DBName
|
||||||
|
command = "sudo -u %s %s /usr/bin/wp config set DB_NAME %s --skip-plugins --skip-themes --path=%s" % (
|
||||||
|
VHuser, FinalPHPPath, Finaldbname, WPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
##set DBuser
|
||||||
|
command = "sudo -u %s %s /usr/bin/wp config set DB_USER %s --skip-plugins --skip-themes --path=%s" % (
|
||||||
|
VHuser, FinalPHPPath, Finaldbuser, WPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
##set DBpasswd
|
||||||
|
command = "sudo -u %s %s /usr/bin/wp config set DB_PASSWORD %s --skip-plugins --skip-themes --path=%s" % (
|
||||||
|
VHuser, FinalPHPPath, Finaldbpasswd, WPpath)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Replacing URLs...,90')
|
||||||
|
########Now Replace URL's
|
||||||
|
command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path=%s "%s" "%s"' % (
|
||||||
|
VHuser, WPpath, oldurl, Newurl)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --allow-root --path=%s "https://www.%s" "http://%s"' % (
|
||||||
|
VHuser, WPpath, Newurl, Newurl)
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if stdout.find('Error:') > -1:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
# ##Remove temppath
|
||||||
|
command = f'rm -rf {self.tempPath}'
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
|
||||||
command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, Webnewpath)
|
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
|
||||||
|
|
||||||
if result == 0:
|
# VHuser = wpsite.owner.externalApp
|
||||||
raise BaseException(stdout)
|
# PhpVersion = wpsite.owner.phpSelection
|
||||||
|
# newWPpath = wpsite.path
|
||||||
command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, Webnewpath)
|
# newurl = wpsite.FinalURL
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
#
|
||||||
|
#
|
||||||
if result == 0:
|
# #### Check If sub dir in old web site
|
||||||
raise BaseException(stdout)
|
# try:
|
||||||
|
# oldpath = config['WPsitepath']
|
||||||
|
# abc = oldpath.split("/")
|
||||||
#dump Mysql file in unzippath path
|
# pathexta = abc[4]
|
||||||
unzippath2 = "%s/ab/usr/local/CyberCP/tmp/%s/%s" % (self.tempPath, oldtemppath, DumpFileName)
|
# if pathexta != "":
|
||||||
command = "mysql -u root %s < %s" % (Finaldbname, unzippath2)
|
# oldhome = "0"
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
# else:
|
||||||
|
# oldhome = "1"
|
||||||
if result == 0:
|
# except BaseException as msg:
|
||||||
raise BaseException(stdout)
|
# oldhome = "1"
|
||||||
|
#
|
||||||
logging.statusWriter(self.tempStatusPath, 'Restoreing Data Base...,70')
|
# ### get WPsite Database name and usr
|
||||||
#####SetUp DataBase Settings
|
# php = PHPManager.getPHPString(PhpVersion)
|
||||||
##set DBName
|
# FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||||
command = "sudo -u %s %s /usr/bin/wp config set DB_NAME %s --skip-plugins --skip-themes --path=%s" % (VHuser, FinalPHPPath, Finaldbname, newWPpath)
|
#
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
#
|
||||||
|
# ######Get DBname
|
||||||
if stdout.find('Error:') > -1:
|
# command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path=%s' % (VHuser, FinalPHPPath, newWPpath)
|
||||||
raise BaseException(stdout)
|
#
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
##set DBuser
|
#
|
||||||
command = "sudo -u %s %s /usr/bin/wp config set DB_USER %s --skip-plugins --skip-themes --path=%s" % (VHuser, FinalPHPPath, Finaldbuser, newWPpath)
|
# if stdout.find('Error:') > -1:
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
# raise BaseException(stdout)
|
||||||
|
# else:
|
||||||
if stdout.find('Error:') > -1:
|
# Finaldbname = stdout.rstrip("\n")
|
||||||
raise BaseException(stdout)
|
#
|
||||||
|
# ######Get DBuser
|
||||||
##set DBpasswd
|
# command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path=%s' % (VHuser, FinalPHPPath, newWPpath)
|
||||||
command = "sudo -u %s %s /usr/bin/wp config set DB_PASSWORD %s --skip-plugins --skip-themes --path=%s" % (VHuser, FinalPHPPath, Finaldbpasswd, newWPpath)
|
#
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
#
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
if stdout.find('Error:') > -1:
|
#
|
||||||
raise BaseException(stdout)
|
# if stdout.find('Error:') > -1:
|
||||||
|
# raise BaseException(stdout)
|
||||||
logging.statusWriter(self.tempStatusPath, 'Replacing URLs...,90')
|
# else:
|
||||||
########Now Replace URL's
|
# Finaldbuser = stdout.rstrip("\n")
|
||||||
command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path=%s "%s" "%s"' % (VHuser, newWPpath, oldurl, newurl)
|
#
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
#
|
||||||
|
# #####Get DBpsswd
|
||||||
if stdout.find('Error:') > -1:
|
# command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config get DB_PASSWORD --skip-plugins --skip-themes --path=%s' % (VHuser, FinalPHPPath, newWPpath)
|
||||||
raise BaseException(stdout)
|
#
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --allow-root --path=%s "https://www.%s" "http://%s"' % (VHuser, newWPpath, newurl, newurl)
|
#
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
# if stdout.find('Error:') > -1:
|
||||||
|
# raise BaseException(stdout)
|
||||||
if stdout.find('Error:') > -1:
|
# else:
|
||||||
raise BaseException(stdout)
|
# Finaldbpasswd = stdout.rstrip("\n")
|
||||||
|
#
|
||||||
# ##Remove temppath
|
#
|
||||||
command = f'rm -rf {self.tempPath}'
|
# ### Create secure folder
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
#
|
||||||
|
# ACLManager.CreateSecureDir()
|
||||||
if result == 0:
|
# RandomPath = str(randint(1000, 9999))
|
||||||
raise BaseException(stdout)
|
# self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', RandomPath)
|
||||||
|
#
|
||||||
###Restart Server
|
# command = f'mkdir -p {self.tempPath}'
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
from plogical.installUtilities import installUtilities
|
#
|
||||||
installUtilities.reStartLiteSpeed()
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# command = f'chown -R {wpsite.owner.externalApp}:{wpsite.owner.externalApp} {self.tempPath}'
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# logging.statusWriter(self.tempStatusPath, 'Extracting Backup File...,30')
|
||||||
|
#
|
||||||
|
# ###First copy backup file to temp and then Unzip
|
||||||
|
# command = "sudo -u %s cp -R /home/backup/%s* %s" % (VHuser, BackUpFileName, self.tempPath)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# #### Make temp dir ab for unzip
|
||||||
|
# command ="sudo -u %s mkdir %s/ab"%(VHuser,self.tempPath)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# command = "sudo -u %s tar -xvf %s/%s.tar.gz -C %s/ab" % (VHuser, self.tempPath, BackUpFileName, self.tempPath)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# logging.writeToFile("oldhome......%s"%oldhome)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# logging.statusWriter(self.tempStatusPath, 'Copying Data File...,50')
|
||||||
|
# ###Copy backup content to newsite
|
||||||
|
# if oldhome == "0":
|
||||||
|
# #### Check If sub dir in New web site
|
||||||
|
# try:
|
||||||
|
# kl = newWPpath.split("/")
|
||||||
|
# newpathexta = kl[4]
|
||||||
|
# if newpathexta != "":
|
||||||
|
# newsubdir = "0"
|
||||||
|
# else:
|
||||||
|
# newsubdir = "1"
|
||||||
|
# except BaseException as msg:
|
||||||
|
# newsubdir = "1"
|
||||||
|
#
|
||||||
|
# logging.writeToFile("newsubdir......%s" % newsubdir)
|
||||||
|
#
|
||||||
|
# if newsubdir == "0":
|
||||||
|
# unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
|
||||||
|
# ###first split back to publich_html then mak dir and te copy
|
||||||
|
# b = newWPpath.rstrip('/')
|
||||||
|
# newwebpath = b.rstrip(newpathexta)
|
||||||
|
# command = "sudo -u %s mkdir %s%s" % (VHuser, newwebpath, pathexta)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
# Webnewpath = str(newwebpath) + str(pathexta)
|
||||||
|
#
|
||||||
|
# else:
|
||||||
|
# unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
|
||||||
|
# ###make dir of sub folder in existing site
|
||||||
|
# command = "sudo -u %s mkdir %s%s" % (VHuser, newWPpath, pathexta)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
# Webnewpath = str(newWPpath) + str(pathexta)
|
||||||
|
#
|
||||||
|
# try:
|
||||||
|
# oldFurl = config['WPFinalURL']
|
||||||
|
# oldownerid = config['WPowner_id']
|
||||||
|
# newFurl = "%s/%s"%(wpsite.FinalURL, pathexta)
|
||||||
|
# getwpobj = WPSites.objects.get(FinalURL=newFurl)
|
||||||
|
# except:
|
||||||
|
# newFurl = "%s/%s" % (wpsite.FinalURL, pathexta)
|
||||||
|
# string = config['WPsitepath'].split("/")
|
||||||
|
# extrapathold = string[4]
|
||||||
|
# string2 = newWPpath.split("/")
|
||||||
|
# extrapathnew = string2[4]
|
||||||
|
# a = wpsite.path
|
||||||
|
# b = a.rstrip('/')
|
||||||
|
# cutpathnew = b.rstrip(extrapathnew)
|
||||||
|
# newmpath = '%s/%s'%(cutpathnew, extrapathold)
|
||||||
|
#
|
||||||
|
# DataToPass = {}
|
||||||
|
#
|
||||||
|
# DataToPass['title'] = config['WPtitle']
|
||||||
|
# DataToPass['domain'] = newFurl
|
||||||
|
# DataToPass['WPVersion'] = "6.0"
|
||||||
|
# DataToPass['adminUser'] = config['WebVHuser']
|
||||||
|
# DataToPass['Email'] = config['WebadminEmail']
|
||||||
|
# DataToPass['PasswordByPass'] = config['DatabaseUser']
|
||||||
|
# DataToPass['AutomaticUpdates'] = config['WPAutoUpdates']
|
||||||
|
# DataToPass['Plugins'] = config['WPPluginUpdates']
|
||||||
|
# DataToPass['Themes'] = config['WPThemeUpdates']
|
||||||
|
# DataToPass['websiteOwner'] = WebOwner
|
||||||
|
# DataToPass['package'] = packegs
|
||||||
|
# DataToPass['path'] = newmpath
|
||||||
|
# DataToPass['home'] = "0"
|
||||||
|
#
|
||||||
|
# try:
|
||||||
|
# website = Websites.objects.get(domain=DomainName)
|
||||||
|
# logging.statusWriter(self.tempStatusPath, 'Web Site Already Exist.[404]')
|
||||||
|
# except:
|
||||||
|
# ab = WebsiteManager()
|
||||||
|
# coreResult = ab.submitWorpressCreation(userID, DataToPass)
|
||||||
|
# coreResult1 = json.loads((coreResult).content)
|
||||||
|
# logging.writeToFile("WP Creating website result....%s" % coreResult1)
|
||||||
|
# reutrntempath = coreResult1['tempStatusPath']
|
||||||
|
# while (1):
|
||||||
|
# lastLine = open(reutrntempath, 'r').read()
|
||||||
|
# logging.writeToFile("Error WP creating lastline ....... %s" % lastLine)
|
||||||
|
# if lastLine.find('[200]') > -1:
|
||||||
|
# break
|
||||||
|
# elif lastLine.find('[404]') > -1:
|
||||||
|
# logging.statusWriter(self.tempStatusPath,
|
||||||
|
# 'Failed to WordPress: error: %s. [404]' % lastLine)
|
||||||
|
# return 0
|
||||||
|
# else:
|
||||||
|
# logging.statusWriter(self.tempStatusPath, 'Creating WordPress....,20')
|
||||||
|
# time.sleep(2)
|
||||||
|
#
|
||||||
|
# else:
|
||||||
|
# unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
|
||||||
|
# Webnewpath = newWPpath
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, Webnewpath)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, Webnewpath)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# #dump Mysql file in unzippath path
|
||||||
|
# unzippath2 = "%s/ab/usr/local/CyberCP/tmp/%s/%s" % (self.tempPath, oldtemppath, DumpFileName)
|
||||||
|
# command = "mysql -u root %s < %s" % (Finaldbname, unzippath2)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# logging.statusWriter(self.tempStatusPath, 'Restoreing Data Base...,70')
|
||||||
|
# #####SetUp DataBase Settings
|
||||||
|
# ##set DBName
|
||||||
|
# command = "sudo -u %s %s /usr/bin/wp config set DB_NAME %s --skip-plugins --skip-themes --path=%s" % (VHuser, FinalPHPPath, Finaldbname, newWPpath)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if stdout.find('Error:') > -1:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# ##set DBuser
|
||||||
|
# command = "sudo -u %s %s /usr/bin/wp config set DB_USER %s --skip-plugins --skip-themes --path=%s" % (VHuser, FinalPHPPath, Finaldbuser, newWPpath)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if stdout.find('Error:') > -1:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# ##set DBpasswd
|
||||||
|
# command = "sudo -u %s %s /usr/bin/wp config set DB_PASSWORD %s --skip-plugins --skip-themes --path=%s" % (VHuser, FinalPHPPath, Finaldbpasswd, newWPpath)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if stdout.find('Error:') > -1:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# logging.statusWriter(self.tempStatusPath, 'Replacing URLs...,90')
|
||||||
|
# ########Now Replace URL's
|
||||||
|
# command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path=%s "%s" "%s"' % (VHuser, newWPpath, oldurl, newurl)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if stdout.find('Error:') > -1:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --allow-root --path=%s "https://www.%s" "http://%s"' % (VHuser, newWPpath, newurl, newurl)
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if stdout.find('Error:') > -1:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# # ##Remove temppath
|
||||||
|
# command = f'rm -rf {self.tempPath}'
|
||||||
|
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
#
|
||||||
|
# if result == 0:
|
||||||
|
# raise BaseException(stdout)
|
||||||
|
#
|
||||||
|
# ###Restart Server
|
||||||
|
#
|
||||||
|
# from plogical.installUtilities import installUtilities
|
||||||
|
# installUtilities.reStartLiteSpeed()
|
||||||
############## New Site
|
############## New Site
|
||||||
elif(DomainName != "" and int(self.extraArgs['DesSiteID']) == -1):
|
elif(DomainName != "" and int(self.extraArgs['DesSiteID']) == -1):
|
||||||
###############Create New WordPressSite First
|
###############Create New WordPressSite First
|
||||||
@@ -3545,8 +3975,8 @@ $parameters = array(
|
|||||||
|
|
||||||
if result == 0:
|
if result == 0:
|
||||||
raise BaseException(stdout)
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
|
||||||
command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, newWPpath)
|
command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, newWPpath)
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
|
|||||||
@@ -14,3 +14,6 @@ else:
|
|||||||
home = "1"
|
home = "1"
|
||||||
print(wpexpath)
|
print(wpexpath)
|
||||||
print(c)
|
print(c)
|
||||||
|
# furl = "habi.com/subfolder"
|
||||||
|
# a=furl[furl.find('/'):]
|
||||||
|
# print(a)
|
||||||
Reference in New Issue
Block a user