diff --git a/cloudAPI/models.py b/cloudAPI/models.py index 4e6a8e76d..0e53a264a 100755 --- a/cloudAPI/models.py +++ b/cloudAPI/models.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- - from django.db import models - +from websiteFunctions.models import Websites # Create your models here. +class WPDeployments(models.Model): + owner = models.ForeignKey(Websites, on_delete=models.CASCADE) + config = models.TextField() \ No newline at end of file diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 7b64152d6..3882d10f5 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -476,6 +476,7 @@ $parameters = array( adminPassword = self.extraArgs['adminPassword'] adminEmail = self.extraArgs['adminEmail'] + FNULL = open(os.devnull, 'w') ### Check WP CLI @@ -520,7 +521,8 @@ $parameters = array( dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website.master) self.permPath = website.path - except: + except BaseException as msg: + website = Websites.objects.get(domain=domainName) externalApp = website.externalApp self.masterDomain = website.domain @@ -543,6 +545,7 @@ $parameters = array( dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website) self.permPath = '/home/%s/public_html' % (website.domain) + ## Security Check command = 'chmod 755 %s' % (self.permPath) @@ -568,7 +571,7 @@ $parameters = array( try: command = "wp core download --allow-root --path=%s --version=%s" % (finalPath, self.extraArgs['version']) - except BaseException as msg: + except: command = "wp core download --allow-root --path=" + finalPath ProcessUtilities.executioner(command, externalApp) @@ -607,6 +610,7 @@ $parameters = array( command = "wp plugin activate litespeed-cache --allow-root --path=" + finalPath ProcessUtilities.executioner(command, externalApp) + ## from filemanager.filemanager import FileManager @@ -1251,6 +1255,25 @@ $parameters = array( self.extraArgs['tempStatusPath'] = currentTemp + ### Save config in db + + from cloudAPI.models import WPDeployments + from websiteFunctions.models import Websites + import json + + website = Websites.objects.get(domain = self.extraArgs['domain']) + + del self.extraArgs['adminPassword'] + del self.extraArgs['password'] + del self.extraArgs['tempStatusPath'] + del self.extraArgs['domain'] + del self.extraArgs['adminEmail'] + del self.extraArgs['adminUser'] + del self.extraArgs['blogTitle'] + + wpDeploy = WPDeployments(owner=website, config=json.dumps(self.extraArgs)) + wpDeploy.save() + logging.statusWriter(self.extraArgs['tempStatusPath'], 'Completed [200].') except BaseException as msg: @@ -1290,10 +1313,10 @@ def main(): extraArgs['userName'] = args.userName extraArgs['version'] = args.version - try: + if args.path != None: extraArgs['path'] = args.path extraArgs['home'] = '0' - except: + else: extraArgs['home'] = '1' ai = ApplicationInstaller(None, extraArgs) diff --git a/s3Backups/s3Backups.py b/s3Backups/s3Backups.py index 19c543916..1085c1265 100755 --- a/s3Backups/s3Backups.py +++ b/s3Backups/s3Backups.py @@ -158,7 +158,6 @@ class S3Backups(multi.Thread): aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, endpoint_url=region, - config=Config(signature_version='v4') ) else: s3 = boto3.resource(