diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
index 314bf7785..849d13a25 100755
--- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js
+++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
@@ -1376,6 +1376,50 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
};
+
+ $scope.CreateBackup = function (){
+ $('#wordpresshomeloading').show();
+ var data = {
+ WPid: $('#WPid').html(),
+ }
+ var url = "/websites/WPCreateBackup";
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $('#wordpresshomeloading').hide();
+ if (response.data.status === 1) {
+ new PNotify({
+ title: 'Success!',
+ text: 'Backup Created!.',
+ type: 'success'
+ });
+ } else {
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type: 'error'
+ });
+
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+ $('#wordpresshomeloading').hide();
+ alert(response)
+
+ }
+
+ };
+
});
var DeploytoProductionID;
diff --git a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html
index bd8767a22..b82bf8be2 100644
--- a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html
+++ b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html
@@ -396,6 +396,11 @@
Autoupdate Configurations
+
+
+
diff --git a/websiteFunctions/urls.py b/websiteFunctions/urls.py
index 456273364..2115cd4e3 100755
--- a/websiteFunctions/urls.py
+++ b/websiteFunctions/urls.py
@@ -39,6 +39,7 @@ urlpatterns = [
url(r'^fetchstaging', views.fetchstaging, name='fetchstaging'),
url(r'^SaveUpdateConfig', views.SaveUpdateConfig, name='SaveUpdateConfig'),
url(r'^DeploytoProduction', views.DeploytoProduction, name='DeploytoProduction'),
+ url(r'^WPCreateBackup', views.WPCreateBackup, name='WPCreateBackup'),
diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py
index 2c3f730d1..8ecd708c1 100755
--- a/websiteFunctions/views.py
+++ b/websiteFunctions/views.py
@@ -322,6 +322,27 @@ def DeploytoProduction(request):
except KeyError:
return redirect(loadLoginPage)
+def WPCreateBackup(request):
+ try:
+ userID = request.session['userID']
+
+ result = pluginManager.preWebsiteCreation(request)
+
+ if result != 200:
+ return result
+
+ wm = WebsiteManager()
+ coreResult = wm.WPCreateBackup(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):
diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py
index d97e00370..25f5a5499 100755
--- a/websiteFunctions/website.py
+++ b/websiteFunctions/website.py
@@ -692,6 +692,46 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
+
+ def WPCreateBackup(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)
+
+
+ if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
+ pass
+ else:
+ return ACLManager.loadError()
+
+ # extraArgs = {}
+ # extraArgs['adminID'] = admin.pk
+ # extraArgs['StagingDomain'] = StagingObj.FinalURL
+ # extraArgs['StagingName'] = StagingObj.title
+ # extraArgs['WPid'] = WPManagerID
+ # extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
+
+
+
+ # background = ApplicationInstaller('CreateStagingNow', extraArgs)
+ # background.start()
+
+ 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: