Skip to content

Commit c397ba1

Browse files
committed
bug fix: deploy staging to production
1 parent 0cec3c5 commit c397ba1

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

websiteFunctions/StagingSetup.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ def startSyncing(self):
174174

175175
child = ChildDomains.objects.get(domain=childDomain)
176176

177+
from managePHP.phpManager import PHPManager
178+
php = PHPManager.getPHPString(child.master.phpSelection)
179+
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
180+
177181
try:
178182
import json
179183
from cloudAPI.models import WPDeployments
@@ -198,15 +202,15 @@ def startSyncing(self):
198202

199203
logging.statusWriter(tempStatusPath, 'Syncing databases..,10')
200204

201-
command = 'wp --allow-root --skip-plugins --skip-themes --path=%s db export %s/dbexport-stage.sql' % (child.path, masterPath)
205+
command = '%s -d error_reporting=0 /usr/bin/wp --allow-root --skip-plugins --skip-themes --path=%s db export %s/dbexport-stage.sql' % (FinalPHPPath, child.path, masterPath)
202206
result = ProcessUtilities.outputExecutioner(command)
203207

204208
if os.path.exists(ProcessUtilities.debugPath):
205209
logging.writeToFile(result)
206210

207211
## Restore to master domain
208212

209-
command = 'wp --allow-root --skip-plugins --skip-themes --path=%s --quiet db import %s/dbexport-stage.sql' % (masterPath, masterPath)
213+
command = '%s -d error_reporting=0 /usr/bin/wp --allow-root --skip-plugins --skip-themes --path=%s --quiet db import %s/dbexport-stage.sql' % (FinalPHPPath, masterPath, masterPath)
210214
result = ProcessUtilities.outputExecutioner(command)
211215

212216
if os.path.exists(ProcessUtilities.debugPath):
@@ -222,7 +226,7 @@ def startSyncing(self):
222226

223227
logging.statusWriter(tempStatusPath, 'Syncing data..,50')
224228

225-
command = 'wp theme path --allow-root --skip-plugins --skip-themes --path=%s' % (masterPath)
229+
command = '%s -d error_reporting=0 /usr/bin/wp theme path --allow-root --skip-plugins --skip-themes --path=%s' % (FinalPHPPath, masterPath)
226230
WpContentPath = ProcessUtilities.outputExecutioner(command).splitlines()[-1].replace('wp-content/themes', '')
227231

228232
if os.path.exists(ProcessUtilities.debugPath):
@@ -238,13 +242,20 @@ def startSyncing(self):
238242

239243
## Search and replace url
240244

241-
command = 'wp search-replace --allow-root --skip-plugins --skip-themes --path=%s "%s" "%s"' % (masterPath, child.domain, replaceDomain)
245+
command = '%s -d error_reporting=0 /usr/bin/wp search-replace --allow-root --skip-plugins --skip-themes --path=%s "%s" "%s"' % (FinalPHPPath, masterPath, child.domain, replaceDomain)
246+
result = ProcessUtilities.outputExecutioner(command)
247+
248+
if os.path.exists(ProcessUtilities.debugPath):
249+
logging.writeToFile(result)
250+
251+
command = '%s -d error_reporting=0 /usr/bin/wp search-replace --allow-root --skip-plugins --skip-themes --path=%s "www.%s" "%s"' % (FinalPHPPath,masterPath, child.domain, replaceDomain)
242252
result = ProcessUtilities.outputExecutioner(command)
243253

244254
if os.path.exists(ProcessUtilities.debugPath):
245255
logging.writeToFile(result)
246256

247-
command = 'wp search-replace --allow-root --skip-plugins --skip-themes --path=%s "www.%s" "%s"' % (masterPath, child.domain, replaceDomain)
257+
command = '%s -d error_reporting=0 /usr/bin/wp search-replace --allow-root --skip-plugins --skip-themes --path=%s "https://%s" "http://%s"' % (FinalPHPPath,
258+
masterPath, replaceDomain, replaceDomain)
248259
result = ProcessUtilities.outputExecutioner(command)
249260

250261
if os.path.exists(ProcessUtilities.debugPath):

0 commit comments

Comments
 (0)