diff --git a/databases/models.py b/databases/models.py index 7c61ddf0d..73fc909c4 100755 --- a/databases/models.py +++ b/databases/models.py @@ -9,4 +9,4 @@ from websiteFunctions.models import Websites class Databases(models.Model): website = models.ForeignKey(Websites) dbName = models.CharField(max_length=50,unique=True) - dbUser = models.CharField(max_length=50, unique=True) + dbUser = models.CharField(max_length=50) diff --git a/plogical/cPanelImporter.py b/plogical/cPanelImporter.py index 0494691e5..6613b4e1a 100644 --- a/plogical/cPanelImporter.py +++ b/plogical/cPanelImporter.py @@ -212,6 +212,15 @@ class cPanelImporter: 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)) + counter = counter + 1 + except: + pass + result = virtualHostUtilities.createVirtualHost(DomainName, self.email, self.PHPVersion, externalApp, 0, 0, 0, 'admin', 'Default', 0) diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py index 8216a6307..91adf24fa 100755 --- a/plogical/processUtilities.py +++ b/plogical/processUtilities.py @@ -189,7 +189,7 @@ class ProcessUtilities(multi.Thread): # for items in CommandArgs: # finalCommand = '%s %s' % (finalCommand, items) - + #logging.writeToFile(command) if user == None: sock.sendall(ProcessUtilities.token + command) else: diff --git a/plogical/sslUtilities.py b/plogical/sslUtilities.py index 1dfe41294..ae0635132 100755 --- a/plogical/sslUtilities.py +++ b/plogical/sslUtilities.py @@ -254,6 +254,8 @@ class sslUtilities: + ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \ + ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force' + logging.CyberCPLogFileWriter.writeToFile(command) + output = subprocess.check_output(shlex.split(command)) logging.CyberCPLogFileWriter.writeToFile("Successfully obtained SSL for: " + virtualHostName + " and: www." + virtualHostName) diff --git a/plogical/vhost.py b/plogical/vhost.py index 0beb35272..148cd2596 100755 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -498,6 +498,7 @@ class vhost: @staticmethod def changePHP(vhFile, phpVersion): + phpDetachUpdatePath = '/home/%s/.lsphp_restart.txt' % (vhFile.split('/')[-2]) if ProcessUtilities.decideServer() == ProcessUtilities.OLS: try: if ApacheVhost.changePHP(phpVersion, vhFile) == 0: @@ -521,7 +522,14 @@ class vhost: writeDataToFile.close() + writeToFile = open(phpDetachUpdatePath, 'w') + writeToFile.close() + installUtilities.installUtilities.reStartLiteSpeed() + try: + os.remove(phpDetachUpdatePath) + except: + pass else: php = PHPManager.getPHPString(phpVersion) command = "systemctl restart php%s-php-fpm" % (php) @@ -556,7 +564,14 @@ class vhost: writeDataToFile.close() + writeToFile = open(phpDetachUpdatePath, 'w') + writeToFile.close() + installUtilities.installUtilities.reStartLiteSpeed() + try: + os.remove(phpDetachUpdatePath) + except: + pass print "1,None" return 1, 'None' diff --git a/websiteFunctions/StagingSetup.py b/websiteFunctions/StagingSetup.py index 11391732a..2a173bee8 100644 --- a/websiteFunctions/StagingSetup.py +++ b/websiteFunctions/StagingSetup.py @@ -89,11 +89,19 @@ class StagingSetup(multi.Thread): for items in data: if items.find('DB_NAME') > -1: - dbName = items.split("'")[3] - if mysqlUtilities.createDatabaseBackup(dbName, '/home/cyberpanel'): - break - else: - raise BaseException('Failed to create database backup.') + try: + dbName = items.split("'")[3] + if mysqlUtilities.createDatabaseBackup(dbName, '/home/cyberpanel'): + break + else: + raise BaseException('Failed to create database backup.') + except: + dbName = items.split('"')[1] + if mysqlUtilities.createDatabaseBackup(dbName, '/home/cyberpanel'): + break + else: + raise BaseException('Failed to create database backup.') + databasePath = '%s/%s.sql' % ('/home/cyberpanel', dbName)