git manager initial

This commit is contained in:
Usman Nasir
2020-03-07 19:01:54 +05:00
parent acdcfcb797
commit 2dc5ecd361
8 changed files with 148 additions and 31 deletions

View File

@@ -491,4 +491,30 @@ class FileManager:
return HttpResponse(json_data)
except BaseException as msg:
return self.ajaxPre(0, str(msg))
return self.ajaxPre(0, str(msg))
def fixPermissions(self, domainName):
website = Websites.objects.get(domain=domainName)
externalApp = website.externalApp
command = 'chown -R %s:%s /home/%s/public_html/*' % (externalApp, externalApp, domainName)
ProcessUtilities.popenExecutioner(command)
command = 'chown -R %s:%s /home/%s/public_html/.[^.]*' % (externalApp, externalApp, domainName)
ProcessUtilities.popenExecutioner(command)
command = "chown root:nobody /home/" + domainName + "/logs"
ProcessUtilities.popenExecutioner(command)
command = "find %s -type d -exec chmod 0755 {} \;" % ("/home/" + domainName + "/public_html")
ProcessUtilities.popenExecutioner(command)
command = "find %s -type f -exec chmod 0644 {} \;" % ("/home/" + domainName + "/public_html")
ProcessUtilities.popenExecutioner(command)
command = 'chown %s:nobody /home/%s/public_html' % (externalApp, domainName)
ProcessUtilities.executioner(command)
command = 'chmod 750 /home/%s/public_html' % (domainName)
ProcessUtilities.executioner(command)