add further debugging to cpanel importerg

This commit is contained in:
usmannasir
2024-10-10 22:40:56 +05:00
parent f25485ae07
commit 0804176c6d
2 changed files with 26 additions and 0 deletions

View File

@@ -116,6 +116,8 @@ Subject: %s
@staticmethod
def statusWriter(tempStatusPath, mesg, append = None):
try:
if os.path.exists('/usr/local/CyberCP/debug'):
print(mesg)
if append == None:
statusFile = open(tempStatusPath, 'w')
else:

View File

@@ -71,10 +71,17 @@ class cPanelImporter:
self.MainSite = value
self.PHPVersion = value[9]
self.InheritPHP = self.PHPDecider(None)
if os.path.exists(ProcessUtilities.debugPath):
print(f'Main domain: {self.MainSite}, MainSite php version or version to be used for sites with no PHP {self.InheritPHP}')
else:
self.OtherDomainNames.append(key)
self.OtherDomains.append(value)
if os.path.exists(ProcessUtilities.debugPath):
print(f'Other domains: {key}, Value {str(value)}')
except BaseException as msg:
print(str(msg))
@@ -773,9 +780,18 @@ class cPanelImporter:
####
if os.path.exists(ProcessUtilities.debugPath):
logging.statusWriter(self.logFile, f'Content of user data before starting to restore emails {str(UserData)}')
for items in os.listdir(UserData):
FinalMailDomainPath = '%s/%s' % (UserData, items)
if os.path.exists(ProcessUtilities.debugPath):
logging.statusWriter(self.logFile,
f'Final email path for {items} is {str(FinalMailDomainPath)}')
if os.path.isdir(FinalMailDomainPath):
if items[0] == '.':
continue
@@ -804,6 +820,10 @@ class cPanelImporter:
MailPathInBackup = '%s/%s' % (FinalMailDomainPath, it)
if os.path.exists(ProcessUtilities.debugPath):
logging.statusWriter(self.logFile,
f'Mail path in backup for {items} is {str(MailPathInBackup)}')
command = 'mv %s %s/Maildir' % (MailPathInBackup, MailPath)
subprocess.call(command, shell=True)
@@ -819,6 +839,10 @@ class cPanelImporter:
MailPathInBackup = '%s/%s' % (FinalMailDomainPath, it)
if os.path.exists(ProcessUtilities.debugPath):
logging.statusWriter(self.logFile,
f'Mail path in backup for {items} is {str(MailPathInBackup)}')
command = 'mv %s %s/Mdbox' % (MailPathInBackup, MailPath)
subprocess.call(command, shell=True)