Skip to content

Commit

Permalink
bug fix cPanel Importer: Import All emails folder
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Aug 22, 2019
1 parent 6122859 commit 38779d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion plogical/backupSchedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def createLocalBackup(virtualHost, backupLogPath):
os.remove(pathToFile)
except:
pass
logging.CyberCPLogFileWriter.writeToFile(tempStoragePath)
return 1, tempStoragePath

elif status.find("[5009]") > -1:
Expand Down
14 changes: 10 additions & 4 deletions plogical/cPanelImporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,26 +784,32 @@ def RestoreEmails(self):

if self.mailFormat == cPanelImporter.MailDir:
eUser.mail = 'maildir:/home/vmail/%s/%s/Maildir' % (items, it)
MailPath = '/home/vmail/%s/%s/Maildir/' % (items, it)
MailPath = '/home/vmail/%s/%s' % (items, it)

command = 'mkdir -p %s' % (MailPath)
ProcessUtilities.normalExecutioner(command)

command = 'rm -rf %s/Maildir' % (MailPath)
ProcessUtilities.normalExecutioner(command)

MailPathInBackup = '%s/%s' % (FinalMailDomainPath, it)

command = 'cp -R %s/* %s' % (MailPathInBackup, MailPath)
command = 'mv %s %s/Maildir' % (MailPathInBackup, MailPath)
subprocess.call(command, shell=True)

else:
eUser.mail = 'mdbox:/home/vmail/%s/%s/Mdbox' % (items, it)
MailPath = '/home/vmail/%s/%s/Mdbox/' % (items, it)
MailPath = '/home/vmail/%s/%s' % (items, it)

command = 'mkdir -p %s' % (MailPath)
ProcessUtilities.normalExecutioner(command)

command = 'rm -rf %s/Mdbox' % (MailPath)
ProcessUtilities.normalExecutioner(command)

MailPathInBackup = '%s/%s' % (FinalMailDomainPath, it)

command = 'cp -R %s/* %s' % (MailPathInBackup, MailPath)
command = 'mv %s %s/Mdbox' % (MailPathInBackup, MailPath)
subprocess.call(command, shell=True)

## Also update password
Expand Down

0 comments on commit 38779d5

Please sign in to comment.