mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
detached mode: instantly change php version
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -89,11 +89,19 @@ class StagingSetup(multi.Thread):
|
||||
|
||||
for items in data:
|
||||
if items.find('DB_NAME') > -1:
|
||||
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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user