This commit is contained in:
usmannasir
2025-05-18 13:30:29 +05:00
27 changed files with 4622 additions and 1649 deletions

View File

@@ -0,0 +1,52 @@
import psutil
import os
from plogical.processUtilities import ProcessUtilities
from plogical.acl import ACLManager
import plogical.CyberCPLogFileWriter as logging
def get_website_resource_usage(externalApp):
try:
user = externalApp
if not user:
return {'status': 0, 'error_message': 'User not found'}
# Get CPU and Memory usage using ps command
command = f"ps -u {user} -o pcpu,pmem | grep -v CPU | awk '{{cpu += $1; mem += $2}} END {{print cpu, mem}}'"
result = ProcessUtilities.outputExecutioner(command)
try:
cpu_percent, memory_percent = map(float, result.split())
except:
cpu_percent = 0
memory_percent = 0
# Get disk usage using du command
website_path = f"/home/{user}/public_html"
if os.path.exists(website_path):
# Get disk usage in MB
command = f"du -sm {website_path} | cut -f1"
disk_used = float(ProcessUtilities.outputExecutioner(command))
# Get total disk space
command = f"df -m {website_path} | tail -1 | awk '{{print $2}}'"
disk_total = float(ProcessUtilities.outputExecutioner(command))
# Calculate percentage
disk_percent = (disk_used / disk_total) * 100 if disk_total > 0 else 0
else:
disk_used = 0
disk_total = 0
disk_percent = 0
return {
'status': 1,
'cpu_usage': round(cpu_percent, 2),
'memory_usage': round(memory_percent, 2),
'disk_used': round(disk_used, 2),
'disk_total': round(disk_total, 2),
'disk_percent': round(disk_percent, 2)
}
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(f'Error in get_website_resource_usage: {str(msg)}')
return {'status': 0, 'error_message': str(msg)}

View File

@@ -0,0 +1,143 @@
// Resource Monitoring
let cpuChart, memoryChart, diskChart;
let cpuData = [], memoryData = [], diskData = [];
const maxDataPoints = 30;
function initializeCharts() {
const chartOptions = {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
},
animation: {
duration: 750
}
};
// CPU Chart
const cpuCtx = document.getElementById('cpuChart').getContext('2d');
cpuChart = new Chart(cpuCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'CPU Usage (%)',
data: [],
borderColor: '#2563eb',
backgroundColor: 'rgba(37, 99, 235, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: chartOptions
});
// Memory Chart
const memoryCtx = document.getElementById('memoryChart').getContext('2d');
memoryChart = new Chart(memoryCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'Memory Usage (%)',
data: [],
borderColor: '#00b894',
backgroundColor: 'rgba(0, 184, 148, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: chartOptions
});
// Disk Chart
const diskCtx = document.getElementById('diskChart').getContext('2d');
diskChart = new Chart(diskCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'Disk Usage (%)',
data: [],
borderColor: '#ff9800',
backgroundColor: 'rgba(255, 152, 0, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: chartOptions
});
}
function updateCharts(data) {
const now = new Date();
const timeLabel = now.toLocaleTimeString();
// Update CPU Chart
cpuData.push(data.cpu_usage);
if (cpuData.length > maxDataPoints) cpuData.shift();
cpuChart.data.labels.push(timeLabel);
if (cpuChart.data.labels.length > maxDataPoints) cpuChart.data.labels.shift();
cpuChart.data.datasets[0].data = cpuData;
cpuChart.update('none'); // Use 'none' mode for better performance
// Update Memory Chart
memoryData.push(data.memory_usage);
if (memoryData.length > maxDataPoints) memoryData.shift();
memoryChart.data.labels.push(timeLabel);
if (memoryChart.data.labels.length > maxDataPoints) memoryChart.data.labels.shift();
memoryChart.data.datasets[0].data = memoryData;
memoryChart.update('none');
// Update Disk Chart
diskData.push(data.disk_percent);
if (diskData.length > maxDataPoints) diskData.shift();
diskChart.data.labels.push(timeLabel);
if (diskChart.data.labels.length > maxDataPoints) diskChart.data.labels.shift();
diskChart.data.datasets[0].data = diskData;
diskChart.update('none');
}
function fetchResourceUsage() {
$.ajax({
url: '/websites/get_website_resources/',
type: 'POST',
data: JSON.stringify({
'domain': $('#domainNamePage').text().trim()
}),
contentType: 'application/json',
success: function(data) {
if (data.status === 1) {
updateCharts(data);
} else {
console.error('Error fetching resource data:', data.error_message);
}
},
error: function(xhr, status, error) {
console.error('Failed to fetch resource usage:', error);
}
});
}
// Initialize charts when the page loads
$(document).ready(function() {
if (document.getElementById('cpuChart')) {
initializeCharts();
// Fetch resource usage every 5 seconds
setInterval(fetchResourceUsage, 5000);
// Initial fetch
fetchResourceUsage();
}
});

View File

@@ -0,0 +1,162 @@
// Resource Monitoring
let cpuChart, memoryChart, diskChart;
let cpuData = [], memoryData = [], diskData = [];
const maxDataPoints = 30;
function initializeCharts() {
// CPU Chart
const cpuCtx = document.getElementById('cpuChart').getContext('2d');
cpuChart = new Chart(cpuCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'CPU Usage (%)',
data: [],
borderColor: '#2563eb',
backgroundColor: 'rgba(37, 99, 235, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
// Memory Chart
const memoryCtx = document.getElementById('memoryChart').getContext('2d');
memoryChart = new Chart(memoryCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'Memory Usage (%)',
data: [],
borderColor: '#00b894',
backgroundColor: 'rgba(0, 184, 148, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
// Disk Chart
const diskCtx = document.getElementById('diskChart').getContext('2d');
diskChart = new Chart(diskCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'Disk Usage (%)',
data: [],
borderColor: '#ff9800',
backgroundColor: 'rgba(255, 152, 0, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
}
function updateCharts(data) {
const now = new Date();
const timeLabel = now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
// Update CPU Chart
cpuData.push(data.cpu_usage);
if (cpuData.length > maxDataPoints) cpuData.shift();
cpuChart.data.labels.push(timeLabel);
if (cpuChart.data.labels.length > maxDataPoints) cpuChart.data.labels.shift();
cpuChart.data.datasets[0].data = cpuData;
cpuChart.update();
// Update Memory Chart
memoryData.push(data.memory_usage);
if (memoryData.length > maxDataPoints) memoryData.shift();
memoryChart.data.labels.push(timeLabel);
if (memoryChart.data.labels.length > maxDataPoints) memoryChart.data.labels.shift();
memoryChart.data.datasets[0].data = memoryData;
memoryChart.update();
// Update Disk Chart
diskData.push(data.disk_percent);
if (diskData.length > maxDataPoints) diskData.shift();
diskChart.data.labels.push(timeLabel);
if (diskChart.data.labels.length > maxDataPoints) diskChart.data.labels.shift();
diskChart.data.datasets[0].data = diskData;
diskChart.update();
}
function fetchResourceUsage() {
$.ajax({
url: '/website/get_website_resources/',
type: 'POST',
data: JSON.stringify({
'domain': $('#domainNamePage').text()
}),
contentType: 'application/json',
success: function(data) {
if (data.status === 1) {
updateCharts(data);
}
},
error: function() {
console.error('Error fetching resource usage data');
}
});
}
// Initialize charts when the page loads
$(document).ready(function() {
initializeCharts();
// Fetch resource usage every 5 seconds
setInterval(fetchResourceUsage, 5000);
// Initial fetch
fetchResourceUsage();
});

View File

@@ -0,0 +1,143 @@
// Resource Monitoring
let cpuChart, memoryChart, diskChart;
let cpuData = [], memoryData = [], diskData = [];
const maxDataPoints = 30;
function initializeCharts() {
const chartOptions = {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
},
animation: {
duration: 750
}
};
// CPU Chart
const cpuCtx = document.getElementById('cpuChart').getContext('2d');
cpuChart = new Chart(cpuCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'CPU Usage (%)',
data: [],
borderColor: '#2563eb',
backgroundColor: 'rgba(37, 99, 235, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: chartOptions
});
// Memory Chart
const memoryCtx = document.getElementById('memoryChart').getContext('2d');
memoryChart = new Chart(memoryCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'Memory Usage (%)',
data: [],
borderColor: '#00b894',
backgroundColor: 'rgba(0, 184, 148, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: chartOptions
});
// Disk Chart
const diskCtx = document.getElementById('diskChart').getContext('2d');
diskChart = new Chart(diskCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'Disk Usage (%)',
data: [],
borderColor: '#ff9800',
backgroundColor: 'rgba(255, 152, 0, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: chartOptions
});
}
function updateCharts(data) {
const now = new Date();
const timeLabel = now.toLocaleTimeString();
// Update CPU Chart
cpuData.push(data.cpu_usage);
if (cpuData.length > maxDataPoints) cpuData.shift();
cpuChart.data.labels.push(timeLabel);
if (cpuChart.data.labels.length > maxDataPoints) cpuChart.data.labels.shift();
cpuChart.data.datasets[0].data = cpuData;
cpuChart.update('none'); // Use 'none' mode for better performance
// Update Memory Chart
memoryData.push(data.memory_usage);
if (memoryData.length > maxDataPoints) memoryData.shift();
memoryChart.data.labels.push(timeLabel);
if (memoryChart.data.labels.length > maxDataPoints) memoryChart.data.labels.shift();
memoryChart.data.datasets[0].data = memoryData;
memoryChart.update('none');
// Update Disk Chart
diskData.push(data.disk_percent);
if (diskData.length > maxDataPoints) diskData.shift();
diskChart.data.labels.push(timeLabel);
if (diskChart.data.labels.length > maxDataPoints) diskChart.data.labels.shift();
diskChart.data.datasets[0].data = diskData;
diskChart.update('none');
}
function fetchResourceUsage() {
$.ajax({
url: '/websites/get_website_resources/',
type: 'POST',
data: JSON.stringify({
'domain': $('#domainNamePage').text().trim()
}),
contentType: 'application/json',
success: function(data) {
if (data.status === 1) {
updateCharts(data);
} else {
console.error('Error fetching resource data:', data.error_message);
}
},
error: function(xhr, status, error) {
console.error('Failed to fetch resource usage:', error);
}
});
}
// Initialize charts when the page loads
$(document).ready(function() {
if (document.getElementById('cpuChart')) {
initializeCharts();
// Fetch resource usage every 5 seconds
setInterval(fetchResourceUsage, 5000);
// Initial fetch
fetchResourceUsage();
}
});

View File

@@ -0,0 +1,162 @@
// Resource Monitoring
let cpuChart, memoryChart, diskChart;
let cpuData = [], memoryData = [], diskData = [];
const maxDataPoints = 30;
function initializeCharts() {
// CPU Chart
const cpuCtx = document.getElementById('cpuChart').getContext('2d');
cpuChart = new Chart(cpuCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'CPU Usage (%)',
data: [],
borderColor: '#2563eb',
backgroundColor: 'rgba(37, 99, 235, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
// Memory Chart
const memoryCtx = document.getElementById('memoryChart').getContext('2d');
memoryChart = new Chart(memoryCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'Memory Usage (%)',
data: [],
borderColor: '#00b894',
backgroundColor: 'rgba(0, 184, 148, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
// Disk Chart
const diskCtx = document.getElementById('diskChart').getContext('2d');
diskChart = new Chart(diskCtx, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'Disk Usage (%)',
data: [],
borderColor: '#ff9800',
backgroundColor: 'rgba(255, 152, 0, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
}
function updateCharts(data) {
const now = new Date();
const timeLabel = now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
// Update CPU Chart
cpuData.push(data.cpu_usage);
if (cpuData.length > maxDataPoints) cpuData.shift();
cpuChart.data.labels.push(timeLabel);
if (cpuChart.data.labels.length > maxDataPoints) cpuChart.data.labels.shift();
cpuChart.data.datasets[0].data = cpuData;
cpuChart.update();
// Update Memory Chart
memoryData.push(data.memory_usage);
if (memoryData.length > maxDataPoints) memoryData.shift();
memoryChart.data.labels.push(timeLabel);
if (memoryChart.data.labels.length > maxDataPoints) memoryChart.data.labels.shift();
memoryChart.data.datasets[0].data = memoryData;
memoryChart.update();
// Update Disk Chart
diskData.push(data.disk_percent);
if (diskData.length > maxDataPoints) diskData.shift();
diskChart.data.labels.push(timeLabel);
if (diskChart.data.labels.length > maxDataPoints) diskChart.data.labels.shift();
diskChart.data.datasets[0].data = diskData;
diskChart.update();
}
function fetchResourceUsage() {
$.ajax({
url: '/website/get_website_resources/',
type: 'POST',
data: JSON.stringify({
'domain': $('#domainNamePage').text()
}),
contentType: 'application/json',
success: function(data) {
if (data.status === 1) {
updateCharts(data);
}
},
error: function() {
console.error('Error fetching resource usage data');
}
});
}
// Initialize charts when the page loads
$(document).ready(function() {
initializeCharts();
// Fetch resource usage every 5 seconds
setInterval(fetchResourceUsage, 5000);
// Initial fetch
fetchResourceUsage();
});

View File

@@ -16904,4 +16904,937 @@ app.controller('BuyAddons', function ($scope, $http) {
}
})
})
app.controller('launchChild', function ($scope, $http) {
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = true;
$scope.hideErrorLogs = true;
$scope.hidelogsbtn = function () {
$scope.hideLogs = true;
};
$scope.hideErrorLogsbtn = function () {
$scope.hideLogs = true;
};
$scope.fileManagerURL = "/filemanager/" + $("#domainNamePage").text();
$scope.previewUrl = "/preview/" + $("#childDomain").text() + "/";
$scope.wordPressInstallURL = "/websites/" + $("#childDomain").text() + "/wordpressInstall";
$scope.joomlaInstallURL = "/websites/" + $("#childDomain").text() + "/joomlaInstall";
$scope.setupGit = "/websites/" + $("#childDomain").text() + "/setupGit";
$scope.installPrestaURL = "/websites/" + $("#childDomain").text() + "/installPrestaShop";
$scope.installMagentoURL = "/websites/" + $("#childDomain").text() + "/installMagento";
var logType = 0;
$scope.pageNumber = 1;
$scope.fetchLogs = function (type) {
var pageNumber = $scope.pageNumber;
if (type == 3) {
pageNumber = $scope.pageNumber + 1;
$scope.pageNumber = pageNumber;
} else if (type == 4) {
pageNumber = $scope.pageNumber - 1;
$scope.pageNumber = pageNumber;
} else {
logType = type;
}
$scope.logFileLoading = false;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = false;
$scope.hideErrorLogs = true;
url = "/websites/getDataFromLogFile";
var domainNamePage = $("#domainNamePage").text();
var data = {
logType: logType,
virtualHost: domainNamePage,
page: pageNumber,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.logstatus === 1) {
$scope.logFileLoading = true;
$scope.logsFeteched = false;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = false;
$scope.hideLogs = false;
$scope.records = JSON.parse(response.data.data);
} else {
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = false;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = false;
$scope.errorMessage = response.data.error_message;
console.log(domainNamePage)
}
}
function cantLoadInitialDatas(response) {
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = false;
$scope.fetchedData = true;
$scope.hideLogs = false;
}
};
$scope.errorPageNumber = 1;
$scope.fetchErrorLogs = function (type) {
var errorPageNumber = $scope.errorPageNumber;
if (type === 3) {
errorPageNumber = $scope.errorPageNumber + 1;
$scope.errorPageNumber = errorPageNumber;
} else if (type === 4) {
errorPageNumber = $scope.errorPageNumber - 1;
$scope.errorPageNumber = errorPageNumber;
} else {
logType = type;
}
// notifications
$scope.logFileLoading = false;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideErrorLogs = true;
$scope.hideLogs = false;
url = "/websites/fetchErrorLogs";
var domainNamePage = $("#domainNamePage").text();
var data = {
virtualHost: domainNamePage,
page: errorPageNumber,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.logstatus === 1) {
// notifications
$scope.logFileLoading = true;
$scope.logsFeteched = false;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = false;
$scope.hideErrorLogs = false;
$scope.errorLogsData = response.data.data;
} else {
// notifications
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = false;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = true;
$scope.hideErrorLogs = true;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
// notifications
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = false;
$scope.fetchedData = true;
$scope.hideLogs = true;
$scope.hideErrorLogs = true;
}
};
///////// Configurations Part
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.hideconfigbtn = function () {
$scope.configurationsBox = true;
};
$scope.fetchConfigurations = function () {
$scope.hidsslconfigs = true;
$scope.configurationsBoxRewrite = true;
$scope.changePHPView = true;
//Rewrite rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
///
$scope.configFileLoading = false;
url = "/websites/getDataFromConfigFile";
var virtualHost = $("#childDomain").text();
var data = {
virtualHost: virtualHost,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.configstatus === 1) {
//Rewrite rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
///
$scope.configurationsBox = false;
$scope.configsFetched = false;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = false;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = false;
$scope.configData = response.data.configData;
} else {
//Rewrite rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
///
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = false;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
//Rewrite rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
///
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = false;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
}
};
$scope.saveCongiruations = function () {
$scope.configFileLoading = false;
url = "/websites/saveConfigsToFile";
var virtualHost = $("#childDomain").text();
var configData = $scope.configData;
var data = {
virtualHost: virtualHost,
configData: configData,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.configstatus == 1) {
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = false;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = true;
} else {
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = false;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = false;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = false;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
}
};
///////// Rewrite Rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
$scope.hideRewriteRulesbtn = function () {
$scope.configurationsBoxRewrite = true;
};
$scope.fetchRewriteFules = function () {
$scope.hidsslconfigs = true;
$scope.configurationsBox = true;
$scope.changePHPView = true;
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = true;
$scope.configFileLoading = false;
url = "/websites/getRewriteRules";
var virtualHost = $("#childDomain").text();
var data = {
virtualHost: virtualHost,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.rewriteStatus == 1) {
// from main
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.fetchedConfigsData = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = true;
// main ends
$scope.configFileLoading = true;
//
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = false;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = false;
$scope.saveRewriteRulesBTN = false;
$scope.couldNotConnect = true;
$scope.rewriteRules = response.data.rewriteRules;
} else {
// from main
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = true;
// from main
$scope.configFileLoading = true;
///
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = false;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
$scope.couldNotConnect = true;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
// from main
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = true;
// from main
$scope.configFileLoading = true;
///
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
$scope.couldNotConnect = false;
}
};
$scope.saveRewriteRules = function () {
$scope.configFileLoading = false;
url = "/websites/saveRewriteRules";
var virtualHost = $("#childDomain").text();
var rewriteRules = $scope.rewriteRules;
var data = {
virtualHost: virtualHost,
rewriteRules: rewriteRules,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.rewriteStatus == 1) {
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = false;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
$scope.configFileLoading = true;
} else {
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = false;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = false;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = false;
$scope.configFileLoading = true;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = false;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = false;
$scope.configFileLoading = true;
$scope.couldNotConnect = false;
}
};
//////// SSL Part
$scope.sslSaved = true;
$scope.couldNotSaveSSL = true;
$scope.hidsslconfigs = true;
$scope.couldNotConnect = true;
$scope.hidesslbtn = function () {
$scope.hidsslconfigs = true;
};
$scope.addSSL = function () {
$scope.hidsslconfigs = false;
$scope.configurationsBox = true;
$scope.configurationsBoxRewrite = true;
$scope.changePHPView = true;
};
$scope.saveSSL = function () {
$scope.configFileLoading = false;
url = "/websites/saveSSL";
var virtualHost = $("#childDomain").text();
var cert = $scope.cert;
var key = $scope.key;
var data = {
virtualHost: virtualHost,
cert: cert,
key: key,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.sslStatus === 1) {
$scope.sslSaved = false;
$scope.couldNotSaveSSL = true;
$scope.couldNotConnect = true;
$scope.configFileLoading = true;
} else {
$scope.sslSaved = true;
$scope.couldNotSaveSSL = false;
$scope.couldNotConnect = true;
$scope.configFileLoading = true;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.sslSaved = true;
$scope.couldNotSaveSSL = true;
$scope.couldNotConnect = false;
$scope.configFileLoading = true;
}
};
//// Change PHP Master
$scope.failedToChangePHPMaster = true;
$scope.phpChangedMaster = true;
$scope.couldNotConnect = true;
$scope.changePHPView = true;
$scope.hideChangePHPMaster = function () {
$scope.changePHPView = true;
};
$scope.changePHPMaster = function () {
$scope.hidsslconfigs = true;
$scope.configurationsBox = true;
$scope.configurationsBoxRewrite = true;
$scope.changePHPView = false;
};
$scope.changePHPVersionMaster = function (childDomain, phpSelection) {
// notifcations
$scope.configFileLoading = false;
var url = "/websites/changePHP";
var data = {
childDomain: $("#childDomain").text(),
phpSelection: $scope.phpSelectionMaster,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.changePHP === 1) {
$scope.configFileLoading = true;
$scope.websiteDomain = $("#childDomain").text();
// notifcations
$scope.failedToChangePHPMaster = true;
$scope.phpChangedMaster = false;
$scope.couldNotConnect = true;
} else {
$scope.configFileLoading = true;
$scope.errorMessage = response.data.error_message;
// notifcations
$scope.failedToChangePHPMaster = false;
$scope.phpChangedMaster = true;
$scope.couldNotConnect = true;
}
}
function cantLoadInitialDatas(response) {
$scope.configFileLoading = true;
// notifcations
$scope.failedToChangePHPMaster = true;
$scope.phpChangedMaster = true;
$scope.couldNotConnect = false;
}
};
/// Open_basedir protection
$scope.baseDirLoading = true;
$scope.operationFailed = true;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = true;
$scope.openBaseDirView = function () {
$scope.openBaseDirBox = false;
};
$scope.hideOpenBasedir = function () {
$scope.openBaseDirBox = true;
};
$scope.applyOpenBasedirChanges = function (childDomain, phpSelection) {
// notifcations
$scope.baseDirLoading = false;
$scope.operationFailed = true;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = false;
var url = "/websites/changeOpenBasedir";
var data = {
domainName: $("#childDomain").text(),
openBasedirValue: $scope.openBasedirValue
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.changeOpenBasedir === 1) {
$scope.baseDirLoading = true;
$scope.operationFailed = true;
$scope.operationSuccessfull = false;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = false;
} else {
$scope.baseDirLoading = true;
$scope.operationFailed = false;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = false;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.baseDirLoading = true;
$scope.operationFailed = true;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = false;
$scope.openBaseDirBox = false;
}
}
});

View File

@@ -87,6 +87,42 @@
}
};
$scope.ScanWordpressSite = function () {
$('#cyberPanelLoading').show();
var url = "{% url 'ScanWordpressSite' %}";
var data = {};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(function(response) {
$('#cyberPanelLoading').hide();
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'WordPress sites scanned successfully!',
type: 'success'
});
location.reload();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}, function(response) {
$('#cyberPanelLoading').hide();
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
});
};
$scope.updateSetting = function(site, setting) {
var settingMap = {
'search-indexing': 'searchIndex',
@@ -355,6 +391,7 @@
<h3 class="panel-title">{% trans "WordPress Sites" %}</h3>
</div>
<div class="col-sm-6 text-right">
<button ng-click="ScanWordpressSite()" class="btn btn-info btn-sm" style="margin-right: 10px;">Scan WordPress Sites</button>
<a href="{% url 'createWordpress' %}" class="btn btn-success btn-sm">Install WordPress</a>
</div>
</div>
@@ -602,6 +639,4 @@
margin-left: 4px;
}
</style>
{% endblock content %}
{% endblock content %}

View File

@@ -66,7 +66,7 @@
</div>
<div class="col-sm-10" style="padding: 0px; box-shadow: 0px 0px 1px 0px #888888; margin-bottom: 2%">
<input ng-change="searchWebsites()" placeholder="Search..." ng-model="patternAdded" name="dom" type="text"
<input ng-keypress="$event.keyCode === 13 && searchWebsites()" placeholder="Search... (Press Enter to search)" ng-model="patternAdded" name="dom" type="text"
class="form-control" required>
</div>

File diff suppressed because it is too large Load Diff

View File

@@ -200,4 +200,6 @@ urlpatterns = [
# Catch all for domains
path('<domain>/<childDomain>', views.launchChild, name='launchChild'),
path('<domain>', views.domain, name='domain'),
path('get_website_resources/', views.get_website_resources, name='get_website_resources'),
]

View File

@@ -2,11 +2,12 @@
from django.shortcuts import redirect
from django.http import HttpResponse
from django.http import HttpResponse, JsonResponse
from loginSystem.models import Administrator
from loginSystem.views import loadLoginPage
import json
import plogical.CyberCPLogFileWriter as logging
from plogical.acl import ACLManager
from plogical.httpProc import httpProc
@@ -17,6 +18,7 @@ from django.views.decorators.csrf import csrf_exempt
from .dockerviews import startContainer as docker_startContainer
from .dockerviews import stopContainer as docker_stopContainer
from .dockerviews import restartContainer as docker_restartContainer
from .resource_monitoring import get_website_resource_usage
def loadWebsitesHome(request):
val = request.session['userID']
@@ -1882,4 +1884,42 @@ def restartContainer(request):
return docker_restartContainer(request)
return HttpResponse('Not allowed')
except KeyError:
return redirect(loadLoginPage)
return redirect(loadLoginPage)
@csrf_exempt
def get_website_resources(request):
try:
data = json.loads(request.body)
domain = data['domain']
# Get userID from session
try:
userID = request.session['userID']
admin = Administrator.objects.get(pk=userID)
except:
return JsonResponse({'status': 0, 'error_message': 'Unauthorized access'})
# Verify domain ownership
currentACL = ACLManager.loadedACL(userID)
from websiteFunctions.models import Websites
try:
website = Websites.objects.get(domain=domain)
except Websites.DoesNotExist:
return JsonResponse({'status': 0, 'error_message': 'Website not found'})
if ACLManager.checkOwnership(domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
# Get resource usage data using externalApp
resource_data = get_website_resource_usage(website.externalApp)
if resource_data['status'] == 0:
return JsonResponse(resource_data)
return JsonResponse(resource_data)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(f'Error in get_website_resources: {str(msg)}')
return JsonResponse({'status': 0, 'error_message': str(msg)})

View File

@@ -1955,19 +1955,43 @@ class WebsiteManager:
return HttpResponse(json_data)
def UpdateWPSettings(self, userID=None, data=None):
# Map old setting names to new ones
setting_map = {
'PasswordProtection': 'password-protection',
'searchIndex': 'search-indexing',
'debugging': 'debugging',
'maintenanceMode': 'maintenance-mode',
'lscache': 'lscache',
'Wpcron': 'wpcron',
# Add more mappings as needed
}
siteId = data.get('siteId') or data.get('WPid')
if not siteId:
resp = {'status': 0, 'error_message': 'Missing siteId or WPid'}
return JsonResponse(resp)
# Accept both new and old setting names
setting = data.get('setting')
if not setting:
for old_key in setting_map:
if old_key in data:
setting = old_key
data['settingValue'] = data[old_key]
break
# Map to new setting name if needed
setting = setting_map.get(setting, setting)
value = data.get('value') or data.get('settingValue')
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
siteId = data['siteId']
setting = data['setting']
value = data['value']
wpsite = WPSites.objects.get(pk=siteId)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) != 1:
return ACLManager.loadError()
# Get PHP version and path
Webobj = Websites.objects.get(pk=wpsite.owner_id)
Vhuser = Webobj.externalApp
@@ -1977,10 +2001,8 @@ class WebsiteManager:
# Update the appropriate setting based on the setting type
if setting == 'search-indexing':
# Update search engine indexing
command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp option update blog_public {value} --skip-plugins --skip-themes --path={wpsite.path}'
elif setting == 'debugging':
# Update debugging in wp-config.php
if value:
command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp config set WP_DEBUG true --raw --skip-plugins --skip-themes --path={wpsite.path}'
else:
@@ -1990,76 +2012,84 @@ class WebsiteManager:
vhostPassDir = f'/home/{vhostName}'
path = f'{vhostPassDir}/{siteId}'
if value:
# Enable password protection
tempPath = f'/home/cyberpanel/{str(randint(1000, 9999))}'
os.makedirs(tempPath)
# Create temporary .htpasswd file
htpasswd = f'{tempPath}/.htpasswd'
htaccess = f'{tempPath}/.htaccess'
password = randomPassword.generate_pass(12)
# Create .htpasswd file
command = f"htpasswd -cb {htpasswd} admin {password}"
ProcessUtilities.executioner(command)
# Create .htaccess file content
htaccess_content = f"""
AuthType Basic
AuthName "Restricted Access"
AuthUserFile {path}/.htpasswd
Require valid-user
"""
with open(htaccess, 'w') as f:
f.write(htaccess_content)
# Create final directory and move files
command = f"mkdir -p {path}"
ProcessUtilities.executioner(command, wpsite.owner.externalApp)
# Move files to final location
command = f"mv {htpasswd} {path}/.htpasswd"
ProcessUtilities.executioner(command, wpsite.owner.externalApp)
command = f"mv {htaccess} {wpsite.path}/.htaccess"
command = f"mv {htaccess} {wpsite.path}/.htaccess"
ProcessUtilities.executioner(command, wpsite.owner.externalApp)
# Cleanup temp directory
command = f"rm -rf {tempPath}"
ProcessUtilities.executioner(command)
else:
# Disable password protection
if os.path.exists(path):
command = f"rm -rf {path}"
ProcessUtilities.executioner(command, wpsite.owner.externalApp)
htaccess = f'{wpsite.path}/.htaccess'
if os.path.exists(htaccess):
command = f"rm -f {htaccess}"
ProcessUtilities.executioner(command, wpsite.owner.externalApp)
return JsonResponse({'status': 1, 'error_message': 'None'})
resp = {'status': 1, 'error_message': 'None'}
if data.get('legacy_response'):
import json
return HttpResponse(json.dumps(resp))
else:
return JsonResponse(resp)
elif setting == 'maintenance-mode':
if value:
command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp maintenance-mode activate --skip-plugins --skip-themes --path={wpsite.path}'
else:
command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp maintenance-mode deactivate --skip-plugins --skip-themes --path={wpsite.path}'
elif setting == 'lscache':
if value:
command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp plugin activate litespeed-cache --skip-plugins --skip-themes --path={wpsite.path}'
else:
command = f'sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp plugin deactivate litespeed-cache --skip-plugins --skip-themes --path={wpsite.path}'
else:
return JsonResponse({'status': 0, 'error_message': 'Invalid setting type'})
resp = {'status': 0, 'error_message': 'Invalid setting type'}
if data.get('legacy_response'):
import json
return HttpResponse(json.dumps(resp))
else:
return JsonResponse(resp)
result = ProcessUtilities.outputExecutioner(command)
if result.find('Error:') > -1:
return JsonResponse({'status': 0, 'error_message': result})
return JsonResponse({'status': 1, 'error_message': 'None'})
resp = {'status': 0, 'error_message': result}
if data.get('legacy_response'):
import json
return HttpResponse(json.dumps(resp))
else:
return JsonResponse(resp)
resp = {'status': 1, 'error_message': 'None'}
if data.get('legacy_response'):
import json
return HttpResponse(json.dumps(resp))
else:
return JsonResponse(resp)
except BaseException as msg:
return JsonResponse({'status': 0, 'error_message': str(msg)})
resp = {'status': 0, 'error_message': str(msg)}
if data and data.get('legacy_response'):
import json
return HttpResponse(json.dumps(resp))
else:
return JsonResponse(resp)
def submitWorpressCreation(self, userID=None, data=None):
try:
@@ -4572,8 +4602,7 @@ StrictHostKeyChecking no
websites = ACLManager.searchWebsiteObjects(currentlACL, userID, searchTerm)
json_data = "["
checker = 0
json_data = []
try:
ipFile = "/etc/cyberpanel/machineIP"
@@ -4604,19 +4633,34 @@ StrictHostKeyChecking no
PHPVersionActual = 'PHP 8.1'
diskUsed = "%sMB" % str(DiskUsage)
dic = {'domain': items.domain, 'adminEmail': items.adminEmail, 'ipAddress': ipAddress,
'admin': items.admin.userName, 'package': items.package.packageName, 'state': state,
'diskUsed': diskUsed, 'phpVersion': PHPVersionActual}
if checker == 0:
json_data = json_data + json.dumps(dic)
checker = 1
else:
json_data = json_data + ',' + json.dumps(dic)
# Get WordPress sites for this website
wp_sites = []
try:
wp_sites = WPSites.objects.filter(owner=items)
wp_sites = [{
'id': wp.id,
'title': wp.title,
'url': wp.FinalURL,
'version': wp.version if hasattr(wp, 'version') else 'Unknown',
'phpVersion': wp.phpVersion if hasattr(wp, 'phpVersion') else 'Unknown'
} for wp in wp_sites]
except:
pass
json_data = json_data + ']'
json_data.append({
'domain': items.domain,
'adminEmail': items.adminEmail,
'ipAddress': ipAddress,
'admin': items.admin.userName,
'package': items.package.packageName,
'state': state,
'diskUsed': diskUsed,
'phpVersion': PHPVersionActual,
'wp_sites': wp_sites
})
return json_data
return json.dumps(json_data)
def findWebsitesJson(self, currentACL, userID, pageNumber):
finalPageNumber = ((pageNumber * 10)) - 10
@@ -4779,7 +4823,6 @@ StrictHostKeyChecking no
return ACLManager.loadErrorJson()
tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999))
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
execPath = execPath + " switchServer --phpVersion '" + phpVersion + "' --server " + str(
server) + " --virtualHostName " + domainName + " --tempStatusPath " + tempStatusPath
@@ -7221,5 +7264,4 @@ StrictHostKeyChecking no
except BaseException as msg:
data_ret = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
return HttpResponse(json_data)