mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-03-06 12:20:45 +01:00
work on restore function
This commit is contained in:
@@ -1293,7 +1293,8 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compil
|
||||
var url = "/IncrementalBackups/RestorePathV2";
|
||||
var data = {
|
||||
snapshotid: SnapshotId,
|
||||
path: Path
|
||||
path: Path,
|
||||
selwebsite: $scope.selwebsite
|
||||
}
|
||||
|
||||
var config = {
|
||||
|
||||
@@ -842,6 +842,30 @@ def RestorePathV2(request):
|
||||
data = json.loads(request.body)
|
||||
SnapShotId = data['snapshotid']
|
||||
Path = data['path']
|
||||
Selectedwebsite = data['selwebsite']
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if ACLManager.checkOwnership(str(Selectedwebsite), admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
# f'rustic -r testremote snapshots --password "" --json 2>/dev/null'
|
||||
# final_json = json.dumps({'status': 0, 'fetchStatus': 1, 'error_message': Selectedrepo })
|
||||
# return HttpResponse(final_json)
|
||||
|
||||
vm = CPBackupsV2({'domain': Selectedwebsite, 'BackendName': Selectedrepo, "function": ""})
|
||||
status, data = vm.FetchSnapShots()
|
||||
|
||||
if status == 1:
|
||||
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": data})
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
# final_json = json.dumps({'status': 0, 'fetchStatus': 1, 'error_message': ac,})
|
||||
final_json = json.dumps({'status': 0, 'fetchStatus': 1, 'error_message': 'Cannot Find!', })
|
||||
return HttpResponse(final_json)
|
||||
|
||||
final_dic = {'status': 1, 'SnapShotId': SnapShotId, 'Path': Path}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
||||
@@ -57,7 +57,6 @@ class CPBackupsV2(multi.Thread):
|
||||
|
||||
self.snapshots = []
|
||||
|
||||
|
||||
##
|
||||
|
||||
self.StatusFile = f'/home/cyberpanel/{self.website.domain}_rustic_backup_log'
|
||||
@@ -1000,5 +999,5 @@ if __name__ == "__main__":
|
||||
#cpbuv2.BackupDataBases()
|
||||
|
||||
except:
|
||||
cpbuv2 = CPBackupsV2({'domain': 'cyberpanel.net', 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1, 'BackupEmails': 1} )
|
||||
cpbuv2.InitiateBackup()
|
||||
cpbuv2 = CPBackupsV2({'function':'InitiateRestore', 'domain': 'cyberpanel.net', 'BasePath': '/home/backup', 'SnapShotID': 1, 'BackendName': 'usman'} )
|
||||
cpbuv2.InitiateRestore()
|
||||
Reference in New Issue
Block a user