mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 05:45:59 +01:00
bug fix: backup creation
This commit is contained in:
@@ -340,8 +340,7 @@ def get_backup_status(request):
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||||
|
|
||||||
if (status[:16] == "/home/cyberpanel" or status[:4] == '/tmp' or status[:18] == '/usr/local/CyberCP') \
|
if ACLManager.CheckStatusFilleLoc(status):
|
||||||
and status != '/usr/local/CyberCP/CyberCP/settings.py' and status.find('..') == -1:
|
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "100",
|
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "100",
|
||||||
|
|||||||
@@ -809,4 +809,15 @@ class ACLManager:
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def CheckStatusFilleLoc(statusFile):
|
||||||
|
if (statusFile[:18] != "/home/cyberpanel/." or statusFile[:16] == "/home/cyberpanel" or statusFile[
|
||||||
|
:4] == '/tmp' or statusFile[
|
||||||
|
:18] == '/usr/local/CyberCP') \
|
||||||
|
and statusFile != '/usr/local/CyberCP/CyberCP/settings.py' and statusFile.find(
|
||||||
|
'..') == -1 and statusFile != '/home/cyberpanel/.my.cnf' and statusFile != '/home/cyberpanel/.bashrc' and statusFile != '/home/cyberpanel/.bash_logout' and statusFile != '/home/cyberpanel/.profile':
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -284,18 +284,16 @@ class backupUtilities:
|
|||||||
|
|
||||||
## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52/meta.xml -- metaPath
|
## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52/meta.xml -- metaPath
|
||||||
|
|
||||||
metaPath = '%s/%s' % (tempStoragePath, str(randint(1000, 9999)))
|
metaPath = '/tmp/%s' % (str(randint(1000, 9999)))
|
||||||
|
|
||||||
if os.path.exists(ProcessUtilities.debugPath):
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Path to meta file {metaPath}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Path to meta file {metaPath}')
|
||||||
|
|
||||||
xmlpretty = prettify(metaFileXML).encode('ascii', 'ignore')
|
xmlpretty = prettify(metaFileXML).encode('ascii', 'ignore')
|
||||||
# metaFile = open(metaPath, 'w')
|
metaFile = open(metaPath, 'w')
|
||||||
# metaFile.write(xmlpretty.decode())
|
metaFile.write(xmlpretty.decode())
|
||||||
# metaFile.close()
|
metaFile.close()
|
||||||
#os.chmod(metaPath, 0o600)
|
os.chmod(metaPath, 0o600)
|
||||||
|
|
||||||
MetaContent = xmlpretty.decode()
|
|
||||||
|
|
||||||
## meta generated
|
## meta generated
|
||||||
|
|
||||||
@@ -1999,11 +1997,11 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
# command = 'chown %s:%s %s' % (website.externalApp, website.externalApp, result[2])
|
command = 'chown %s:%s %s' % (website.externalApp, website.externalApp, result[2])
|
||||||
# ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
#logging.CyberCPLogFileWriter.writeToFile(backupPath)
|
logging.CyberCPLogFileWriter.writeToFile(backupPath)
|
||||||
#logging.CyberCPLogFileWriter.writeToFile(tempStoragePath)
|
logging.CyberCPLogFileWriter.writeToFile(tempStoragePath)
|
||||||
|
|
||||||
execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||||
execPath = execPath + " startBackup --tempStoragePath " + tempStoragePath + " --backupName " \
|
execPath = execPath + " startBackup --tempStoragePath " + tempStoragePath + " --backupName " \
|
||||||
|
|||||||
@@ -273,8 +273,6 @@ class virtualHostUtilities:
|
|||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Website successfully created. [200]')
|
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Website successfully created. [200]')
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile ("hello world [createVirtualHost]")
|
|
||||||
|
|
||||||
return 1, 'None'
|
return 1, 'None'
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
|
|||||||
@@ -1854,10 +1854,7 @@ class WebsiteManager:
|
|||||||
try:
|
try:
|
||||||
statusFile = data['statusFile']
|
statusFile = data['statusFile']
|
||||||
|
|
||||||
if (statusFile[:18] != "/home/cyberpanel/." or statusFile[:16] == "/home/cyberpanel" or statusFile[:4] == '/tmp' or statusFile[
|
if ACLManager.CheckStatusFilleLoc(statusFile):
|
||||||
:18] == '/usr/local/CyberCP') \
|
|
||||||
and statusFile != '/usr/local/CyberCP/CyberCP/settings.py' and statusFile.find(
|
|
||||||
'..') == -1 and statusFile != '/home/cyberpanel/.my.cnf' and statusFile != '/home/cyberpanel/.bashrc' and statusFile != '/home/cyberpanel/.bash_logout' and statusFile != '/home/cyberpanel/.profile':
|
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "100",
|
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "100",
|
||||||
|
|||||||
Reference in New Issue
Block a user