Skip to content

Commit c5efc72

Browse files
committed
set remote mysql during wp installer
1 parent 6047a2a commit c5efc72

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

plogical/applicationInstaller.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
from databases.models import Databases
1717
from plogical.installUtilities import installUtilities
1818
import shutil
19-
from plogical.mailUtilities import mailUtilities
2019
from plogical.processUtilities import ProcessUtilities
2120

2221
class ApplicationInstaller(multi.Thread):
2322

23+
LOCALHOST = 'localhost'
24+
2425
def __init__(self, installApp, extraArgs):
2526
multi.Thread.__init__(self)
2627
self.installApp = installApp
@@ -220,6 +221,17 @@ def installGit(self):
220221
logging.writeToFile(str(msg) + ' [ApplicationInstaller.installGit]')
221222

222223
def dbCreation(self, tempStatusPath, website):
224+
passFile = "/etc/cyberpanel/mysqlPassword"
225+
226+
try:
227+
import json
228+
jsonData = json.loads(open(passFile, 'r').read())
229+
230+
mysqlhost = jsonData['mysqlhost']
231+
ApplicationInstaller.LOCALHOST = mysqlhost
232+
except:
233+
pass
234+
223235
try:
224236
dbName = randomPassword.generate_pass()
225237
dbUser = dbName
@@ -367,7 +379,7 @@ def installWordPress(self):
367379
statusFile.writelines('Configuring the installation,40')
368380
statusFile.close()
369381

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

373385
if home == '0':

0 commit comments

Comments
 (0)