Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix https://github.com/usmannasir/cyberpanel/issues/915 - Fresent LLC #950

Open
wants to merge 2 commits into
base: stable
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions plogical/backupUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ def startBackup(tempStoragePath, backupName, backupPath, metaPath=None):

domainName = backupMetaData.find('masterDomain').text

## Using childdomains to skip their docroot folder, we will copy them in another function
childDomains = backupMetaData.findall('ChildDomains/domain')

## Saving original vhost conf file

completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{domainName}/vhost.conf'
Expand All @@ -369,11 +372,32 @@ def startBackup(tempStoragePath, backupName, backupPath, metaPath=None):

from shutil import copytree

## Get All Subfolders Under Domain name
allSubfoldersUnderDomain = [f.name for f in os.scandir(f'/home/{domainName}')]
#allSubfoldersUnderDomain = [f.name for f in os.scandir(f'/home/{domainName}') if f.is_dir()]
for subfolder in allSubfoldersUnderDomain:
isChildDomainRoot = False
try:
for childDomain in childDomains:
childPath = childDomain.find('path').text
if(childPath == f'/home/{domainName}/{subfolder}'):
isChildDomainRoot = True
break
except BaseException as msg:
pass

if subfolder == 'logs' or subfolder == 'backup' or subfolder = '.ssh' or isChildDomainRoot:
continue

command = f'cp -R /home/{domainName}/{subfolder} {tempStoragePath}/{subfolder}'
if ProcessUtilities.normalExecutioner(command) == 0:
raise BaseException(f'Failed to run cp command during backup generation.')

#copytree('/home/%s/public_html' % domainName, '%s/%s' % (tempStoragePath, 'public_html'))
command = f'cp -R /home/{domainName}/public_html {tempStoragePath}/public_html'
#command = f'cp -R /home/{domainName}/public_html {tempStoragePath}/public_html'

if ProcessUtilities.normalExecutioner(command) == 0:
raise BaseException(f'Failed to run cp command during backup generation.')
#if ProcessUtilities.normalExecutioner(command) == 0:
# raise BaseException(f'Failed to run cp command during backup generation.')

# make_archive(os.path.join(tempStoragePath,"public_html"), 'gztar', os.path.join("/home",domainName,"public_html"))

Expand Down