Skip to content

Commit

Permalink
set remote mysql during wp installer
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Jul 15, 2020
1 parent 6047a2a commit c5efc72
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plogical/applicationInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
from databases.models import Databases
from plogical.installUtilities import installUtilities
import shutil
from plogical.mailUtilities import mailUtilities
from plogical.processUtilities import ProcessUtilities

class ApplicationInstaller(multi.Thread):

LOCALHOST = 'localhost'

def __init__(self, installApp, extraArgs):
multi.Thread.__init__(self)
self.installApp = installApp
Expand Down Expand Up @@ -220,6 +221,17 @@ def installGit(self):
logging.writeToFile(str(msg) + ' [ApplicationInstaller.installGit]')

def dbCreation(self, tempStatusPath, website):
passFile = "/etc/cyberpanel/mysqlPassword"

try:
import json
jsonData = json.loads(open(passFile, 'r').read())

mysqlhost = jsonData['mysqlhost']
ApplicationInstaller.LOCALHOST = mysqlhost
except:
pass

try:
dbName = randomPassword.generate_pass()
dbUser = dbName
Expand Down Expand Up @@ -367,7 +379,7 @@ def installWordPress(self):
statusFile.writelines('Configuring the installation,40')
statusFile.close()

command = "wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=localhost --dbprefix=wp_ --allow-root --path=" + finalPath
command = "wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=%s --dbprefix=wp_ --allow-root --path=" % (ApplicationInstaller.LOCALHOST) + finalPath
ProcessUtilities.executioner(command, externalApp)

if home == '0':
Expand Down

0 comments on commit c5efc72

Please sign in to comment.