@@ -471,11 +471,10 @@ def BackupRoot(tempStoragePath, backupName, backupPath, metaPath=None):
471471
472472 logging .CyberCPLogFileWriter .statusWriter (status , "Backing up email accounts..\n " )
473473
474- try :
475- make_archive (os .path .join (tempStoragePath , domainName ), 'gztar' , os .path .join ("/home" , "vmail" , domainName ))
476- except BaseException as msg :
477- pass
474+ emailPath = '/home/vmail/%s' % (domainName )
478475
476+ if os .path .exists (emailPath ):
477+ copy_tree (emailPath , '%s/vmail' % (tempStoragePath ))
479478
480479 ## shutil.make_archive. Creating final package.
481480
@@ -862,21 +861,32 @@ def startRestore(backupName, dir):
862861
863862 logging .CyberCPLogFileWriter .statusWriter (status , "Extracting email accounts!" )
864863
865- try :
866- pathToCompressedEmails = os .path .join (completPath , masterDomain + ".tar.gz" )
867- emailHome = os .path .join ("/home" ,"vmail" ,masterDomain )
864+ if not twoPointO :
868865
869- tar = tarfile . open ( pathToCompressedEmails )
870- tar . extractall ( emailHome )
871- tar . close ( )
866+ try :
867+ pathToCompressedEmails = os . path . join ( completPath , masterDomain + ".tar.gz" )
868+ emailHome = os . path . join ( "/home" , "vmail" , masterDomain )
872869
873- ## Change permissions
870+ tar = tarfile .open (pathToCompressedEmails )
871+ tar .extractall (emailHome )
872+ tar .close ()
874873
875- command = "chmod -r vmail:vmail " + emailHome
876- subprocess .call (shlex .split (command ))
874+ ## Change permissions
877875
878- except :
879- pass
876+ command = "chown -R vmail:vmail " + emailHome
877+ subprocess .call (shlex .split (command ))
878+
879+ except :
880+ pass
881+ else :
882+
883+ emailsPath = '%s/vmail' % (completPath )
884+
885+ if os .path .exists (emailsPath ):
886+ copy_tree (emailsPath , '/home/vmail/%s' % (masterDomain ))
887+
888+ command = "chown -R vmail:vmail /home/vmail/%s" % (masterDomain )
889+ ProcessUtilities .executioner (command )
880890
881891 ## emails extracted
882892
0 commit comments