Skip to content
Permalink
Browse files

bug fix: resolve user conflicts

  • Loading branch information
usmannasir committed Nov 12, 2019
1 parent 8138d0f commit dd3a5511af74f8417fa4648f2d6cea9ae6fe8e7e
Showing with 14 additions and 9 deletions.
  1. +14 −9 plogical/cPanelImporter.py
@@ -25,6 +25,7 @@
from plogical.virtualHostUtilities import virtualHostUtilities
from plogical.mailUtilities import mailUtilities
from mailServer.models import EUsers
import time

class ChildDomains:

@@ -48,6 +49,7 @@ def __init__(self, backupFile, logFile):
self.homeDir = ''
self.documentRoot = ''
self.mailFormat = 1
self.externalApp = ''

def PHPDecider(self):

@@ -209,18 +211,21 @@ def CreateMainWebsite(self):
message = 'Calling core to create %s.' % (DomainName)
logging.statusWriter(self.logFile, message, 1)

externalApp = "".join(re.findall("[a-zA-Z]+", DomainName))[:7]
self.externalApp = "".join(re.findall("[a-zA-Z]+", DomainName))[:7]

try:
counter = 0
while 1:
tWeb = Websites.objects.get(externalApp=externalApp)
externalApp = '%s%s' % (tWeb.externalApp, str(counter))
while True:
tWeb = Websites.objects.get(externalApp=self.externalApp)
self.externalApp = '%s%s' % (tWeb.externalApp, str(counter))
counter = counter + 1
except:
pass
print self.externalApp
except BaseException, msg:
logging.statusWriter(self.logFile, str(msg), 1)
time.sleep(2)


result = virtualHostUtilities.createVirtualHost(DomainName, self.email, self.PHPVersion, externalApp, 0, 0,
result = virtualHostUtilities.createVirtualHost(DomainName, self.email, self.PHPVersion, self.externalApp, 0, 0,
0, 'admin', 'Default', 0)

if result[0] == 1:
@@ -278,7 +283,7 @@ def CreateMainWebsite(self):

shutil.copytree(movePath, nowPath, symlinks=True)

command = 'chown -R %s:%s %s' % (externalApp, externalApp, nowPath)
command = 'chown -R %s:%s %s' % (self.externalApp, self.externalApp, nowPath)
ProcessUtilities.normalExecutioner(command)

message = 'Main site %s created from archive file: %s' % (DomainName, self.backupFile)
@@ -708,7 +713,7 @@ def RestoreDatabases(self):
return 0

def FixPermissions(self):
externalApp = "".join(re.findall("[a-zA-Z]+", self.mainDomain))[:7]
externalApp = self.externalApp
command = "sudo chown -R " + externalApp + ":" + externalApp + " /home/" + self.mainDomain
ProcessUtilities.normalExecutioner(command)

0 comments on commit dd3a551

Please sign in to comment.
You can’t perform that action at this time.