mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-12 08:16:11 +01:00
ssl bug fix for backups
This commit is contained in:
1326
backup/backupManager.py
Normal file
1326
backup/backupManager.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
//*** Backup site ****//
|
//*** Backup site ****//
|
||||||
|
|
||||||
app.controller('backupWebsiteControl', function($scope,$http,$timeout) {
|
app.controller('backupWebsiteControl', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.destination = true;
|
$scope.destination = true;
|
||||||
$scope.backupButton = true;
|
$scope.backupButton = true;
|
||||||
@@ -21,17 +21,17 @@ app.controller('backupWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
url = "/backup/cancelBackupCreation";
|
url = "/backup/cancelBackupCreation";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
backupCancellationDomain:backupCancellationDomain,
|
backupCancellationDomain: backupCancellationDomain,
|
||||||
fileName:$scope.fileName,
|
fileName: $scope.fileName,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ app.controller('backupWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function getBackupStatus(){
|
function getBackupStatus() {
|
||||||
|
|
||||||
$scope.backupLoadingBottom = false;
|
$scope.backupLoadingBottom = false;
|
||||||
|
|
||||||
@@ -53,26 +53,25 @@ app.controller('backupWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
url = "/backup/backupStatus";
|
url = "/backup/backupStatus";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
websiteToBeBacked:websiteToBeBacked,
|
websiteToBeBacked: websiteToBeBacked,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.backupStatus === 1){
|
if (response.data.backupStatus === 1) {
|
||||||
|
|
||||||
if(response.data.abort === 1){
|
if (response.data.abort === 1) {
|
||||||
$timeout.cancel();
|
$timeout.cancel();
|
||||||
$scope.backupLoadingBottom = true;
|
$scope.backupLoadingBottom = true;
|
||||||
$scope.destination = false;
|
$scope.destination = false;
|
||||||
@@ -85,7 +84,7 @@ app.controller('backupWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
populateCurrentRecords();
|
populateCurrentRecords();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$scope.destination = true;
|
$scope.destination = true;
|
||||||
$scope.backupButton = true;
|
$scope.backupButton = true;
|
||||||
$scope.runningBackup = false;
|
$scope.runningBackup = false;
|
||||||
@@ -97,7 +96,7 @@ app.controller('backupWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$timeout.cancel();
|
$timeout.cancel();
|
||||||
$scope.backupLoadingBottom = true;
|
$scope.backupLoadingBottom = true;
|
||||||
$scope.backupLoading = true;
|
$scope.backupLoading = true;
|
||||||
@@ -106,7 +105,9 @@ app.controller('backupWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
function cantLoadInitialDatas(response) {}
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -116,75 +117,75 @@ app.controller('backupWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function populateCurrentRecords(){
|
function populateCurrentRecords() {
|
||||||
|
|
||||||
var websiteToBeBacked = $scope.websiteToBeBacked;
|
var websiteToBeBacked = $scope.websiteToBeBacked;
|
||||||
|
|
||||||
url = "/backup/getCurrentBackups";
|
url = "/backup/getCurrentBackups";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
websiteToBeBacked:websiteToBeBacked,
|
websiteToBeBacked: websiteToBeBacked,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.fetchStatus == 1){
|
if (response.data.fetchStatus == 1) {
|
||||||
$scope.records = JSON.parse(response.data.data);
|
$scope.records = JSON.parse(response.data.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
function cantLoadInitialDatas(response) {}
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.createBackup = function () {
|
||||||
$scope.createBackup = function(){
|
|
||||||
|
|
||||||
var websiteToBeBacked = $scope.websiteToBeBacked;
|
var websiteToBeBacked = $scope.websiteToBeBacked;
|
||||||
$scope.backupLoading = false;
|
$scope.backupLoading = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
url = "/backup/submitBackupCreation";
|
url = "/backup/submitBackupCreation";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
websiteToBeBacked:websiteToBeBacked,
|
websiteToBeBacked: websiteToBeBacked,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.metaStatus === 1){
|
if (response.data.metaStatus === 1) {
|
||||||
getBackupStatus();
|
getBackupStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
function cantLoadInitialDatas(response) {}
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -195,60 +196,56 @@ app.controller('backupWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
url = "/backup/deleteBackup";
|
url = "/backup/deleteBackup";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
backupID:id,
|
backupID: id,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.deleteStatus == 1){
|
if (response.data.deleteStatus == 1) {
|
||||||
|
|
||||||
populateCurrentRecords();
|
populateCurrentRecords();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
///** Backup site ends **///
|
///** Backup site ends **///
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///** Restore site ***//
|
///** Restore site ***//
|
||||||
|
|
||||||
|
|
||||||
app.controller('restoreWebsiteControl', function($scope,$http,$timeout) {
|
app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.restoreLoading = true;
|
$scope.restoreLoading = true;
|
||||||
$scope.runningRestore = true;
|
$scope.runningRestore = true;
|
||||||
$scope.restoreButton=true;
|
$scope.restoreButton = true;
|
||||||
$scope.restoreFinished = false;
|
$scope.restoreFinished = false;
|
||||||
$scope.couldNotConnect = true;
|
$scope.couldNotConnect = true;
|
||||||
$scope.backupError = true;
|
$scope.backupError = true;
|
||||||
@@ -265,44 +262,43 @@ app.controller('restoreWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function getRestoreStatus(){
|
function getRestoreStatus() {
|
||||||
|
|
||||||
var backupFile = $scope.backupFile;
|
var backupFile = $scope.backupFile;
|
||||||
|
|
||||||
url = "/backup/restoreStatus";
|
url = "/backup/restoreStatus";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
backupFile:backupFile,
|
backupFile: backupFile,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.restoreStatus === 1){
|
if (response.data.restoreStatus === 1) {
|
||||||
|
|
||||||
if(response.data.abort === 1){
|
if (response.data.abort === 1) {
|
||||||
$scope.running = response.data.running;
|
$scope.running = response.data.running;
|
||||||
$scope.fileName = $scope.backupFile;
|
$scope.fileName = $scope.backupFile;
|
||||||
$scope.restoreLoading = true;
|
$scope.restoreLoading = true;
|
||||||
$scope.status = response.data.status;
|
$scope.status = response.data.status;
|
||||||
$scope.runningRestore = false;
|
$scope.runningRestore = false;
|
||||||
$scope.restoreButton=false;
|
$scope.restoreButton = false;
|
||||||
$scope.restoreFinished = true;
|
$scope.restoreFinished = true;
|
||||||
$timeout.cancel();
|
$timeout.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$scope.running = response.data.running;
|
$scope.running = response.data.running;
|
||||||
$scope.fileName = $scope.backupFile;
|
$scope.fileName = $scope.backupFile;
|
||||||
$scope.restoreLoading = false;
|
$scope.restoreLoading = false;
|
||||||
@@ -314,6 +310,7 @@ app.controller('restoreWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.couldNotConnect = false;
|
$scope.couldNotConnect = false;
|
||||||
|
|
||||||
@@ -323,31 +320,30 @@ app.controller('restoreWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.restoreBackup = function(){
|
$scope.restoreBackup = function () {
|
||||||
var backupFile = $scope.backupFile;
|
var backupFile = $scope.backupFile;
|
||||||
$scope.running = "Lets start.."
|
$scope.running = "Lets start.."
|
||||||
|
|
||||||
url = "/backup/submitRestore";
|
url = "/backup/submitRestore";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
backupFile:backupFile,
|
backupFile: backupFile,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
$scope.restoreLoading = true;
|
$scope.restoreLoading = true;
|
||||||
if(response.data.restoreStatus == 1){
|
if (response.data.restoreStatus == 1) {
|
||||||
$scope.runningRestore = false;
|
$scope.runningRestore = false;
|
||||||
$scope.running = "Running";
|
$scope.running = "Running";
|
||||||
$scope.fileName = $scope.backupFile;
|
$scope.fileName = $scope.backupFile;
|
||||||
@@ -355,12 +351,13 @@ app.controller('restoreWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
getRestoreStatus();
|
getRestoreStatus();
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$scope.backupError = false;
|
$scope.backupError = false;
|
||||||
$scope.errorMessage = response.data.error_message;
|
$scope.errorMessage = response.data.error_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.couldNotConnect = false;
|
$scope.couldNotConnect = false;
|
||||||
|
|
||||||
@@ -369,37 +366,37 @@ app.controller('restoreWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function createWebsite(){
|
function createWebsite() {
|
||||||
|
|
||||||
var backupFile = $scope.backupFile;
|
var backupFile = $scope.backupFile;
|
||||||
|
|
||||||
url = "/websites/CreateWebsiteFromBackup";
|
url = "/websites/CreateWebsiteFromBackup";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
backupFile:backupFile,
|
backupFile: backupFile,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
if(response.data.createWebSiteStatus == 1){
|
if (response.data.createWebSiteStatus == 1) {
|
||||||
getRestoreStatus();
|
getRestoreStatus();
|
||||||
}
|
}
|
||||||
else if(response.data.existsStatus == 1){
|
else if (response.data.existsStatus == 1) {
|
||||||
$scope.backupError = false;
|
$scope.backupError = false;
|
||||||
$scope.errorMessage = response.data.error_message;
|
$scope.errorMessage = response.data.error_message;
|
||||||
$scope.restoreButton = true;
|
$scope.restoreButton = true;
|
||||||
$scope.runningRestore = true;
|
$scope.runningRestore = true;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$scope.websiteDomain = domainName;
|
$scope.websiteDomain = domainName;
|
||||||
$scope.backupError = false;
|
$scope.backupError = false;
|
||||||
$scope.errorMessage = response.data.error_message;
|
$scope.errorMessage = response.data.error_message;
|
||||||
@@ -407,29 +404,25 @@ app.controller('restoreWebsiteControl', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.couldNotConnect = false;
|
$scope.couldNotConnect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//*** Resotre site ends here ***///
|
//*** Resotre site ends here ***///
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///** Backup Destination ***//
|
///** Backup Destination ***//
|
||||||
|
|
||||||
|
|
||||||
app.controller('backupDestinations', function($scope,$http,$timeout) {
|
app.controller('backupDestinations', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
$scope.connectionFailed = true;
|
$scope.connectionFailed = true;
|
||||||
@@ -453,26 +446,25 @@ app.controller('backupDestinations', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
IPAddress : $scope.IPAddress,
|
IPAddress: $scope.IPAddress,
|
||||||
password : $scope.password,
|
password: $scope.password,
|
||||||
backupSSHPort:$scope.backupSSHPort,
|
backupSSHPort: $scope.backupSSHPort,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.destStatus == 1){
|
if (response.data.destStatus == 1) {
|
||||||
|
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
$scope.connectionFailed = true;
|
$scope.connectionFailed = true;
|
||||||
@@ -495,6 +487,7 @@ app.controller('backupDestinations', function($scope,$http,$timeout) {
|
|||||||
$scope.errorMessage = response.data.error_message;
|
$scope.errorMessage = response.data.error_message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
$scope.connectionFailed = true;
|
$scope.connectionFailed = true;
|
||||||
@@ -519,24 +512,23 @@ app.controller('backupDestinations', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
IPAddress : ip,
|
IPAddress: ip,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.connStatus == 1){
|
if (response.data.connStatus == 1) {
|
||||||
|
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
$scope.connectionFailed = true;
|
$scope.connectionFailed = true;
|
||||||
@@ -560,6 +552,7 @@ app.controller('backupDestinations', function($scope,$http,$timeout) {
|
|||||||
$scope.IPAddress = ip;
|
$scope.IPAddress = ip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
$scope.connectionFailed = true;
|
$scope.connectionFailed = true;
|
||||||
@@ -584,24 +577,23 @@ app.controller('backupDestinations', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
IPAddress : ip,
|
IPAddress: ip,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.delStatus == 1){
|
if (response.data.delStatus == 1) {
|
||||||
|
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
$scope.connectionFailed = true;
|
$scope.connectionFailed = true;
|
||||||
@@ -626,6 +618,7 @@ app.controller('backupDestinations', function($scope,$http,$timeout) {
|
|||||||
$scope.IPAddress = ip;
|
$scope.IPAddress = ip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
$scope.connectionFailed = true;
|
$scope.connectionFailed = true;
|
||||||
@@ -638,34 +631,32 @@ app.controller('backupDestinations', function($scope,$http,$timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function populateCurrentRecords() {
|
||||||
function populateCurrentRecords(){
|
|
||||||
|
|
||||||
url = "/backup/getCurrentBackupDestinations";
|
url = "/backup/getCurrentBackupDestinations";
|
||||||
|
|
||||||
var data = {
|
var data = {};
|
||||||
};
|
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.fetchStatus == 1){
|
if (response.data.fetchStatus == 1) {
|
||||||
|
|
||||||
$scope.records = JSON.parse(response.data.data);
|
$scope.records = JSON.parse(response.data.data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.couldNotConnect = false;
|
$scope.couldNotConnect = false;
|
||||||
}
|
}
|
||||||
@@ -681,7 +672,7 @@ app.controller('backupDestinations', function($scope,$http,$timeout) {
|
|||||||
///** Schedule Backup ***//
|
///** Schedule Backup ***//
|
||||||
|
|
||||||
|
|
||||||
app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
app.controller('scheduleBackup', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
$scope.scheduleBackupLoading = true;
|
||||||
$scope.canNotAddSchedule = true;
|
$scope.canNotAddSchedule = true;
|
||||||
@@ -722,30 +713,28 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
$scope.scheduleBtn = false;
|
$scope.scheduleBtn = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
url = "/backup/submitBackupSchedule";
|
url = "/backup/submitBackupSchedule";
|
||||||
|
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
backupDest : $scope.backupDest,
|
backupDest: $scope.backupDest,
|
||||||
backupFreq : $scope.backupFreq,
|
backupFreq: $scope.backupFreq,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.scheduleStatus == 1){
|
if (response.data.scheduleStatus == 1) {
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
$scope.scheduleBackupLoading = true;
|
||||||
$scope.canNotAddSchedule = true;
|
$scope.canNotAddSchedule = true;
|
||||||
@@ -755,7 +744,6 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
$scope.scheduleBtn = true;
|
$scope.scheduleBtn = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
populateCurrentRecords();
|
populateCurrentRecords();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -771,6 +759,7 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
$scope.errorMessage = response.data.error_message;
|
$scope.errorMessage = response.data.error_message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
$scope.scheduleBackupLoading = true;
|
||||||
@@ -797,24 +786,23 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
IPAddress : ip,
|
IPAddress: ip,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.connStatus == 1){
|
if (response.data.connStatus == 1) {
|
||||||
|
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
$scope.connectionFailed = true;
|
$scope.connectionFailed = true;
|
||||||
@@ -838,6 +826,7 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
$scope.IPAddress = ip;
|
$scope.IPAddress = ip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.destinationLoading = true;
|
$scope.destinationLoading = true;
|
||||||
$scope.connectionFailed = true;
|
$scope.connectionFailed = true;
|
||||||
@@ -849,7 +838,7 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.delSchedule = function (destLoc,frequency) {
|
$scope.delSchedule = function (destLoc, frequency) {
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = false;
|
$scope.scheduleBackupLoading = false;
|
||||||
$scope.canNotAddSchedule = true;
|
$scope.canNotAddSchedule = true;
|
||||||
@@ -863,25 +852,24 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
destLoc : destLoc,
|
destLoc: destLoc,
|
||||||
frequency: frequency,
|
frequency: frequency,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.delStatus == 1){
|
if (response.data.delStatus == 1) {
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
$scope.scheduleBackupLoading = true;
|
||||||
$scope.canNotAddSchedule = true;
|
$scope.canNotAddSchedule = true;
|
||||||
@@ -906,6 +894,7 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
$scope.errorMessage = response.data.error_message;
|
$scope.errorMessage = response.data.error_message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
$scope.scheduleBackupLoading = true;
|
||||||
@@ -919,34 +908,32 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function populateCurrentRecords() {
|
||||||
function populateCurrentRecords(){
|
|
||||||
|
|
||||||
url = "/backup/getCurrentBackupSchedules";
|
url = "/backup/getCurrentBackupSchedules";
|
||||||
|
|
||||||
var data = {
|
var data = {};
|
||||||
};
|
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers : {
|
headers: {
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
if(response.data.fetchStatus == 1){
|
if (response.data.fetchStatus == 1) {
|
||||||
|
|
||||||
$scope.records = JSON.parse(response.data.data);
|
$scope.records = JSON.parse(response.data.data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.couldNotConnect = false;
|
$scope.couldNotConnect = false;
|
||||||
}
|
}
|
||||||
@@ -960,7 +947,7 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
|
|||||||
|
|
||||||
|
|
||||||
//*** Remote Backup site ****//
|
//*** Remote Backup site ****//
|
||||||
app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
$scope.backupButton = true;
|
$scope.backupButton = true;
|
||||||
$scope.backupLoading = true;
|
$scope.backupLoading = true;
|
||||||
@@ -993,32 +980,31 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
var index = 0;
|
var index = 0;
|
||||||
var tempTransferDir = "";
|
var tempTransferDir = "";
|
||||||
|
|
||||||
$scope.passwordEnter = function() {
|
$scope.passwordEnter = function () {
|
||||||
$scope.backupButton = false;
|
$scope.backupButton = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addRemoveWebsite = function (website,websiteStatus) {
|
$scope.addRemoveWebsite = function (website, websiteStatus) {
|
||||||
|
|
||||||
if(websiteStatus === true)
|
if (websiteStatus === true) {
|
||||||
{
|
|
||||||
var check = 1;
|
var check = 1;
|
||||||
for(var j = 0; j < websitesToBeBacked.length; j++){
|
for (var j = 0; j < websitesToBeBacked.length; j++) {
|
||||||
if (websitesToBeBacked[j] == website){
|
if (websitesToBeBacked[j] == website) {
|
||||||
check = 0;
|
check = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(check == 1) {
|
if (check == 1) {
|
||||||
websitesToBeBacked.push(website);
|
websitesToBeBacked.push(website);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
|
|
||||||
var tempArray = [];
|
var tempArray = [];
|
||||||
|
|
||||||
for(var j = 0; j < websitesToBeBacked.length; j++){
|
for (var j = 0; j < websitesToBeBacked.length; j++) {
|
||||||
if (websitesToBeBacked[j] != website){
|
if (websitesToBeBacked[j] != website) {
|
||||||
tempArray.push(websitesToBeBacked[j]);
|
tempArray.push(websitesToBeBacked[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1028,12 +1014,12 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
|
|
||||||
$scope.allChecked = function (webSiteStatus) {
|
$scope.allChecked = function (webSiteStatus) {
|
||||||
|
|
||||||
if(webSiteStatus === true) {
|
if (webSiteStatus === true) {
|
||||||
|
|
||||||
websitesToBeBacked = websitesToBeBackedTemp;
|
websitesToBeBacked = websitesToBeBackedTemp;
|
||||||
$scope.webSiteStatus = true;
|
$scope.webSiteStatus = true;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
websitesToBeBacked = [];
|
websitesToBeBacked = [];
|
||||||
$scope.webSiteStatus = false;
|
$scope.webSiteStatus = false;
|
||||||
}
|
}
|
||||||
@@ -1076,7 +1062,7 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
$scope.records = JSON.parse(response.data.data);
|
$scope.records = JSON.parse(response.data.data);
|
||||||
var parsed = JSON.parse(response.data.data);
|
var parsed = JSON.parse(response.data.data);
|
||||||
|
|
||||||
for(var j = 0; j < parsed.length; j++){
|
for (var j = 0; j < parsed.length; j++) {
|
||||||
websitesToBeBackedTemp.push(parsed[j].website);
|
websitesToBeBackedTemp.push(parsed[j].website);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1138,8 +1124,7 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
$scope.backupCancelled = true;
|
$scope.backupCancelled = true;
|
||||||
|
|
||||||
|
|
||||||
|
if (websitesToBeBacked.length === 0) {
|
||||||
if(websitesToBeBacked.length === 0){
|
|
||||||
alert("No websites selected for transfer.");
|
alert("No websites selected for transfer.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1157,7 +1142,7 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
var data = {
|
var data = {
|
||||||
ipAddress: IPAddress,
|
ipAddress: IPAddress,
|
||||||
password: password,
|
password: password,
|
||||||
accountsToTransfer:websitesToBeBacked,
|
accountsToTransfer: websitesToBeBacked,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
@@ -1237,7 +1222,7 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
url = "/backup/getRemoteTransferStatus";
|
url = "/backup/getRemoteTransferStatus";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
password : $scope.password,
|
password: $scope.password,
|
||||||
ipAddress: $scope.IPAddress,
|
ipAddress: $scope.IPAddress,
|
||||||
dir: tempTransferDir
|
dir: tempTransferDir
|
||||||
};
|
};
|
||||||
@@ -1255,12 +1240,12 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
|
|
||||||
if (response.data.remoteTransferStatus === 1) {
|
if (response.data.remoteTransferStatus === 1) {
|
||||||
|
|
||||||
if(response.data.backupsSent === 0){
|
if (response.data.backupsSent === 0) {
|
||||||
$scope.backupStatus = false;
|
$scope.backupStatus = false;
|
||||||
$scope.requestData = response.data.status;
|
$scope.requestData = response.data.status;
|
||||||
$timeout(getBackupStatus, 2000);
|
$timeout(getBackupStatus, 2000);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$scope.requestData = response.data.status;
|
$scope.requestData = response.data.status;
|
||||||
$timeout.cancel();
|
$timeout.cancel();
|
||||||
|
|
||||||
@@ -1269,7 +1254,7 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
remoteBackupRestore();
|
remoteBackupRestore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
|
|
||||||
$scope.error_message = response.data.error_message;
|
$scope.error_message = response.data.error_message;
|
||||||
$scope.backupLoading = true;
|
$scope.backupLoading = true;
|
||||||
@@ -1297,7 +1282,7 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function remoteBackupRestore(){
|
function remoteBackupRestore() {
|
||||||
url = "/backup/remoteBackupRestore";
|
url = "/backup/remoteBackupRestore";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
@@ -1337,7 +1322,6 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
function localRestoreStatus(password) {
|
function localRestoreStatus(password) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
url = "/backup/localRestoreStatus";
|
url = "/backup/localRestoreStatus";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
@@ -1357,19 +1341,19 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
|
|
||||||
if (response.data.remoteTransferStatus === 1) {
|
if (response.data.remoteTransferStatus === 1) {
|
||||||
|
|
||||||
if(response.data.complete === 0){
|
if (response.data.complete === 0) {
|
||||||
$scope.backupStatus = false;
|
$scope.backupStatus = false;
|
||||||
$scope.restoreData = response.data.status;
|
$scope.restoreData = response.data.status;
|
||||||
$timeout(localRestoreStatus, 2000);
|
$timeout(localRestoreStatus, 2000);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$scope.restoreData = response.data.status;
|
$scope.restoreData = response.data.status;
|
||||||
$timeout.cancel();
|
$timeout.cancel();
|
||||||
$scope.backupLoading = true;
|
$scope.backupLoading = true;
|
||||||
$scope.startTransferbtn = false;
|
$scope.startTransferbtn = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
|
|
||||||
$scope.error_message = response.data.error_message;
|
$scope.error_message = response.data.error_message;
|
||||||
$scope.backupLoading = true;
|
$scope.backupLoading = true;
|
||||||
@@ -1402,7 +1386,7 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
url = "/backup/getRemoteTransferStatus";
|
url = "/backup/getRemoteTransferStatus";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
password : $scope.password,
|
password: $scope.password,
|
||||||
ipAddress: $scope.IPAddress,
|
ipAddress: $scope.IPAddress,
|
||||||
dir: tempTransferDir,
|
dir: tempTransferDir,
|
||||||
};
|
};
|
||||||
@@ -1420,12 +1404,12 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
|
|
||||||
if (response.data.remoteTransferStatus == 1) {
|
if (response.data.remoteTransferStatus == 1) {
|
||||||
|
|
||||||
if(response.data.backupsSent == 0){
|
if (response.data.backupsSent == 0) {
|
||||||
$scope.backupStatus = false;
|
$scope.backupStatus = false;
|
||||||
$scope.requestData = response.data.status;
|
$scope.requestData = response.data.status;
|
||||||
$timeout(getBackupStatus, 2000);
|
$timeout(getBackupStatus, 2000);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$timeout.cancel();
|
$timeout.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1463,7 +1447,7 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
var data = {
|
var data = {
|
||||||
ipAddress: IPAddress,
|
ipAddress: IPAddress,
|
||||||
password: password,
|
password: password,
|
||||||
dir:tempTransferDir,
|
dir: tempTransferDir,
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
@@ -1525,7 +1509,6 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
|
|||||||
$scope.backupCancelled = true;
|
$scope.backupCancelled = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.shortcuts import redirect
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
import json
|
import json
|
||||||
from loginSystem.views import loadLoginPage
|
|
||||||
from plogical.backupManager import BackupManager
|
from django.shortcuts import redirect
|
||||||
|
|
||||||
|
from backup.backupManager import BackupManager
|
||||||
from backup.pluginManager import pluginManager
|
from backup.pluginManager import pluginManager
|
||||||
|
from loginSystem.views import loadLoginPage
|
||||||
|
|
||||||
|
|
||||||
def loadBackupHome(request):
|
def loadBackupHome(request):
|
||||||
|
|||||||
@@ -1,30 +1,33 @@
|
|||||||
from loginSystem.models import Administrator
|
|
||||||
from django.shortcuts import HttpResponse
|
|
||||||
import json
|
import json
|
||||||
from plogical.website import WebsiteManager
|
import os
|
||||||
from plogical.acl import ACLManager
|
import shlex
|
||||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
import subprocess
|
||||||
from websiteFunctions.models import Websites
|
from random import randint
|
||||||
import subprocess, shlex
|
|
||||||
|
from django.shortcuts import HttpResponse
|
||||||
|
|
||||||
|
import userManagment.views as um
|
||||||
|
from backup.backupManager import BackupManager
|
||||||
from databases.databaseManager import DatabaseManager
|
from databases.databaseManager import DatabaseManager
|
||||||
from dns.dnsManager import DNSManager
|
from dns.dnsManager import DNSManager
|
||||||
from mailServer.mailserverManager import MailServerManager
|
|
||||||
from ftp.ftpManager import FTPManager
|
|
||||||
from manageSSL.views import issueSSL, obtainHostNameSSL, obtainMailServerSSL
|
|
||||||
from plogical.backupManager import BackupManager
|
|
||||||
import userManagment.views as um
|
|
||||||
from packages.packagesManager import PackagesManager
|
|
||||||
from plogical.processUtilities import ProcessUtilities
|
|
||||||
from firewall.firewallManager import FirewallManager
|
from firewall.firewallManager import FirewallManager
|
||||||
from serverLogs.views import getLogsFromFile
|
from ftp.ftpManager import FTPManager
|
||||||
from random import randint
|
|
||||||
from highAvailability.haManager import HAManager
|
from highAvailability.haManager import HAManager
|
||||||
|
from loginSystem.models import Administrator
|
||||||
|
from mailServer.mailserverManager import MailServerManager
|
||||||
|
from manageSSL.views import issueSSL, obtainHostNameSSL, obtainMailServerSSL
|
||||||
|
from packages.packagesManager import PackagesManager
|
||||||
|
from plogical.acl import ACLManager
|
||||||
from plogical.httpProc import httpProc
|
from plogical.httpProc import httpProc
|
||||||
from s3Backups.s3Backups import S3Backups
|
|
||||||
import os
|
|
||||||
from serverStatus.views import topProcessesStatus, killProcess
|
|
||||||
from plogical.mysqlUtilities import mysqlUtilities
|
from plogical.mysqlUtilities import mysqlUtilities
|
||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.processUtilities import ProcessUtilities
|
||||||
|
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||||
|
from plogical.website import WebsiteManager
|
||||||
|
from s3Backups.s3Backups import S3Backups
|
||||||
|
from serverLogs.views import getLogsFromFile
|
||||||
|
from serverStatus.views import topProcessesStatus, killProcess
|
||||||
|
from websiteFunctions.models import Websites
|
||||||
|
|
||||||
|
|
||||||
class CloudManager:
|
class CloudManager:
|
||||||
def __init__(self, data=None, admin = None):
|
def __init__(self, data=None, admin = None):
|
||||||
|
|||||||
@@ -230,6 +230,7 @@ class backupUtilities:
|
|||||||
## Saving original vhost conf file
|
## Saving original vhost conf file
|
||||||
|
|
||||||
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + domainName + '/vhost.conf'
|
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + domainName + '/vhost.conf'
|
||||||
|
|
||||||
if os.path.exists(backupUtilities.licenseKey):
|
if os.path.exists(backupUtilities.licenseKey):
|
||||||
copy(completPathToConf, tempStoragePath + '/vhost.conf')
|
copy(completPathToConf, tempStoragePath + '/vhost.conf')
|
||||||
|
|
||||||
@@ -243,7 +244,12 @@ class backupUtilities:
|
|||||||
sslStoragePath = '/etc/letsencrypt/live/' + domainName
|
sslStoragePath = '/etc/letsencrypt/live/' + domainName
|
||||||
|
|
||||||
if os.path.exists(sslStoragePath):
|
if os.path.exists(sslStoragePath):
|
||||||
make_archive(os.path.join(tempStoragePath, "sslData-" + domainName), 'gztar', sslStoragePath)
|
try:
|
||||||
|
copy(os.path.join(sslStoragePath, "cert.pem"), os.path.join(tempStoragePath, domainName + ".cert.pem"))
|
||||||
|
copy(os.path.join(sslStoragePath, "fullchain.pem"), os.path.join(tempStoragePath, domainName + ".fullchain.pem"))
|
||||||
|
copy(os.path.join(sslStoragePath, "privkey.pem"), os.path.join(tempStoragePath, domainName + ".privkey.pem"))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
## backup email accounts
|
## backup email accounts
|
||||||
|
|
||||||
@@ -281,10 +287,23 @@ class backupUtilities:
|
|||||||
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + actualChildDomain + '/vhost.conf'
|
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + actualChildDomain + '/vhost.conf'
|
||||||
copy(completPathToConf, tempStoragePath + '/' + actualChildDomain + '.vhost.conf')
|
copy(completPathToConf, tempStoragePath + '/' + actualChildDomain + '.vhost.conf')
|
||||||
|
|
||||||
|
### Storing SSL for child domainsa
|
||||||
|
|
||||||
sslStoragePath = '/etc/letsencrypt/live/' + actualChildDomain
|
sslStoragePath = '/etc/letsencrypt/live/' + actualChildDomain
|
||||||
|
|
||||||
if os.path.exists(sslStoragePath):
|
if os.path.exists(sslStoragePath):
|
||||||
make_archive(os.path.join(tempStoragePath, "sslData-" + actualChildDomain), 'gztar', sslStoragePath)
|
try:
|
||||||
|
copy(os.path.join(sslStoragePath, "cert.pem"),
|
||||||
|
os.path.join(tempStoragePath, actualChildDomain + ".cert.pem"))
|
||||||
|
copy(os.path.join(sslStoragePath, "fullchain.pem"),
|
||||||
|
os.path.join(tempStoragePath, actualChildDomain + ".fullchain.pem"))
|
||||||
|
copy(os.path.join(sslStoragePath, "privkey.pem"),
|
||||||
|
os.path.join(tempStoragePath, actualChildDomain + ".privkey.pem"))
|
||||||
|
make_archive(os.path.join(tempStoragePath, "sslData-" + domainName), 'gztar',
|
||||||
|
sslStoragePath)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
||||||
|
|
||||||
@@ -295,10 +314,8 @@ class backupUtilities:
|
|||||||
make_archive(os.path.join(backupPath,backupName), 'gztar', tempStoragePath)
|
make_archive(os.path.join(backupPath,backupName), 'gztar', tempStoragePath)
|
||||||
rmtree(tempStoragePath)
|
rmtree(tempStoragePath)
|
||||||
|
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(status, "Completed\n")
|
logging.CyberCPLogFileWriter.statusWriter(status, "Completed\n")
|
||||||
|
|
||||||
|
|
||||||
except BaseException,msg:
|
except BaseException,msg:
|
||||||
try:
|
try:
|
||||||
os.remove(os.path.join(backupPath,backupName+".tar.gz"))
|
os.remove(os.path.join(backupPath,backupName+".tar.gz"))
|
||||||
@@ -464,14 +481,22 @@ class backupUtilities:
|
|||||||
if result[0] == 1:
|
if result[0] == 1:
|
||||||
## Let us try to restore SSL.
|
## Let us try to restore SSL.
|
||||||
|
|
||||||
sslStoragePath = completPath + "/sslData-" + masterDomain + '.tar.gz'
|
sslStoragePath = completPath + "/" + masterDomain + ".cert.pem"
|
||||||
|
|
||||||
if os.path.exists(sslStoragePath):
|
if os.path.exists(sslStoragePath):
|
||||||
sslHome = '/etc/letsencrypt/live/' + masterDomain
|
sslHome = '/etc/letsencrypt/live/' + masterDomain
|
||||||
tar = tarfile.open(sslStoragePath)
|
|
||||||
tar.extractall(sslHome)
|
try:
|
||||||
tar.close()
|
if not os.path.exists(sslHome):
|
||||||
|
os.mkdir(sslHome)
|
||||||
|
|
||||||
|
copy(completPath + "/" + masterDomain + ".cert.pem", sslHome + "/cert.pem")
|
||||||
|
copy(completPath + "/" + masterDomain + ".privkey.pem", sslHome + "/privkey.pem")
|
||||||
|
copy(completPath + "/" + masterDomain + ".fullchain.pem", sslHome + "/fullchain.pem")
|
||||||
|
|
||||||
sslUtilities.installSSLForDomain(masterDomain)
|
sslUtilities.installSSLForDomain(masterDomain)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.CyberCPLogFileWriter.statusWriter(status, "Error Message: " + result[1] + ". Not able to create Account, Databases and DNS Records, aborting. [5009]")
|
logging.CyberCPLogFileWriter.statusWriter(status, "Error Message: " + result[1] + ". Not able to create Account, Databases and DNS Records, aborting. [5009]")
|
||||||
@@ -512,14 +537,23 @@ class backupUtilities:
|
|||||||
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + domain + '/vhost.conf'
|
completPathToConf = virtualHostUtilities.Server_root + '/conf/vhosts/' + domain + '/vhost.conf'
|
||||||
copy(completPath + '/' + domain + '.vhost.conf', completPathToConf)
|
copy(completPath + '/' + domain + '.vhost.conf', completPathToConf)
|
||||||
|
|
||||||
sslStoragePath = completPath + "/sslData-" + domain + '.tar.gz'
|
sslStoragePath = completPath + "/" + domain + ".cert.pem"
|
||||||
|
|
||||||
if os.path.exists(sslStoragePath):
|
if os.path.exists(sslStoragePath):
|
||||||
sslHome = '/etc/letsencrypt/live/' + domain
|
sslHome = '/etc/letsencrypt/live/' + domain
|
||||||
tar = tarfile.open(sslStoragePath)
|
|
||||||
tar.extractall(sslHome)
|
try:
|
||||||
tar.close()
|
if not os.path.exists(sslHome):
|
||||||
|
os.mkdir(sslHome)
|
||||||
|
|
||||||
|
copy(completPath + "/" + domain + ".cert.pem", sslHome + "/cert.pem")
|
||||||
|
copy(completPath + "/" + domain + ".privkey.pem", sslHome + "/privkey.pem")
|
||||||
|
copy(completPath + "/" + domain + ".fullchain.pem",
|
||||||
|
sslHome + "/fullchain.pem")
|
||||||
|
|
||||||
sslUtilities.installSSLForDomain(domain)
|
sslUtilities.installSSLForDomain(domain)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
except:
|
except:
|
||||||
logging.CyberCPLogFileWriter.writeToFile('While restoring backup we had minor issues for rebuilding vhost conf for: ' + domain + '. However this will be auto healed.')
|
logging.CyberCPLogFileWriter.writeToFile('While restoring backup we had minor issues for rebuilding vhost conf for: ' + domain + '. However this will be auto healed.')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user