bug fixes in wp manager

This commit is contained in:
Usman Nasir
2022-06-21 13:00:16 +05:00
parent d64ba8e3a7
commit a808fa9d36
3 changed files with 93 additions and 46 deletions

View File

@@ -633,12 +633,18 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
text: 'Successfully Updated!.',
type: 'success'
});
if (setting === "PasswordProtection"){
location.reload();
}
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
if (setting === "PasswordProtection"){
location.reload();
}
}
@@ -1592,9 +1598,10 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'installwpcore done.',
text: 'Results fetched..',
type: 'success'
});
$('#SecurityResult').html(response.data.result);
} else {
new PNotify({
title: 'Operation Failed!',
@@ -1646,9 +1653,10 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'dataintegrity done.',
text: 'Results fetched',
type: 'success'
});
$('#SecurityResult').html(response.data.result);
} else {
new PNotify({
title: 'Operation Failed!',

View File

@@ -175,12 +175,12 @@
</div>
</div>
<div class="col-md-3">
<h6 style="font-weight: bold"> WP Cron</h6>
<h6 style="font-weight: bold">Disable WP Cron</h6>
<div class="custom-control custom-switch">
<input ng-click="UpdateWPSettings('Wpcron')"
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-empty"
id="wpcron">
id="Wpcron">
<label class="custom-control-label"
for="wpcron"></label>
</div>
@@ -692,19 +692,23 @@
src="{% static 'images/loading.gif' %}"></h4>
</div>
<div class="modal-body center-div">
<div class="alert alert-warning">
<h4 class="alert-title">Status</h4>
<p id="SecurityResult"></p>
</div>
<button
data-toggle="modal"
data-target="#DeleteMember" aria-label=""
ng-click="dataintegrity()"
type="button" class="btn btn-border btn-alt border-azure btn-link font-black">
data integrity
Data integrity
</button>
<button
data-toggle="modal"
data-target="#DeleteMember" aria-label=""
ng-click="installwpcore()"
type="button" class="btn btn-border btn-alt border-azure btn-link font-black">
Install WP Core
Re-Install WP Core
</button>

View File

@@ -139,6 +139,8 @@ class WebsiteManager:
else:
return ACLManager.loadError()
try:
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
data = {
"name": "wp-manager",
@@ -168,6 +170,11 @@ class WebsiteManager:
else:
return redirect("https://cyberpanel.net/cyberpanel-addons")
except:
proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
Data, 'createWebsite')
return proc.render()
def RestoreHome(self, request=None, userID=None, BackupID=None ):
Data = {}
currentACL = ACLManager.loadedACL(userID)
@@ -621,9 +628,9 @@ class WebsiteManager:
vhostPassDir = f'/home/{vhostName}'
path = f'{vhostPassDir}/{WPManagerID}'
if os.path.exists(path):
passwd = 0
else:
passwd = 1
else:
passwd = 0
#### Check WP cron
@@ -1024,12 +1031,11 @@ class WebsiteManager:
version = version.rstrip("\n")
###install wp core
command = "sudo -u %s wp core download --force --skip-content --version=%s"%(Vhuser, version)
command = f"sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp core download --force --skip-content --version={version} --path={path}"
output = ProcessUtilities.outputExecutioner(command)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', 'result': output}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1065,15 +1071,12 @@ class WebsiteManager:
###fetch WP version
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core verify-checksums --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
version = ProcessUtilities.outputExecutioner(command)
version = version.rstrip("\n")
###dataintegrity
result = ProcessUtilities.outputExecutioner(command)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', 'result': result}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1472,7 +1475,6 @@ class WebsiteManager:
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)
@@ -1498,7 +1500,6 @@ class WebsiteManager:
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)
@@ -1512,8 +1513,6 @@ class WebsiteManager:
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)
@@ -1528,8 +1527,6 @@ class WebsiteManager:
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)
elif setting == 'PasswordProtection':
execPath = f"/usr/local/CyberCP/bin/python {virtualHostUtilities.cyberPanel}/plogical/virtualHostUtilities.py"
execPath = f"{execPath} EnableDisablePP --username '{PPUsername}' --password '{PPPassword}' " \
@@ -1537,9 +1534,47 @@ class WebsiteManager:
ProcessUtilities.executioner(execPath)
elif setting == 'Wpcron':
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
version = ProcessUtilities.outputExecutioner(command)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set DISABLE_WP_CRON 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 DISABLE_WP_CRON 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))
data_ret = {'status': 1, 'error_message': 'None'}