2525from plogical .virtualHostUtilities import virtualHostUtilities
2626from plogical .mailUtilities import mailUtilities
2727from mailServer .models import EUsers
28+ import time
2829
2930class ChildDomains :
3031
@@ -48,6 +49,7 @@ def __init__(self, backupFile, logFile):
4849 self .homeDir = ''
4950 self .documentRoot = ''
5051 self .mailFormat = 1
52+ self .externalApp = ''
5153
5254 def PHPDecider (self ):
5355
@@ -209,18 +211,21 @@ def CreateMainWebsite(self):
209211 message = 'Calling core to create %s.' % (DomainName )
210212 logging .statusWriter (self .logFile , message , 1 )
211213
212- externalApp = "" .join (re .findall ("[a-zA-Z]+" , DomainName ))[:7 ]
214+ self . externalApp = "" .join (re .findall ("[a-zA-Z]+" , DomainName ))[:7 ]
213215
214216 try :
215217 counter = 0
216- while 1 :
217- tWeb = Websites .objects .get (externalApp = externalApp )
218- externalApp = '%s%s' % (tWeb .externalApp , str (counter ))
218+ while True :
219+ tWeb = Websites .objects .get (externalApp = self . externalApp )
220+ self . externalApp = '%s%s' % (tWeb .externalApp , str (counter ))
219221 counter = counter + 1
220- except :
221- pass
222+ print self .externalApp
223+ except BaseException , msg :
224+ logging .statusWriter (self .logFile , str (msg ), 1 )
225+ time .sleep (2 )
226+
222227
223- result = virtualHostUtilities .createVirtualHost (DomainName , self .email , self .PHPVersion , externalApp , 0 , 0 ,
228+ result = virtualHostUtilities .createVirtualHost (DomainName , self .email , self .PHPVersion , self . externalApp , 0 , 0 ,
224229 0 , 'admin' , 'Default' , 0 )
225230
226231 if result [0 ] == 1 :
@@ -278,7 +283,7 @@ def CreateMainWebsite(self):
278283
279284 shutil .copytree (movePath , nowPath , symlinks = True )
280285
281- command = 'chown -R %s:%s %s' % (externalApp , externalApp , nowPath )
286+ command = 'chown -R %s:%s %s' % (self . externalApp , self . externalApp , nowPath )
282287 ProcessUtilities .normalExecutioner (command )
283288
284289 message = 'Main site %s created from archive file: %s' % (DomainName , self .backupFile )
@@ -708,7 +713,7 @@ def RestoreDatabases(self):
708713 return 0
709714
710715 def FixPermissions (self ):
711- externalApp = "" . join ( re . findall ( "[a-zA-Z]+" , self .mainDomain ))[: 7 ]
716+ externalApp = self .externalApp
712717 command = "sudo chown -R " + externalApp + ":" + externalApp + " /home/" + self .mainDomain
713718 ProcessUtilities .normalExecutioner (command )
714719
0 commit comments