|
@@ 779-812 (lines=34) @@
|
| 776 |
|
$this->send_response($return, 0); |
| 777 |
|
} |
| 778 |
|
|
| 779 |
|
public function copy_backup_remote_to_local() |
| 780 |
|
{ |
| 781 |
|
|
| 782 |
|
$this->check_access(); |
| 783 |
|
|
| 784 |
|
$backup_file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']); |
| 785 |
|
$storage_type = $this->xcloner_sanitization->sanitize_input_as_string($_POST['storage_type']); |
| 786 |
|
|
| 787 |
|
$xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
| 788 |
|
|
| 789 |
|
$return = array(); |
| 790 |
|
|
| 791 |
|
try |
| 792 |
|
{ |
| 793 |
|
if(method_exists($xcloner_remote_storage, "copy_backup_remote_to_local")) |
| 794 |
|
{ |
| 795 |
|
$return = call_user_func_array(array($xcloner_remote_storage, "copy_backup_remote_to_local"), array($backup_file, $storage_type)); |
| 796 |
|
} |
| 797 |
|
}catch(Exception $e){ |
| 798 |
|
|
| 799 |
|
$return['error'] = 1; |
| 800 |
|
$return['message'] = $e->getMessage(); |
| 801 |
|
} |
| 802 |
|
|
| 803 |
|
if(!$return) |
| 804 |
|
{ |
| 805 |
|
$return['error'] = 1; |
| 806 |
|
$return['message'] = "Upload failed, please check the error log for more information!"; |
| 807 |
|
} |
| 808 |
|
|
| 809 |
|
|
| 810 |
|
$this->send_response($return, 0); |
| 811 |
|
|
| 812 |
|
} |
| 813 |
|
|
| 814 |
|
/* |
| 815 |
|
* |
|
@@ 819-851 (lines=33) @@
|
| 816 |
|
* Upload backup to remote API |
| 817 |
|
* |
| 818 |
|
*/ |
| 819 |
|
public function upload_backup_to_remote() |
| 820 |
|
{ |
| 821 |
|
$this->check_access(); |
| 822 |
|
|
| 823 |
|
$backup_file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']); |
| 824 |
|
$storage_type = $this->xcloner_sanitization->sanitize_input_as_string($_POST['storage_type']); |
| 825 |
|
|
| 826 |
|
$xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
| 827 |
|
|
| 828 |
|
$return = array(); |
| 829 |
|
|
| 830 |
|
try |
| 831 |
|
{ |
| 832 |
|
if(method_exists($xcloner_remote_storage, "upload_backup_to_storage")) |
| 833 |
|
{ |
| 834 |
|
$return = call_user_func_array(array($xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $storage_type)); |
| 835 |
|
} |
| 836 |
|
}catch(Exception $e){ |
| 837 |
|
|
| 838 |
|
$return['error'] = 1; |
| 839 |
|
$return['message'] = $e->getMessage(); |
| 840 |
|
} |
| 841 |
|
|
| 842 |
|
if(!$return) |
| 843 |
|
{ |
| 844 |
|
$return['error'] = 1; |
| 845 |
|
$return['message'] = "Upload failed, please check the error log for more information!"; |
| 846 |
|
} |
| 847 |
|
|
| 848 |
|
|
| 849 |
|
$this->send_response($return, 0); |
| 850 |
|
|
| 851 |
|
} |
| 852 |
|
|
| 853 |
|
/* |
| 854 |
|
* |