mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 07:16:15 +01:00
bug fixes wp remote backups
This commit is contained in:
@@ -1308,7 +1308,7 @@ Automatic backup failed for %s on %s.
|
|||||||
BucketName = Scheduleconfig['BucketName']
|
BucketName = Scheduleconfig['BucketName']
|
||||||
#####Uploading File
|
#####Uploading File
|
||||||
|
|
||||||
uploadfilename = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
uploadfilename = backupConfig['name']
|
||||||
print("uploadfilename....%s"%uploadfilename)
|
print("uploadfilename....%s"%uploadfilename)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -2268,6 +2268,7 @@ $parameters = array(
|
|||||||
BackupDestination = 'Local'
|
BackupDestination = 'Local'
|
||||||
SFTP_ID = None
|
SFTP_ID = None
|
||||||
|
|
||||||
|
|
||||||
website = wpsite.owner
|
website = wpsite.owner
|
||||||
PhpVersion = website.phpSelection
|
PhpVersion = website.phpSelection
|
||||||
VHuser = website.externalApp
|
VHuser = website.externalApp
|
||||||
@@ -2285,7 +2286,7 @@ $parameters = array(
|
|||||||
|
|
||||||
command = f'sudo -u {VHuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path={WPsitepath}'
|
command = f'sudo -u {VHuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path={WPsitepath}'
|
||||||
print(command)
|
print(command)
|
||||||
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, VHuser, None, None, 1)
|
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
print(stdoutput)
|
print(stdoutput)
|
||||||
|
|
||||||
if stdoutput.find('Error:') == -1:
|
if stdoutput.find('Error:') == -1:
|
||||||
@@ -2295,13 +2296,16 @@ $parameters = array(
|
|||||||
|
|
||||||
|
|
||||||
command = f'sudo -u {VHuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path={WPsitepath}'
|
command = f'sudo -u {VHuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path={WPsitepath}'
|
||||||
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command,VHuser, None, None, 1)
|
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command,None, None, None, 1)
|
||||||
|
|
||||||
if stdoutput.find('Error:') == -1:
|
if stdoutput.find('Error:') == -1:
|
||||||
DataBaseUser = stdoutput.rstrip("\n")
|
DataBaseUser = stdoutput.rstrip("\n")
|
||||||
else:
|
else:
|
||||||
raise BaseException(stdoutput)
|
raise BaseException(stdoutput)
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
logging.writeToFile(f'DB Name: {DataBaseName}')
|
||||||
|
|
||||||
### Create secure folder
|
### Create secure folder
|
||||||
|
|
||||||
ACLManager.CreateSecureDir()
|
ACLManager.CreateSecureDir()
|
||||||
@@ -2324,7 +2328,7 @@ $parameters = array(
|
|||||||
logging.statusWriter(self.tempStatusPath, 'Creating Backup Directory...,40')
|
logging.statusWriter(self.tempStatusPath, 'Creating Backup Directory...,40')
|
||||||
|
|
||||||
command = f"sudo -u {VHuser} mkdir -p {self.tempPath}/public_html"
|
command = f"sudo -u {VHuser} mkdir -p {self.tempPath}/public_html"
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, VHuser, None, None, 1)
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
if result == 0:
|
if result == 0:
|
||||||
raise BaseException(stdout)
|
raise BaseException(stdout)
|
||||||
@@ -2366,8 +2370,8 @@ $parameters = array(
|
|||||||
|
|
||||||
os.chmod(configPath, 0o600)
|
os.chmod(configPath, 0o600)
|
||||||
|
|
||||||
command = f"sudo -u {VHuser} cp -R {configPath} {self.tempPath}"
|
command = f"cp -R {configPath} {self.tempPath}"
|
||||||
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, VHuser, None, None, 1)
|
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
if retStatus == 0:
|
if retStatus == 0:
|
||||||
raise BaseException(stdoutput)
|
raise BaseException(stdoutput)
|
||||||
|
|
||||||
@@ -2401,10 +2405,15 @@ $parameters = array(
|
|||||||
|
|
||||||
logging.statusWriter(self.tempStatusPath, 'Copying database.....,70')
|
logging.statusWriter(self.tempStatusPath, 'Copying database.....,70')
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
logging.writeToFile(f'DB Name Dump: {DataBaseName}')
|
||||||
##### SQLDUMP database into new directory
|
##### SQLDUMP database into new directory
|
||||||
|
|
||||||
command = "mysqldump %s --result-file %s/%s.sql" % (DataBaseName, self.tempPath, DataBaseName)
|
command = "mysqldump %s --result-file %s/%s.sql" % (DataBaseName, self.tempPath, DataBaseName)
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
logging.writeToFile(command)
|
||||||
|
|
||||||
retStatus, result = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
retStatus, result = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
if retStatus == 0:
|
if retStatus == 0:
|
||||||
@@ -2584,15 +2593,18 @@ $parameters = array(
|
|||||||
logging.statusWriter(self.tempStatusPath, 'Getting database...,20')
|
logging.statusWriter(self.tempStatusPath, 'Getting database...,20')
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path={WPsitepath}'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path={WPsitepath}'
|
||||||
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, VHuser, None, None, 1)
|
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
if stdoutput.find('Error:') == -1:
|
if stdoutput.find('Error:') == -1:
|
||||||
DataBaseName = stdoutput.rstrip("\n")
|
DataBaseName = stdoutput.rstrip("\n")
|
||||||
else:
|
else:
|
||||||
raise BaseException(stdoutput)
|
raise BaseException(stdoutput)
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
logging.writeToFile(f'DB Name: {DataBaseName}')
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path={WPsitepath}'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path={WPsitepath}'
|
||||||
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, VHuser, None, None, 1)
|
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
if stdoutput.find('Error:') == -1:
|
if stdoutput.find('Error:') == -1:
|
||||||
DataBaseUser = stdoutput.rstrip("\n")
|
DataBaseUser = stdoutput.rstrip("\n")
|
||||||
@@ -2666,9 +2678,16 @@ $parameters = array(
|
|||||||
|
|
||||||
logging.statusWriter(self.tempStatusPath, 'Copying DataBase.....,70')
|
logging.statusWriter(self.tempStatusPath, 'Copying DataBase.....,70')
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
logging.writeToFile(f'DB Name MySQL Dump: {DataBaseName}')
|
||||||
|
|
||||||
##### SQLDUMP database into new directory
|
##### SQLDUMP database into new directory
|
||||||
|
|
||||||
command = "mysqldump %s --result-file %s/%s.sql" % (DataBaseName, self.tempPath, DataBaseName)
|
command = "mysqldump %s --result-file %s/%s.sql" % (DataBaseName, self.tempPath, DataBaseName)
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
logging.writeToFile(command)
|
||||||
|
|
||||||
retStatus, result = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
retStatus, result = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
if retStatus == 0:
|
if retStatus == 0:
|
||||||
@@ -2775,7 +2794,7 @@ $parameters = array(
|
|||||||
logging.writeToFile("Downloading start")
|
logging.writeToFile("Downloading start")
|
||||||
sftp.get(str(remotepath), str(loaclpath))
|
sftp.get(str(remotepath), str(loaclpath))
|
||||||
|
|
||||||
command = "mv %s /home/backup"%loaclpath
|
command = "mv %s /home/backup/"%loaclpath
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
##### CHeck if Backup type is Only Database
|
##### CHeck if Backup type is Only Database
|
||||||
@@ -3834,8 +3853,6 @@ $parameters = array(
|
|||||||
|
|
||||||
from plogical.installUtilities import installUtilities
|
from plogical.installUtilities import installUtilities
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
|
|
||||||
|
|
||||||
###S#Backups
|
###S#Backups
|
||||||
elif BackupDestination == 'S3':
|
elif BackupDestination == 'S3':
|
||||||
uploadfilename = config['uploadfilename']
|
uploadfilename = config['uploadfilename']
|
||||||
@@ -3868,9 +3885,12 @@ $parameters = array(
|
|||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile("Error in downloadfile: ..%s"%str(msg))
|
logging.writeToFile("Error in downloadfile: ..%s"%str(msg))
|
||||||
|
|
||||||
command = "mv %s /home/backup" % FinalZipPath
|
|
||||||
|
|
||||||
|
command = "mv %s /home/backup/" % FinalZipPath
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
|
||||||
##### CHeck if Backup type is Only Database
|
##### CHeck if Backup type is Only Database
|
||||||
if BackupType == 'DataBase Backup':
|
if BackupType == 'DataBase Backup':
|
||||||
if (DomainName == "" and int(self.extraArgs['DesSiteID']) != -1):
|
if (DomainName == "" and int(self.extraArgs['DesSiteID']) != -1):
|
||||||
@@ -4470,6 +4490,7 @@ $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)
|
||||||
|
|
||||||
@@ -4696,7 +4717,6 @@ $parameters = array(
|
|||||||
|
|
||||||
if result == 0:
|
if result == 0:
|
||||||
raise BaseException(stdout)
|
raise BaseException(stdout)
|
||||||
|
|
||||||
############## 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
|
||||||
@@ -4837,6 +4857,7 @@ $parameters = array(
|
|||||||
if result == 0:
|
if result == 0:
|
||||||
raise BaseException(stdout)
|
raise BaseException(stdout)
|
||||||
|
|
||||||
|
|
||||||
logging.statusWriter(self.tempStatusPath, 'Copying Data File...,60')
|
logging.statusWriter(self.tempStatusPath, 'Copying Data File...,60')
|
||||||
###Copy backup content to newsite
|
###Copy backup content to newsite
|
||||||
if oldhome == "0":
|
if oldhome == "0":
|
||||||
|
|||||||
Reference in New Issue
Block a user