From 186cffc3a6c3232933c38fac7a7a440773f38ffc Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Sat, 18 Jun 2022 17:23:09 +0500 Subject: [PATCH 1/2] db manager --- .../templates/userManagment/userProfile.html | 2 - .../websiteFunctions/websiteFunctions.js | 44 +++++++++++++++ .../websiteFunctions/WPsiteHome.html | 45 +++++++++++++-- .../websiteFunctions/WPsitesList.html | 48 +++++++--------- websiteFunctions/urls.py | 1 + websiteFunctions/views.py | 21 +++++++ websiteFunctions/website.py | 56 +++++++++++++++++++ 7 files changed, 181 insertions(+), 36 deletions(-) diff --git a/userManagment/templates/userManagment/userProfile.html b/userManagment/templates/userManagment/userProfile.html index 1647d7550..1fd6a1446 100755 --- a/userManagment/templates/userManagment/userProfile.html +++ b/userManagment/templates/userManagment/userProfile.html @@ -61,8 +61,6 @@ - - diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index baea452ff..8603eee50 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -1237,6 +1237,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo }; $scope.fetchstaging = function () { + $('#wordpresshomeloading').show(); $scope.wordpresshomeloading = false; @@ -1285,6 +1286,49 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo }; + $scope.fetchDatabase = function () { + + $('#wordpresshomeloading').show(); + $scope.wordpresshomeloading = false; + + var url = "/websites/fetchDatabase"; + + var data = { + WPid: $('#WPid').html(), + } + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + wordpresshomeloading = true; + $('#wordpresshomeloading').hide(); + + if (response.data.status === 1) { + $('#DB_Name').html(response.data.DataBaseName); + $('#DB_User').html(response.data.DataBaseUser); + $('#tableprefix').html(response.data.tableprefix); + } else { + alert("Error data.error_message:" + response.data.error_message) + + } + } + + function cantLoadInitialDatas(response) { + $('#wordpresshomeloading').hide(); + alert("Error" + response) + + } + + }; + $scope.SaveUpdateConfig = function () { $('#wordpresshomeloading').show(); var data = { diff --git a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html index 0a6fbec1c..e2962d707 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html @@ -30,7 +30,6 @@

-
@@ -65,7 +63,7 @@ Open
+
+
+

+ {% trans "Database for" %} {{ wpsite.title }} +

+
+
+ + +
+ +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+

diff --git a/websiteFunctions/templates/websiteFunctions/WPsitesList.html b/websiteFunctions/templates/websiteFunctions/WPsitesList.html index 3c5bc8c39..47d60824b 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsitesList.html +++ b/websiteFunctions/templates/websiteFunctions/WPsitesList.html @@ -99,16 +99,10 @@ - - - - - - + + + + @@ -116,29 +110,27 @@ {% for sub in wpsite %} - -
WordPress Site Title - WP-Login - Domain - Action - WordPress Site TitleLoginDomainAction
+

{{ sub.title }}

-
- WP-admin - - - - + + + + Date: Sat, 18 Jun 2022 18:13:13 +0500 Subject: [PATCH 2/2] db manager --- plogical/applicationInstaller.py | 24 ++++++++++++++++++- .../websiteFunctions/WPsiteHome.html | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 2ed06f75e..2fcbe0a95 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -2869,6 +2869,9 @@ $parameters = array( if stdout.find('Error:') > -1: raise BaseException(stdout) + command = f'sudo -u {VHuser} /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp litespeed-purge all --path={newWPpath}' + ProcessUtilities.outputExecutioner(command, None, None, None, 1) + # ##Remove temppath command = f'rm -rf {self.tempPath}' result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) @@ -2973,6 +2976,9 @@ $parameters = array( if stdout.find('Error:') > -1: raise BaseException(stdout) + command = f'sudo -u {VHuser} /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp litespeed-purge all --path={newWPpath}' + ProcessUtilities.outputExecutioner(command, None, None, None, 1) + # ##Remove temppath command = f'rm -rf {self.tempPath}' result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) @@ -2991,7 +2997,6 @@ $parameters = array( FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) - ### Create secure folder ACLManager.CreateSecureDir() @@ -3066,6 +3071,9 @@ $parameters = array( if stdout.find('Error:') > -1: raise BaseException(stdout) + command = f'sudo -u {VHuser} /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp litespeed-purge all --path={WPpath}' + ProcessUtilities.outputExecutioner(command, None, None, None, 1) + # ##Remove temppath command = f'rm -rf {self.tempPath}' result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) @@ -3213,6 +3221,9 @@ $parameters = array( if stdout.find('Error:') > -1: raise BaseException(stdout) + command = f'sudo -u {VHuser} /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp litespeed-purge all --path={newWPpath}' + ProcessUtilities.outputExecutioner(command, None, None, None, 1) + ##Remove temppath command = f'rm -rf {self.tempPath}' result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) @@ -3385,6 +3396,9 @@ $parameters = array( if stdout.find('Error:') > -1: raise BaseException(stdout) + command = f'sudo -u {VHuser} /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp litespeed-purge all --path={newWPpath}' + ProcessUtilities.outputExecutioner(command, None, None, None, 1) + # ##Remove temppath command = f'rm -rf {self.tempPath}' result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) @@ -3542,6 +3556,9 @@ $parameters = array( if stdout.find('Error:') > -1: raise BaseException(stdout) + command = f'sudo -u {VHuser} /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp litespeed-purge all --path={WPpath}' + ProcessUtilities.outputExecutioner(command, None, None, None, 1) + # ##Remove temppath command = f'rm -rf {self.tempPath}' result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) @@ -3757,6 +3774,10 @@ $parameters = array( if stdout.find('Error:') > -1: raise BaseException(stdout) + command = f'sudo -u {VHuser} /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp litespeed-purge all --path={newWPpath}' + ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + ##Remove temppath command = f'rm -rf {self.tempPath}' result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) @@ -3770,6 +3791,7 @@ $parameters = array( installUtilities.reStartLiteSpeed() + logging.statusWriter(self.tempStatusPath, 'Completed.[200]') except BaseException as msg: logging.writeToFile("Error RestoreWPbackupNow ....... %s" % str(msg)) diff --git a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html index e2962d707..4f01697ec 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html @@ -418,7 +418,7 @@