wphomechanges

This commit is contained in:
Hassan Hashmi
2022-06-20 13:27:55 +05:00
parent 19fab57d1f
commit 7f0849fde7
5 changed files with 359 additions and 103 deletions

View File

@@ -1476,6 +1476,108 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
};
$scope.installwpcore = function () {
$('#wordpresshomeloading').show();
var data = {
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/installwpcore";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$('#wordpresshomeloading').hide();
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'installwpcore done.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$('#wordpresshomeloading').hide();
$scope.wordpresshomeloading = true;
alert(response)
}
};
$scope.dataintegrity = function () {
$('#wordpresshomeloading').show();
var data = {
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/dataintegrity";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$('#wordpresshomeloading').hide();
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'dataintegrity done.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$('#wordpresshomeloading').hide();
$scope.wordpresshomeloading = true;
alert(response)
}
};
});

View File

@@ -65,7 +65,7 @@
Open
</a>
<a target="_blank"
href="/filemanager/{{ wpsite.owner.domain }}?path={{wpsite.path}}"
href="/filemanager/{{ wpsite.owner.domain }}?path={{ wpsite.path }}"
style="margin-left: 4%">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -224,6 +224,17 @@
for="maintenanceMode"></label>
</div>
</div>
<div class="col-md-3">
<h6 style="font-weight: bold"> WP Corn</h6>
<div class="custom-control custom-switch">
<input
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>
@@ -498,7 +509,8 @@
</div>
<hr>
<div class="d-lg-flex d-none justify-content-center">
<div style="display: flex; flex-wrap: wrap">
<div class="col-sm-11">
<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"
@@ -529,7 +541,30 @@
</svg>
Autoupdate Configurations
</a>
</div>
<div class="col-sm-1">
<a data-toggle="modal"
data-target="#securitymodel" style="margin-left: 3%"
href="javascript: void(0);">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="1em"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
<path fill="#626262"
d="M12 22q-3.475-.875-5.737-3.988Q4 14.9 4 11.1V5l8-3l8 3v6.1q0 3.8-2.262 6.912Q15.475 21.125 12 22Zm0-2.1q2.425-.75 4.05-2.962q1.625-2.213 1.9-4.938H12V4.125l-6 2.25v5.175q0 .175.05.45H12Z"/>
</svg>
Security
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-------Start Model of AutoUpdateCongiguration-->
<div id="autoUpdateConfig" class="modal fade" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog">
@@ -603,13 +638,45 @@
</div>
<!-- /.modal-dialog -->
</div>
<!-------End Model of AutoUpdateCongiguration-->
<!-------Start Model of Security-->
<div id="securitymodel" class="modal fade" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
&times;
</button>
<h4 class="modal-title">{% trans "Security" %}</h4>
</div>
</div>
<div class="modal-body center-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
</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
</button>
</div>
</div>
</div>
<!-- /.modal-dialog -->
</div>
<!-------End Model of Security-->
<div id="DeployToProduction" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->

View File

@@ -43,6 +43,9 @@ urlpatterns = [
url(r'^DeploytoProduction', views.DeploytoProduction, name='DeploytoProduction'),
url(r'^WPCreateBackup', views.WPCreateBackup, name='WPCreateBackup'),
url(r'^RestoreWPbackupNow', views.RestoreWPbackupNow, name='RestoreWPbackupNow'),
url(r'^RestoreWPbackupNow', views.RestoreWPbackupNow, name='RestoreWPbackupNow'),
url(r'^dataintegrity', views.dataintegrity, name='dataintegrity'),
url(r'^installwpcore', views.installwpcore, name='installwpcore'),

View File

@@ -386,6 +386,50 @@ def RestoreWPbackupNow(request):
return redirect(loadLoginPage)
def installwpcore(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.installwpcore(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def dataintegrity(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.dataintegrity(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:

View File

@@ -914,6 +914,46 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def installwpcore(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPid = data['WPid']
time.sleep(2)
data_ret = {'status': 1, 'installStatus': 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 dataintegrity(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPid = data['WPid']
time.sleep(2)
data_ret = {'status': 1, 'installStatus': 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 UpdatePlugins(self, userID=None, data=None):
try: