Skip to content

Commit

Permalink
bug fix: joomla install following new perm structure
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Feb 21, 2020
1 parent 794a4f6 commit f15619d
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions plogical/applicationInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,15 @@ def installWPCLI(self):
except BaseException as msg:
logging.writeToFile(str(msg) + ' [ApplicationInstaller.installWPCLI]')

def dataLossCheck(self, finalPath, tempStatusPath):
def dataLossCheck(self, finalPath, externalApp):
return 1

dirFiles = os.listdir(finalPath)
command = 'ls -la %s' % (finalPath)
output = ProcessUtilities.outputExecutioner(command, 'nobody').splitlines()

if len(dirFiles) <= 3:
logging.writeToFile(str(output))

if len(output) <= 3:
return 1
else:
return 0
Expand Down Expand Up @@ -775,13 +779,17 @@ def installJoomla(self):

FNULL = open(os.devnull, 'w')

permPath = '/home/%s/public_html' % (domainName)
command = 'chmod 755 %s' % (permPath)
ProcessUtilities.executioner(command)

if not os.path.exists(finalPath):
os.makedirs(finalPath)

## checking for directories/files

if self.dataLossCheck(finalPath, tempStatusPath) == 0:
return 0
raise BaseException('Directory is not empty.')

## Get Joomla

Expand All @@ -794,7 +802,7 @@ def installJoomla(self):
statusFile = open(tempStatusPath, 'w')
statusFile.writelines("File already exists." + " [404]")
statusFile.close()
return 0
raise BaseException('File already exists.')

command = 'unzip ' + finalPath + 'staging.zip -d ' + finalPath
ProcessUtilities.executioner(command, virtualHostUser)
Expand Down Expand Up @@ -898,6 +906,10 @@ def installJoomla(self):

installUtilities.reStartLiteSpeedSocket()

permPath = '/home/%s/public_html' % (domainName)
command = 'chmod 750 %s' % (permPath)
ProcessUtilities.executioner(command)

statusFile = open(tempStatusPath, 'w')
statusFile.writelines("Successfully Installed. [200]")
statusFile.close()
Expand All @@ -919,6 +931,10 @@ def installJoomla(self):
except:
pass

permPath = '/home/%s/public_html' % (domainName)
command = 'chmod 755 %s' % (permPath)
ProcessUtilities.executioner(command)

statusFile = open(tempStatusPath, 'w')
statusFile.writelines(str(msg) + " [404]")
statusFile.close()
Expand Down

0 comments on commit f15619d

Please sign in to comment.