Skip to content

Commit

Permalink
bug fix: shift to default package if package not exists on wp restore…
Browse files Browse the repository at this point in the history
… backup
  • Loading branch information
usmannasir committed Sep 29, 2024
1 parent b77c87a commit c4074db
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
9 changes: 6 additions & 3 deletions plogical/applicationInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2960,6 +2960,7 @@ def RestoreWPbackupNow(self):
import pysftp
import pysftp as sftp
import boto3

if os.path.exists(ProcessUtilities.debugPath):
logging.writeToFile("Restore WP backup Now ....... start:%s" % self.extraArgs['Domain'])

Expand All @@ -2979,7 +2980,11 @@ def RestoreWPbackupNow(self):
DatabaseNameold = config['DatabaseName']
DumpFileName = DatabaseNameold + ".sql"
oldurl = config['WPFinalURL']
packgobj = Package.objects.get(pk=config['Webpackage_id'])
try:
packgobj = Package.objects.get(pk=config['Webpackage_id'])
except:
packgobj = Package.objects.get(packageName='Default')

packegs = packgobj.packageName
WebOwnerobj = Administrator.objects.get(pk=config['Webadmin_id'])
WebOwner = WebOwnerobj.userName
Expand Down Expand Up @@ -6184,8 +6189,6 @@ def RestoreWPbackupNow(self):
time.sleep(2)




logging.statusWriter(self.tempStatusPath, 'Restoring site ....,30')
NewWPsite = WPSites.objects.get(FinalURL=newurl)
VHuser = NewWPsite.owner.externalApp
Expand Down
7 changes: 4 additions & 3 deletions plogical/phpUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ def GetPHPVersionFromFile(vhFile, domainName=None):
finalConfPath = ApacheVhost.configBasePath + domainName + '.conf'
if os.path.exists(finalConfPath):
command = f'grep -Eo -m 1 "php[0-9]+" {finalConfPath} | sed -n "1p"'
result = ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n')
php_version = ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n')

# Input string
php_version = "php73"
#php_version = "php73"

# Insert a period between '7' and '3' to convert it to 'php7.3'
converted_version = php_version[:4] + '.' + php_version[4:]
Expand Down Expand Up @@ -277,7 +277,8 @@ def WrapGetPHPVersionFromFileToGetVersionWithPHP(vhFile):
logging.CyberCPLogFileWriter.writeToFile(result)

command = result + " -v 2>/dev/null | awk '/^PHP/ {print $2}'"
php_version = ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n')
php_version = ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n')[:3]

return f"PHP {php_version}"

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions plogical/sslUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def getDNSRecords(virtualHostName):

except BaseException as msg:
return [0, "347 " + str(msg) + " [issueSSLForDomain]"]

@staticmethod
def PatchVhostConf(virtualHostName):
try:
Expand Down
3 changes: 3 additions & 0 deletions plogical/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
strr='8.0.30'

print(strr[:3])

0 comments on commit c4074db

Please sign in to comment.