This commit is contained in:
habi
2022-05-24 11:16:49 +05:00
parent 70270ea9c5
commit 6e6aa04850
11 changed files with 2193 additions and 9 deletions

View File

@@ -24,7 +24,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'xr%j*p!*$0d%(-(e%@-*hyoz4$f%y77coq0u)6pwmjg4)q&19f' SECRET_KEY = 'xr%j*p!*$0d%(-(e%@-*hyoz4$f%y77coq0u)6pwmjg4)q&19f'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = True
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']

View File

@@ -405,7 +405,7 @@
title="{% trans 'Create Worpress' %}"><span>{% trans "Create Worpress" %}</span></a> title="{% trans 'Create Worpress' %}"><span>{% trans "Create Worpress" %}</span></a>
</li> </li>
{% endif %} {% endif %}
<li><a href="#" <li><a href="{% url 'ListWPSites' %}"
title="{% trans 'List Websites' %}"><span>{% trans "List Worpress" %}</span></a> title="{% trans 'List Websites' %}"><span>{% trans "List Worpress" %}</span></a>
</li> </li>
<li><a href="{% url 'ConfigurePlugins' %}" <li><a href="{% url 'ConfigurePlugins' %}"

View File

@@ -542,6 +542,32 @@ class ACLManager:
return websiteNames return websiteNames
@staticmethod
def getPHPString(phpVersion):
if phpVersion == "PHP 5.3":
php = "53"
elif phpVersion == "PHP 5.4":
php = "54"
elif phpVersion == "PHP 5.5":
php = "55"
elif phpVersion == "PHP 5.6":
php = "56"
elif phpVersion == "PHP 7.0":
php = "70"
elif phpVersion == "PHP 7.1":
php = "71"
elif phpVersion == "PHP 7.2":
php = "72"
elif phpVersion == "PHP 7.3":
php = "73"
elif phpVersion == "PHP 7.4":
php = "74"
elif phpVersion == "PHP 8.0":
php = "80"
return php
@staticmethod @staticmethod
def searchWebsiteObjects(currentACL, userID, searchTerm): def searchWebsiteObjects(currentACL, userID, searchTerm):

View File

@@ -64,6 +64,16 @@ class ApplicationInstaller(multi.Thread):
self.installMautic() self.installMautic()
elif self.installApp == 'wordpressInstallNew': elif self.installApp == 'wordpressInstallNew':
self.wordpressInstallNew() self.wordpressInstallNew()
elif self.installApp == 'UpdateWPTheme':
self.UpdateWPTheme()
elif self.installApp == 'UpdateWPPlugin':
self.UpdateWPPlugin()
elif self.installApp == 'DeleteThemes':
self.DeleteThemes()
elif self.installApp == 'DeletePlugins':
self.DeletePlugins()
elif self.installApp == 'ChangeStatusThemes':
self.ChangeStatusThemes()
except BaseException as msg: except BaseException as msg:
logging.writeToFile(str(msg) + ' [ApplicationInstaller.run]') logging.writeToFile(str(msg) + ' [ApplicationInstaller.run]')
@@ -1633,7 +1643,6 @@ $parameters = array(
try: try:
from websiteFunctions.website import WebsiteManager from websiteFunctions.website import WebsiteManager
import json import json
logging.CyberCPLogFileWriter.writeToFile("start wordpressInstallNew...." )
tempStatusPath = self.data['tempStatusPath'] tempStatusPath = self.data['tempStatusPath']
statusFile = open(tempStatusPath, 'w') statusFile = open(tempStatusPath, 'w')
statusFile.writelines('Creating Website...') statusFile.writelines('Creating Website...')
@@ -1726,6 +1735,157 @@ $parameters = array(
logging.CyberCPLogFileWriter.writeToFile("Error WP web creating ....... %s" % str(msg)) logging.CyberCPLogFileWriter.writeToFile("Error WP web creating ....... %s" % str(msg))
return 0 return 0
def UpdateWPTheme(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser=self.data['Vhuser']
path=self.data['path']
if self.data['Theme'] == 'all':
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update --all --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif self.data['Theme'] == 'selected':
ThemeList = ''
for plugin in self.data['Themearray']:
ThemeList = '%s %s' % (ThemeList, plugin)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, ThemeList, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, self.data['Theme'], path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP UpdateWPTheme ....... %s" % str(msg))
return 0
def UpdateWPPlugin(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser=self.data['Vhuser']
path=self.data['path']
if self.data['plugin'] == 'all':
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update --all --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif self.data['plugin'] == 'selected':
pluginsList = ''
for plug in self.data['pluginarray']:
pluginsList = '%s %s' % (pluginsList, plug)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin update %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, pluginsList, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme update %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, self.data['plugin'], path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP UpdateWPTheme ....... %s" % str(msg))
return 0
def DeleteThemes(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser = self.data['Vhuser']
path = self.data['path']
if self.data['Theme'] == 'selected':
ThemeList = ''
for plugin in self.data['Themearray']:
ThemeList = '%s %s' % (ThemeList, plugin)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme delete %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, ThemeList, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme delete %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, self.data['Theme'], path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP DeleteThemes ....... %s" % str(msg))
return 0
def DeletePlugins(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser = self.data['Vhuser']
path = self.data['path']
plugin = self.data['plugin']
pluginarray = self.data['pluginarray']
if plugin == 'selected':
pluginsList = ''
for plug in pluginarray:
pluginsList = '%s %s' % (pluginsList, plug)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin delete %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, pluginsList, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin delete %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP DeletePlugins ....... %s" % str(msg))
return 0
def ChangeStatusThemes(self):
try:
FinalPHPPath = self.data['FinalPHPPath']
Vhuser = self.data['Vhuser']
path = self.data['path']
Theme = self.data['Theme']
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme status %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, Theme, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if stdoutput.find('Status: Active') > -1:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme deactivate %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, Theme, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme activate %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, Theme, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Error WP ChangeStatusThemes ....... %s" % str(msg))
return 0
def main(): def main():
parser = argparse.ArgumentParser(description='CyberPanel Application Installer') parser = argparse.ArgumentParser(description='CyberPanel Application Installer')
parser.add_argument('function', help='Specify a function to call!') parser.add_argument('function', help='Specify a function to call!')

View File

@@ -117,3 +117,7 @@ class WPSites(models.Model):
ThemeUpdates = models.CharField(max_length=15, default='Disabled') ThemeUpdates = models.CharField(max_length=15, default='Disabled')
date = models.DateTimeField(default=datetime.now) date = models.DateTimeField(default=datetime.now)
WPLockState = models.IntegerField(default=1) WPLockState = models.IntegerField(default=1)
class WPStaging(models.Model):
owner = models.ForeignKey(WPSites, on_delete=models.CASCADE)
wpsite = models.ForeignKey(WPSites, on_delete=models.CASCADE, related_name='actual_wpsite')

View File

@@ -1,8 +1,6 @@
/** /**
* Created by usman on 7/26/17. * Created by usman on 7/26/17.
*/ */
function getCookie(name) { function getCookie(name) {
var cookieValue = null; var cookieValue = null;
var t = document.cookie; var t = document.cookie;
@@ -244,7 +242,7 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co
}); });
app.controller('createWordpress', function ($scope, $http, $timeout, $window) { app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $window) {
$scope.webSiteCreationLoading = true; $scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = false; $scope.installationDetailsForm = false;
$scope.installationProgress = true; $scope.installationProgress = true;
@@ -319,6 +317,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $window) {
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
alert("Error..." + response) alert("Error..." + response)
@@ -336,7 +335,8 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $window) {
$scope.goBackDisable = true; $scope.goBackDisable = true;
$("#installProgress").css("width", "0%"); $("#installProgress").css("width", "0%");
}; };
function getCreationStatus() {
function getCreationStatus() {
url = "/websites/installWordpressStatus"; url = "/websites/installWordpressStatus";
@@ -417,9 +417,638 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $window) {
} }
});
app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $window) {
$scope.wordpresshomeloading = true;
$(document).ready(function () {
var checkstatus = document.getElementById("wordpresshome");
if (checkstatus !== null) {
$scope.LoadWPdata();
}
});
$scope.LoadWPdata = function () {
$scope.wordpresshomeloading = false;
var url = "/websites/FetchWPdata";
var data = {
WPid: $('#WPid').html(),
}
console.log(data);
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
wordpresshomeloading = true;
if (response.data.status === 1) {
$('#WPVersion').text(response.data.ret_data.version);
if (response.data.ret_data.lscache === 1) {
$('#lscache').prop('checked', true);
}
if (response.data.ret_data.debugging === 1) {
$('#debugging').prop('checked', true);
}
if (response.data.ret_data.searchIndex === 1) {
$('#searchIndex').prop('checked', true);
}
if (response.data.ret_data.maintenanceMode === 1) {
$('#maintenanceMode').prop('checked', true);
}
} else {
alert("Error:" + response.data.error_message)
}
}
function cantLoadInitialDatas(response) {
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
}
};
$scope.UpdateWPSettings = function (setting) {
$scope.wordpresshomeloading = false;
var settingValue = 0;
if ($('#' + setting).is(":checked")) {
settingValue = 1;
}
var url = "/websites/UpdateWPSettings";
var data = {
WPid: $('#WPid').html(),
setting: setting,
settingValue: settingValue
}
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Successfully Updated!.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.wordpresshomeloading = true;
alert(response)
}
};
$scope.GetCurrentPlugins = function () {
$scope.wordpresshomeloading = false;
var url = "/websites/GetCurrentPlugins";
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;
if (response.data.status === 1) {
$('#PluginBody').html('');
var plugins = JSON.parse(response.data.plugins);
plugins.forEach(AddPlugins);
} else {
alert("Error:" + response.data.error_message)
}
}
function cantLoadInitialDatas(response) {
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
}
};
$scope.GetCurrentThemes = function () {
$scope.wordpresshomeloading = false;
var url = "/websites/GetCurrentThemes";
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;
if (response.data.status === 1) {
$('#ThemeBody').html('');
var themes = JSON.parse(response.data.themes);
themes.forEach(AddThemes);
} else {
alert("Error:" + response.data.error_message)
}
}
function cantLoadInitialDatas(response) {
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
}
};
$scope.UpdatePlugins = function (plugin) {
var data = {
plugin: plugin,
pluginarray: PluginsList,
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/UpdatePlugins";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Updating Plugins in Background!.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.wordpresshomeloading = true;
alert(response)
}
};
$scope.DeletePlugins = function (plugin) {
var data = {
plugin: plugin,
pluginarray: PluginsList,
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/DeletePlugins";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Deleting Plugin in Background!',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.wordpresshomeloading = true;
alert(response)
}
}
$scope.ChangeStatus = function (plugin) {
var data = {
plugin: plugin,
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/ChangeStatus";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Changed Plugin state Successfully !.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.wordpresshomeloading = true;
alert(response)
}
}
function AddPlugins(value, index, array) {
var FinalMarkup = '<tr>'
FinalMarkup = FinalMarkup + '<td><input onclick="AddPluginToArray(this,\'' + value.name + '\')" type="checkbox" id="' + value.name + '"><label for="' + value.name + '"></label></td>';
for (let x in value) {
if (x === 'status') {
if (value[x] === 'inactive') {
FinalMarkup = FinalMarkup + '<td><div ng-click="ChangeStatus(\'' + value.name + '\')" class="form-check form-check-inline switch"><input type="checkbox" id="' + value.name + 'State"><label for="' + value.name + 'State"></label></div></td>';
} else {
FinalMarkup = FinalMarkup + '<td><div ng-click="ChangeStatus(\'' + value.name + '\')" class="form-check form-check-inline switch"><input type="checkbox" id="' + value.name + 'State" checked=""><label for="' + value.name + 'State"></label></div></td>';
}
} else if (x === 'update') {
if (value[x] === 'none') {
FinalMarkup = FinalMarkup + '<td><span class="label label-success">Upto Date</span></td>';
} else {
FinalMarkup = FinalMarkup + '<td><button ng-click="UpdatePlugins(\'' + value.name + '\')" aria-label="" type="button" class="btn btn-outline-danger">Update</button></td>';
}
} else {
FinalMarkup = FinalMarkup + '<td>' + value[x] + "</td>";
}
}
FinalMarkup = FinalMarkup + '<td><button ng-click="DeletePlugins(\'' + value.name + '\')" aria-label="" class="btn btn-danger btn-icon-left m-b-10" type="button">Delete</button></td>'
FinalMarkup = FinalMarkup + '</tr>'
var temp = $compile(FinalMarkup)($scope)
AppendToTable('#PluginBody', temp)
}
$scope.UpdateThemes = function (theme) {
var data = {
Theme: theme,
Themearray: ThemesList,
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/UpdateThemes";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Updating Theme in background !.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.wordpresshomeloading = true;
alert(response)
}
};
$scope.DeleteThemes = function (theme) {
var data = {
Theme: theme,
Themearray: ThemesList,
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/DeleteThemes";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Deleting Theme in Background!.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.wordpresshomeloading = true;
alert(response)
}
};
$scope.ChangeStatusThemes = function (theme) {
var data = {
theme: theme,
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/StatusThemes";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'Change Theme state in Bsckground!.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.wordpresshomeloading = true;
alert(response)
}
};
function AddThemes(value, index, array) {
var FinalMarkup = '<tr>'
FinalMarkup = FinalMarkup + '<td><input onclick="AddThemeToArray(this,\'' + value.name + '\')" type="checkbox" id="' + value.name + '"><label for="' + value.name + '"></label></td>';
for (let x in value) {
if (x === 'status') {
if (value[x] === 'inactive') {
FinalMarkup = FinalMarkup + '<td><div ng-click="ChangeStatusThemes(\'' + value.name + '\')" class="form-check form-check-inline switch"><input type="checkbox" id="' + value.name + 'State"><label for="' + value.name + 'State"></label></div></td>';
} else {
FinalMarkup = FinalMarkup + '<td><div ng-click="ChangeStatusThemes(\'' + value.name + '\')" class="form-check form-check-inline switch"><input type="checkbox" id="' + value.name + 'State" checked=""><label for="' + value.name + 'State"></label></div></td>';
}
} else if (x === 'update') {
if (value[x] === 'none') {
FinalMarkup = FinalMarkup + '<td><span class="label label-success">Upto Date</span></td>';
} else {
FinalMarkup = FinalMarkup + '<td><button ng-click="UpdateThemes(\'' + value.name + '\')" aria-label="" type="button" class="btn btn-outline-danger">Update</button></td>';
}
} else {
FinalMarkup = FinalMarkup + '<td>' + value[x] + "</td>";
}
}
FinalMarkup = FinalMarkup + '<td><button ng-click="DeleteThemes(\'' + value.name + '\')" aria-label="" class="btn btn-danger btn-icon-left m-b-10" type="button">Delete</button></td>'
FinalMarkup = FinalMarkup + '</tr>'
var temp = $compile(FinalMarkup)($scope)
AppendToTable('#ThemeBody', temp)
}
$scope.autoLogin = function () {
var url = "/websites/DeleteThemes";
//window.open("/wpmanager/" + $('#HostingCompanyID').html() + "/manage/" + server + "/" + wordpress + "/AutoLogin");
var WPid = $('#WPid').html();
window.open("/websites/AutoLogin?WordPressID="+sub.id);
}
}); });
var PluginsList = [];
function AddPluginToArray(cBox, name) {
if (cBox.checked) {
PluginsList.push(name);
alert(PluginsList);
} else {
const index = PluginsList.indexOf(name);
if (index > -1) {
PluginsList.splice(index, 1);
}
alert(PluginsList);
}
}
var ThemesList = [];
function AddThemeToArray(cBox, name) {
if (cBox.checked) {
ThemesList.push(name);
alert(ThemesList);
} else {
const index = ThemesList.indexOf(name);
if (index > -1) {
ThemesList.splice(index, 1);
}
alert(ThemesList);
}
}
function AppendToTable(table, markup) {
$(table).append(markup);
}
/* Java script code to create account */ /* Java script code to create account */
app.controller('createWebsite', function ($scope, $http, $timeout, $window) { app.controller('createWebsite', function ($scope, $http, $timeout, $window) {

View File

@@ -0,0 +1,416 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Websites Hosted - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div style="display: none" id="wordpresshome"></div>
<div style="display: none" id="WPid">{{ wpsite.id }}</div>
<div ng-controller="WPsiteHome" class="container">
<div class="col-sm-12">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-lg-4">
<!-- Product image -->
<a target="_blank" style="border: 1px solid greenyellow"
href="http://{{ wpsite.FinalURL }}" class="text-center d-block mb-4">
<img src="https://cdn.statically.io/screenshot/{{ wpsite.FinalURL }}"
class="img-fluid"
alt="{{ wpsite.FinalURL }}">
</a>
<hr>
<div class="d-lg-flex d-none justify-content-center">
<a href="/websites/{{ wpsite.owner.domain }}">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true"
focusable="false" width="1em" height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32">
<path d="M16 18H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zM6 6v10h10V6z"
fill="#626262"></path>
<path d="M26 12v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z"
fill="#626262"></path>
<path d="M26 22v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z"
fill="#626262"></path>
<path d="M16 22v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z"
fill="#626262"></path>
</svg>
Manage Application
</a>
<a ng-click="autoUpdateConfigurationsInit()" data-toggle="modal"
data-target="#autoUpdateConfig" style="margin-left: 3%"
href="javascript: void(0);">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true"
focusable="false" width="1em" height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 20 20">
<path d="M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4l-3.5-4h2.32a4.439 4.439 0 0 0-4.32-3.45c-1.45 0-2.73.71-3.54 1.78L4.95 5.66a6.965 6.965 0 0 1 5.25-2.38zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48a4.439 4.439 0 0 0 4.32 3.45c1.45 0 2.73-.71 3.54-1.78l1.71 1.95a6.95 6.95 0 0 1-5.25 2.38z"
fill="#626262"></path>
</svg>
Autoupdate Configurations
</a>
<div id="autoUpdateConfig" class="modal fade" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
</div>
<form>
<h3 style="margin-top: 2%">UPDATES</h3>
<p>Configure setting for automatic updates.</p>
<div class="row">
<h5 class="font-arial">Automatic Updates
(Currently: {{ wpsite.AutoUpdates }})</h5>
<div class="col-12">
<select id="AutomaticUpdates"
class="form-group form-group-default"
style="padding: 10px">
<option>Disabled</option>
<option>Minor and Security Updates</option>
<option>All (minor and major)</option>
</select>
</div>
</div>
<div class="row">
<h5 class="font-arial">Plugins
(Currently: {{ wpsite.PluginUpdates }})</h5>
<div class="col-12">
<select id="Plugins"
class="form-group form-group-default"
style="padding: 10px">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
<div class="row">
<h5 class="font-arial">Themes
(Currently: {{ wpsite.ThemeUpdates }})</h5>
<div class="col-12">
<select id="Themes"
class="form-group form-group-default"
style="padding: 10px">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
<div class="row bg-dark"
style="border-radius: 2%;margin-top: 1%">
<div class="v-align-middle col-12 ">
<button onclick="SaveAutoUpdateSettings()"
aria-label=""
type="button"
class="v-align-middle btn bg-dark col-12"
style="color: white; padding: 15px">
Save Changes <img
class="LPLoader"
style="margin-left: 2%"
src="{% static 'BaseTemplates/images/loader.gif' %}">
</button>
</div>
</div>
</form>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
</div>
<div class="col-sm-8">
<!-- Product title -->
<h2 style="display: inline" class="mt-0">{{ wpsite.title }}</h2>
<p style="display: inline;">({{ wpsite.path }}) <img ng-hide="wordpresshomeloading"
src="{% static 'images/loading.gif' %}">
</p>
<div class="panel-body">
<div class="example-box-wrapper">
<ul class="nav-responsive nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab"
aria-selected="true">General</a></li>
<li class=""><a href="#tab2" ng-click="GetCurrentPlugins()"
data-toggle="tab">Plugins</a></li>
<li class=""><a href="#tab3" ng-click="GetCurrentThemes()"
data-toggle="tab">Themes</a></li>
<li><a href="#tab4" data-toggle="tab">Staging</a></li>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<div class="d-lg-flex d-none">
<a target="_blank" href="http://{{ wpsite.FinalURL }}">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 24 24">
<path d="M13 3l3.293 3.293l-7 7l1.414 1.414l7-7L21 11V3z"
fill="#626262"></path>
<path d="M19 19H5V5h7l-2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-5l-2-2v7z"
fill="#626262"></path>
</svg>
Open
</a>
<a target="_blank"
href="/filemanager/{{ wpsite.owner.domain }}"
style="margin-left: 4%">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 1024 1024">
<path d="M159 768h612.3l103.4-256H262.3z"
fill-opacity=".15"
fill="#626262"/>
<path d="M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 0 0-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12c0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"
fill="#626262"/>
</svg>
File Manager
</a>
<a ng-click="autoLogin()"
style="margin-left: 4%"
href="javascript: void(0);">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 20 20">
<path d="M14 10L8 5v3H1v4h7v3l6-5zm3 7H9v2h8c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2H9v2h8v14z"
fill="#626262"></path>
</svg>
Login
</a>
<a style="margin-left: 4%" target="_blank"
href="/websites/{{ wpsite.owner.domain}}/manageGIT">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 24 24">
<path d="M17.5 4C15.57 4 14 5.57 14 7.5c0 1.554 1.025 2.859 2.43 3.315c-.146.932-.547 1.7-1.23 2.323c-1.946 1.773-5.527 1.935-7.2 1.907V8.837c1.44-.434 2.5-1.757 2.5-3.337C10.5 3.57 8.93 2 7 2S3.5 3.57 3.5 5.5c0 1.58 1.06 2.903 2.5 3.337v6.326c-1.44.434-2.5 1.757-2.5 3.337C3.5 20.43 5.07 22 7 22s3.5-1.57 3.5-3.5c0-.551-.14-1.065-.367-1.529c2.06-.186 4.657-.757 6.409-2.35c1.097-.997 1.731-2.264 1.904-3.768C19.915 10.438 21 9.1 21 7.5C21 5.57 19.43 4 17.5 4zm-12 1.5C5.5 4.673 6.173 4 7 4s1.5.673 1.5 1.5S7.827 7 7 7s-1.5-.673-1.5-1.5zM7 20c-.827 0-1.5-.673-1.5-1.5a1.5 1.5 0 0 1 1.482-1.498l.13.01A1.495 1.495 0 0 1 7 20zM17.5 9c-.827 0-1.5-.673-1.5-1.5S16.673 6 17.5 6s1.5.673 1.5 1.5S18.327 9 17.5 9z"
fill="#626262"></path>
</svg>
Git Manager
</a>
</div>
<div style="margin-top: 4%">
<div class="row">
<div class="col-md-4">
<h6 class="font-14">WordPress Version</h6>
<p id="WPVersion" class="text-sm lh-150"></p>
</div>
<div class="col-md-4">
<h6 class="font-14">PHP</h6>
<p class="text-sm lh-150">{{ wpsite.owner.phpSelection }}</p>
</div>
<div class="col-md-4">
<h6 class="font-14">LSCache</h6>
<div class="custom-control custom-switch">
<input ng-click="UpdateWPSettings('lscache')"
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-not-empty"
id="lscache">
<label class="custom-control-label"
for="lscache"></label>
</div>
</div>
</div>
</div>
<div style="margin-top: 4%">
<div class="row">
<div class="col-md-4">
<h6 class="font-14">Debugging</h6>
<div class="custom-control custom-switch">
<input ng-click="UpdateWPSettings('debugging')"
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-empty"
id="debugging">
<label class="custom-control-label"
for="debugging"></label>
</div>
</div>
<div class="col-md-4">
<h6 class="font-14">Search Engine Indexing</h6>
<div class="custom-control custom-switch">
<input ng-click="UpdateWPSettings('searchIndex')"
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-not-empty"
id="searchIndex">
<label class="custom-control-label"
for="searchIndex"></label>
</div>
</div>
<div class="col-md-4">
<h6 class="font-14">Maintenance mode</h6>
<div class="custom-control custom-switch">
<input ng-click="UpdateWPSettings('maintenanceMode')"
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-empty"
id="maintenanceMode">
<label class="custom-control-label"
for="maintenanceMode"></label>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="tab2">
<div class="row mb-2">
<div class="col-sm-8">
<a ng-click="UpdatePlugins('all')"
href="javascript:void(0);"
class="btn btn-sm btn-default">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 24 24">
<path fill="none" stroke="#626262" stroke-width="2"
d="M2.998 7V1H17.5L21 4.5V23h-6m1-22v5h5M8 23A7 7 0 1 0 8 9a7 7 0 0 0 0 14zm-3.5-6.5L8 13l3.5 3.5m-3.5-3V20"></path>
</svg>
Update All</a>
<a ng-click="UpdatePlugins('selected')"
href="javascript:void(0);"
class="btn btn-sm btn-default"> Update
Selected</a>
</div>
<div class="col-sm-4">
<div class="text-sm-right">
<button data-toggle="modal" data-target="#DeleteWebsite"
ng-click="DeletePlugins('selected')"
aria-label=""
class="btn btn-danger btn-icon-left m-b-10"
type="button">Delete Selected
</button>
</div>
</div><!-- end col-->
</div>
<table class="table table-hover mb-0">
<thead>
<tr>
<th>
{% comment %}<div class="custom-control custom-checkbox" style="padding-left: 0px">
<input type="checkbox" id="CheckAll">
<label for="CheckAll"></label>
</div>{% endcomment %}
</th>
<th>Plugin</th>
<th>State</th>
<th>Updates</th>
<th>Version</th>
<th>Delete</th>
</tr>
</thead>
<tbody id="PluginBody">
</tbody>
</table>
</div>
<div class="tab-pane" id="tab3">
<div class="row mb-2">
<div class="col-sm-8">
<a ng-click="UpdateThemes('all')" href="javascript:void(0);"
class="btn btn-sm btn-default">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" focusable="false" width="1em"
height="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 24 24">
<path fill="none" stroke="#626262" stroke-width="2"
d="M2.998 7V1H17.5L21 4.5V23h-6m1-22v5h5M8 23A7 7 0 1 0 8 9a7 7 0 0 0 0 14zm-3.5-6.5L8 13l3.5 3.5m-3.5-3V20"></path>
</svg>
Update All</a>
<a ng-click="UpdateThemes('selected')"
href="javascript:void(0);"
class="btn btn-sm btn-default"> Update
Selected</a>
</div>
<div class="col-sm-4">
<div class="text-sm-right">
<button data-toggle="modal" data-target="#DeleteWebsite"
ng-click="DeleteThemes('selected')"
aria-label=""
class="btn btn-danger btn-icon-left m-b-10"
type="button">Delete
Selected
</button>
</div>
</div><!-- end col-->
</div>
<table class="table table-hover mb-0">
<thead>
<tr>
<th>
{% comment %}<div class="custom-control custom-checkbox" style="padding-left: 0px">
<input type="checkbox" id="CheckAll">
<label for="CheckAll"></label>
</div>{% endcomment %}
</th>
<th>Theme</th>
<th>State</th>
<th>Updates</th>
<th>Version</th>
<th>Delete</th>
</tr>
</thead>
<tbody id="ThemeBody">
</tbody>
</table>
</div>
<div class="tab-pane" id="tab4">
<p>Howdy, I'm in Section 4.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,95 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Websites Hosted - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<script>
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<div ng-controller="listWebsites" class="container">
<div id="page-title">
<h2 id="domainNamePage">{% trans "List WordPress Websites" %}
<a class="pull-right btn btn-primary" href="{% url "createWordpress" %}">{% trans "Create WordPress Website" %}</a>
</h2>
<img ng-hide="cyberPanelLoading" src="{% static 'images/loading.gif' %}">
<p>{% trans "On this page you can launch, list, modify and delete websites from your server." %}</p>
</div>
<table class="table table-hover dataTable no-footer" id="basicTable" role="grid">
<thead style="background-color: #0a6ebd">
<tr role="row" class="plans-head">
<th style="color: #fff0ff" class="sorting_desc" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-sort="descending"
aria-label="Title: activate to sort column ascending">ID
</th>
<th style="color: #fff0ff" class="sorting" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-label="Places: activate to sort column ascending">WordPress Site Title
</th>
<th style="color: #fff0ff" class="sorting" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-label="Places: activate to sort column ascending">URL
</th>
<th style="color: #fff0ff" class="sorting" tabindex="0"
aria-controls="basicTable" rowspan="1" colspan="1"
aria-label="Places: activate to sort column ascending">Action
</th>
</tr>
</thead>
<tbody>
{% for sub in wpsite %}
<tr role="row" class="odd">
<td class="v-align-middle sorting_1">
<p>{{ sub.id }}</p>
</td>
<td class="v-align-middle sorting_1">
<a href="{% url 'WPHome'%}?ID={{sub.id}}">
<p>{{ sub.title }}</p>
</a>
</td>
<td class="v-align-middle">
<p>{{ sub.url }}</p>
</td>
<td class="row">
<button
data-toggle="modal"
data-target="#DeleteMember" aria-label=""
type="button" class="btn btn-border btn-alt border-red btn-link font-red">
Delete
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View File

@@ -18,15 +18,33 @@ urlpatterns = [
### WordPress ### WordPress
url(r'^createWordpress$', views.WPCreate, name='createWordpress'), url(r'^createWordpress$', views.WPCreate, name='createWordpress'),
url(r'^ListWPSites$', views.ListWPSites, name='ListWPSites'),
url(r'^WPHome$', views.WPHome, name='WPHome'),
url(r'^AutoLogin$', views.AutoLogin, name='AutoLogin'),
###WordPress Ajax ###WordPress Ajax
url(r'^submitWorpressCreation', views.submitWorpressCreation, name='submitWorpressCreation'), url(r'^submitWorpressCreation', views.submitWorpressCreation, name='submitWorpressCreation'),
url(r'^FetchWPdata', views.FetchWPdata, name='FetchWPdata'),
url(r'^GetCurrentPlugins', views.GetCurrentPlugins, name='GetCurrentPlugins'),
url(r'^GetCurrentThemes', views.GetCurrentThemes, name='GetCurrentThemes'),
url(r'^UpdateWPSettings', views.UpdateWPSettings, name='UpdateWPSettings'),
url(r'^UpdatePlugins', views.UpdatePlugins, name='UpdatePlugins'),
url(r'^DeletePlugins', views.DeletePlugins, name='DeletePlugins'),
url(r'^ChangeStatus', views.ChangeStatus, name='ChangeStatus'),
url(r'^UpdateThemes', views.UpdateThemes, name='UpdateThemes'),
url(r'^DeleteThemes', views.DeleteThemes, name='DeleteThemes'),
url(r'^StatusThemes', views.StatusThemes, name='StatusThemes'),
#### AddPlugin #### AddPlugin
url(r'^ConfigurePlugins$', views.ConfigurePlugins, name='ConfigurePlugins'), url(r'^ConfigurePlugins$', views.ConfigurePlugins, name='ConfigurePlugins'),
url(r'^Addnewplugin$', views.Addnewplugin, name='Addnewplugin'), url(r'^Addnewplugin$', views.Addnewplugin, name='Addnewplugin'),
url(r'^EidtPlugin$', views.EidtPlugin, name='EidtPlugin'), url(r'^EidtPlugin$', views.EidtPlugin, name='EidtPlugin'),
## AddPlugin Ajax ## AddPlugin Ajax
url(r'^SearchOnkeyupPlugin$', views.SearchOnkeyupPlugin, name='SearchOnkeyupPlugin'), url(r'^SearchOnkeyupPlugin$', views.SearchOnkeyupPlugin, name='SearchOnkeyupPlugin'),
url(r'^AddNewpluginAjax$', views.AddNewpluginAjax, name='AddNewpluginAjax'), url(r'^AddNewpluginAjax$', views.AddNewpluginAjax, name='AddNewpluginAjax'),

View File

@@ -36,6 +36,33 @@ def WPCreate(request):
return wm.WPCreate(request, userID) return wm.WPCreate(request, userID)
except KeyError: except KeyError:
return redirect(loadLoginPage) return redirect(loadLoginPage)
def ListWPSites(request):
try:
userID = request.session['userID']
wm = WebsiteManager()
return wm.ListWPSites(request, userID)
except KeyError:
return redirect(loadLoginPage)
def WPHome(request):
try:
userID = request.session['userID']
WPid = request.GET.get('ID')
wm = WebsiteManager()
return wm.WPHome(request, userID, WPid)
except KeyError:
return redirect(loadLoginPage)
def AutoLogin(request):
try:
userID = request.session['userID']
WPid = request.GET.get('ID')
wm = WebsiteManager()
return wm.AutoLogin(request, userID, WPid)
except KeyError:
return redirect(loadLoginPage)
def ConfigurePlugins(request): def ConfigurePlugins(request):
try: try:
userID = request.session['userID'] userID = request.session['userID']
@@ -183,6 +210,227 @@ def submitWorpressCreation(request):
return redirect(loadLoginPage) return redirect(loadLoginPage)
def FetchWPdata(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.FetchWPdata(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def GetCurrentPlugins(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.GetCurrentPlugins(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def GetCurrentThemes(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.GetCurrentThemes(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def UpdateWPSettings(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.UpdateWPSettings(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def UpdatePlugins(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.UpdatePlugins(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def UpdateThemes(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.UpdateThemes(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def DeletePlugins(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.DeletePlugins(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def DeleteThemes(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.DeleteThemes(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def ChangeStatus(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.ChangeStatus(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def StatusThemes(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.ChangeStatusThemes(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def modifyWebsite(request): def modifyWebsite(request):
try: try:

View File

@@ -12,7 +12,7 @@ django.setup()
import json import json
from plogical.acl import ACLManager from plogical.acl import ACLManager
import plogical.CyberCPLogFileWriter as logging import plogical.CyberCPLogFileWriter as logging
from websiteFunctions.models import Websites, ChildDomains, GitLogs, wpplugins from websiteFunctions.models import Websites, ChildDomains, GitLogs, wpplugins, WPSites
from plogical.virtualHostUtilities import virtualHostUtilities from plogical.virtualHostUtilities import virtualHostUtilities
import subprocess import subprocess
import shlex import shlex
@@ -91,6 +91,63 @@ class WebsiteManager:
Data, 'createWebsite') Data, 'createWebsite')
return proc.render() return proc.render()
def ListWPSites(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
userobj = Administrator.objects.get(pk=userID)
webobjs = Websites.objects.all()
tata = {}
tata['wp']=[]
tata['wpsites']=[]
tata['wp'] = WPSites.objects.all()
for sub in tata['wp']:
tata['wpsites'].append({'id': sub.id,
'title': sub.title,
'url': sub.FinalURL
})
proc = httpProc(request, 'websiteFunctions/WPsitesList.html',
{"wpsite": tata['wpsites']})
return proc.render()
def WPHome(self, request=None, userID=None, WPid=None):
Data = {}
currentACL = ACLManager.loadedACL(userID)
WPobj = WPSites.objects.get(pk=WPid)
Data['wpsite'] = WPobj
proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
Data, 'createWebsite')
return proc.render()
def AutoLogin(self, request=None, userID=None, WPid=None):
pass
# data = {}
# currentACL = ACLManager.loadedACL(userID)
# WPobj = WPSites.objects.get(pk=WPid)
#
# data['wpsite'] = WPobj
#
# if data['wpsite'].FinalURL.endswith('/'):
# FinalURL = data['wpsite'].FinalURL[:-1]
# else:
# FinalURL = data['wpsite'].FinalURL
#
# data['url'] = 'https://%s' % (FinalURL)
# data['userName'] = 'autologin'
# data['password'] = message
#
# proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
# Data, 'createWebsite')
# return proc.render()
def ConfigurePlugins(self, request=None, userID=None, data=None): def ConfigurePlugins(self, request=None, userID=None, data=None):
DataPass ={} DataPass ={}
@@ -344,6 +401,537 @@ class WebsiteManager:
return proc.render() return proc.render()
def FetchWPdata(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path)
version = ProcessUtilities.outputExecutioner(command)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status litespeed-cache --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path)
lscachee = ProcessUtilities.outputExecutioner(command)
if lscachee.find('Status: Active') > -1:
lscache = 1
else:
lscache = 0
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config list --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path)
stdout = ProcessUtilities.outputExecutioner(command)
debugging = 0
for items in stdout.split('\n'):
if items.find('WP_DEBUG true constant') > -1:
debugging = 1
break
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp option get blog_public --skip-plugins --skip-themes --path=%s' %(Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
searchindex = int(stdoutput.splitlines()[-1])
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode status --skip-plugins --skip-themes --path=%s' %(Vhuser, FinalPHPPath, path)
maintenanceMod = ProcessUtilities.outputExecutioner(command)
result = maintenanceMod.splitlines()[-1]
if result.find('not active') > -1:
maintenanceMode = 0
else:
maintenanceMode = 1
fb ={
'version': version.rstrip('\n'),
'lscache': lscache,
'debugging': debugging,
'searchIndex': searchindex,
'maintenanceMode': maintenanceMode
}
data_ret = {'status': 1, 'error_message': 'None', 'ret_data':fb}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def GetCurrentPlugins(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin list --skip-plugins --skip-themes --format=json --path=%s' % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
json_data = stdoutput.splitlines()[-1]
data_ret = {'status': 1, 'error_message': 'None', 'plugins': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def GetCurrentThemes(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme list --skip-plugins --skip-themes --format=json --path=%s' % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
json_data = stdoutput.splitlines()[-1]
data_ret = {'status': 1, 'error_message': 'None', 'themes': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def UpdatePlugins(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
plugin = data['plugin']
pluginarray = data['pluginarray']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['plugin'] = plugin
extraArgs['pluginarray'] = pluginarray
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('UpdateWPPlugin', extraArgs)
background.start()
time.sleep(2)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def UpdateThemes(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
Theme = data['Theme']
Themearray = data['Themearray']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['Theme'] = Theme
extraArgs['Themearray'] = Themearray
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('UpdateWPTheme', extraArgs)
background.start()
time.sleep(2)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def DeletePlugins(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
plugin = data['plugin']
pluginarray = data['pluginarray']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['plugin'] = plugin
extraArgs['pluginarray'] = pluginarray
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('DeletePlugins', extraArgs)
background.start()
time.sleep(2)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def DeleteThemes(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
Theme = data['Theme']
Themearray = data['Themearray']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['Theme'] = Theme
extraArgs['Themearray'] = Themearray
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('DeleteThemes', extraArgs)
background.start()
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def ChangeStatus(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
plugin = data['plugin']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if stdoutput.find('Status: Active') > -1:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
time.sleep(3)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
time.sleep(3)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def ChangeStatusThemes(self, userID=None, data=None):
try:
# logging.CyberCPLogFileWriter.writeToFile("Error WP ChangeStatusThemes ....... %s")
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
Theme = data['theme']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['Theme'] = Theme
extraArgs['FinalPHPPath'] = FinalPHPPath
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('ChangeStatusThemes', extraArgs)
background.start()
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def UpdateWPSettings(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
setting = data['setting']
settingValue = data['settingValue']
wpsite = WPSites.objects.get(pk=WPManagerID)
path = wpsite.path
Webobj= Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
PHPVersion = Webobj.phpSelection
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
if setting == 'lscache':
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin install litespeed-cache --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate litespeed-cache --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate litespeed-cache --path=%s --skip-plugins --skip-themes' % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'debugging':
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG true --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging mk true 1 output:" + str(stdoutput))
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config list --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdout = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging output:" + str(stdout))
else:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG false --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging mk false 0 output:" + str(stdoutput))
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config list --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdout = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging output:" + str(stdout))
elif setting == 'searchIndex':
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 1 --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 0 --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'maintenanceMode':
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode activate --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode deactivate --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def submitWorpressCreation(self, userID=None, data=None): def submitWorpressCreation(self, userID=None, data=None):
try: try:
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)