From 2c224d86337e620505152dc280cc6e9909af3ee2 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Wed, 3 Nov 2021 16:57:55 +0500 Subject: [PATCH] bug fix: wp staging --- websiteFunctions/StagingSetup.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/websiteFunctions/StagingSetup.py b/websiteFunctions/StagingSetup.py index 04b5a8f45..6178624b8 100644 --- a/websiteFunctions/StagingSetup.py +++ b/websiteFunctions/StagingSetup.py @@ -110,6 +110,14 @@ class StagingSetup(multi.Thread): logging.statusWriter(tempStatusPath, 'Domain successfully created..,15') + ### Get table prefix of master site + + command = '%s -d error_reporting=0 /usr/bin/wp config get table_prefix --allow-root --skip-plugins --skip-themes --path=%s' % ( + FinalPHPPath, masterPath) + TablePrefix = ProcessUtilities.outputExecutioner(command).rstrip('\n') + + ### + ## Creating WP Site and setting Database command = '%s -d error_reporting=0 /usr/bin/wp core download --path=%s' % (FinalPHPPath, path) @@ -122,6 +130,11 @@ class StagingSetup(multi.Thread): command = '%s -d error_reporting=0 /usr/bin/wp core config --dbname=%s --dbuser=%s --dbpass=%s --dbhost=%s:%s --path=%s' % (FinalPHPPath, dbNameRestore, dbUser, dbPassword, ApplicationInstaller.LOCALHOST, ApplicationInstaller.PORT, path) ProcessUtilities.executioner(command, website.externalApp) + ### Set table prefix + + command = '%s -d error_reporting=0 /usr/bin/wp config set table_prefix %s --path=%s' % (FinalPHPPath, TablePrefix , path) + ProcessUtilities.executioner(command, website.externalApp) + ## Exporting and importing database command = '%s -d error_reporting=0 /usr/bin/wp --allow-root --skip-plugins --skip-themes --path=%s db export %s/dbexport-stage.sql' % (FinalPHPPath, masterPath, path) @@ -132,6 +145,7 @@ class StagingSetup(multi.Thread): 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, path, path) ProcessUtilities.executioner(command) + try: command = 'rm -f %s/dbexport-stage.sql' % (path) ProcessUtilities.executioner(command)