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

View File

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

View File

@@ -139,6 +139,8 @@ class WebsiteManager:
else: else:
return ACLManager.loadError() return ACLManager.loadError()
try:
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission" url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
data = { data = {
"name": "wp-manager", "name": "wp-manager",
@@ -168,6 +170,11 @@ class WebsiteManager:
else: else:
return redirect("https://cyberpanel.net/cyberpanel-addons") 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 ): def RestoreHome(self, request=None, userID=None, BackupID=None ):
Data = {} Data = {}
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
@@ -621,9 +628,9 @@ class WebsiteManager:
vhostPassDir = f'/home/{vhostName}' vhostPassDir = f'/home/{vhostName}'
path = f'{vhostPassDir}/{WPManagerID}' path = f'{vhostPassDir}/{WPManagerID}'
if os.path.exists(path): if os.path.exists(path):
passwd = 0
else:
passwd = 1 passwd = 1
else:
passwd = 0
#### Check WP cron #### Check WP cron
@@ -1024,12 +1031,11 @@ class WebsiteManager:
version = version.rstrip("\n") version = version.rstrip("\n")
###install wp core ###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) output = ProcessUtilities.outputExecutioner(command)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', 'result': output}
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
@@ -1065,15 +1071,12 @@ class WebsiteManager:
###fetch WP version ###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) Vhuser, FinalPHPPath, path)
version = ProcessUtilities.outputExecutioner(command) result = ProcessUtilities.outputExecutioner(command)
version = version.rstrip("\n")
###dataintegrity
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) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
@@ -1472,7 +1475,6 @@ class WebsiteManager:
else: 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) 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) stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'debugging': 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) 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) Vhuser, FinalPHPPath, path)
stdout = ProcessUtilities.outputExecutioner(command) stdout = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging output:" + str(stdout)) logging.CyberCPLogFileWriter.writeToFile("Debugging output:" + str(stdout))
elif setting == 'searchIndex': 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) 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: 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) 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) stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'maintenanceMode': 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) 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: 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) 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) stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'PasswordProtection': elif setting == 'PasswordProtection':
execPath = f"/usr/local/CyberCP/bin/python {virtualHostUtilities.cyberPanel}/plogical/virtualHostUtilities.py" execPath = f"/usr/local/CyberCP/bin/python {virtualHostUtilities.cyberPanel}/plogical/virtualHostUtilities.py"
execPath = f"{execPath} EnableDisablePP --username '{PPUsername}' --password '{PPPassword}' " \ execPath = f"{execPath} EnableDisablePP --username '{PPUsername}' --password '{PPPassword}' " \
@@ -1537,9 +1534,47 @@ class WebsiteManager:
ProcessUtilities.executioner(execPath) ProcessUtilities.executioner(execPath)
elif setting == 'Wpcron': 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) 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'} data_ret = {'status': 1, 'error_message': 'None'}