Version Description
- S3 prefix addon for defining folders
- S3 custom endpoint addon to support minio.io
- code fixes
Download this release
Release Info
Developer | xcloner |
Plugin | XCloner – Backup and Restore |
Version | 4.0.6 |
Comparing to | |
See all releases |
Code changes from version 4.0.5 to 4.0.6
- README.txt +5 -0
- admin/partials/xcloner_remote_storage_page.php +46 -11
- includes/class-xcloner-remote-storage.php +25 -11
- includes/class-xcloner-scheduler.php +8 -7
- xcloner.php +1 -1
README.txt
CHANGED
@@ -108,6 +108,11 @@ Of course, schedules can be adjusted accordingly to how often you update your si
|
|
108 |
|
109 |
== Changelog ==
|
110 |
|
|
|
|
|
|
|
|
|
|
|
111 |
= 4.0.5 =
|
112 |
* Dropbox API update to V2
|
113 |
* Code fixes and text changes
|
108 |
|
109 |
== Changelog ==
|
110 |
|
111 |
+
= 4.0.6 =
|
112 |
+
* S3 prefix addon for defining folders
|
113 |
+
* S3 custom endpoint addon to support minio.io
|
114 |
+
* code fixes
|
115 |
+
|
116 |
= 4.0.5 =
|
117 |
* Dropbox API update to V2
|
118 |
* Code fixes and text changes
|
admin/partials/xcloner_remote_storage_page.php
CHANGED
@@ -230,7 +230,7 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
230 |
<!-- AWS STORAGE-->
|
231 |
<li id="aws">
|
232 |
<div class="collapsible-header">
|
233 |
-
<i class="material-icons">computer</i><?php echo __("
|
234 |
<div class="switch right">
|
235 |
<label>
|
236 |
Off
|
@@ -248,36 +248,36 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
248 |
</div>
|
249 |
<div class=" col s12 m6">
|
250 |
<p>
|
251 |
-
<?php echo sprintf(__('Visit %s and get your "Key" and "Secret
|
252 |
</p>
|
253 |
</div>
|
254 |
</div>
|
255 |
|
256 |
<div class="row">
|
257 |
<div class="col s12 m3 label">
|
258 |
-
<label for="aws_key"><?php echo __("
|
259 |
</div>
|
260 |
<div class=" col s12 m6">
|
261 |
-
<input placeholder="<?php echo __("
|
262 |
</div>
|
263 |
</div>
|
264 |
|
265 |
<div class="row">
|
266 |
<div class="col s12 m3 label">
|
267 |
-
<label for="aws_secret"><?php echo __("
|
268 |
</div>
|
269 |
<div class=" col s12 m6">
|
270 |
-
<input placeholder="<?php echo __("
|
271 |
</div>
|
272 |
</div>
|
273 |
|
274 |
<div class="row">
|
275 |
<div class="col s12 m3 label">
|
276 |
-
<label for="aws_region"><?php echo __("
|
277 |
</div>
|
278 |
<div class=" col s12 m6">
|
279 |
<select placeholder="<?php echo __("example: us-east-1",'xcloner-backup-and-restore')?>" id="aws_region" type="text" name="xcloner_aws_region" class="validate" value="<?php echo get_option("xcloner_aws_region")?>" autocomplete="off" >
|
280 |
-
<option readonly value=""><?php echo __("Please Select AWS Region")?></option>
|
281 |
<?php
|
282 |
$aws_regions = $remote_storage->get_aws_regions();
|
283 |
|
@@ -293,16 +293,34 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
293 |
|
294 |
<div class="row">
|
295 |
<div class="col s12 m3 label">
|
296 |
-
<label for="
|
297 |
</div>
|
298 |
<div class=" col s12 m6">
|
299 |
-
<input placeholder="<?php echo __("AWS
|
300 |
</div>
|
301 |
</div>
|
302 |
|
303 |
<div class="row">
|
304 |
<div class="col s12 m3 label">
|
305 |
-
<label for="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
</div>
|
307 |
<div class=" col s12 m6">
|
308 |
<input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="aws_cleanup_days" type="text" name="xcloner_aws_cleanup_days" class="validate" value="<?php echo get_option("xcloner_aws_cleanup_days")?>">
|
@@ -783,9 +801,24 @@ $gdrive_construct = $remote_storage->gdrive_construct();
|
|
783 |
</form>
|
784 |
|
785 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
786 |
jQuery(document).ready(function(){
|
787 |
|
788 |
var remote_storage = new Xcloner_Remote_Storage();
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
|
790 |
jQuery(".remote-storage .status").on("change", function(){
|
791 |
remote_storage.toggle_status(this);
|
@@ -812,6 +845,8 @@ jQuery(document).ready(function(){
|
|
812 |
jQuery('.collapsible').collapsible();
|
813 |
|
814 |
Materialize.updateTextFields();
|
|
|
|
|
815 |
});
|
816 |
|
817 |
</script>
|
230 |
<!-- AWS STORAGE-->
|
231 |
<li id="aws">
|
232 |
<div class="collapsible-header">
|
233 |
+
<i class="material-icons">computer</i><?php echo __("S3 Storage",'xcloner-backup-and-restore')?>
|
234 |
<div class="switch right">
|
235 |
<label>
|
236 |
Off
|
248 |
</div>
|
249 |
<div class=" col s12 m6">
|
250 |
<p>
|
251 |
+
<?php echo sprintf(__('Visit %s and get your "Key" and "Secret <br />Visit %s to install your own S3 like service.'), "<a href='https://aws.amazon.com/s3/' target='_blank'>https://aws.amazon.com/s3/</a>", "<a href='https://minio.io/' target='_blank'>https://minio.io/</a>")?>
|
252 |
</p>
|
253 |
</div>
|
254 |
</div>
|
255 |
|
256 |
<div class="row">
|
257 |
<div class="col s12 m3 label">
|
258 |
+
<label for="aws_key"><?php echo __("S3 Key",'xcloner-backup-and-restore')?></label>
|
259 |
</div>
|
260 |
<div class=" col s12 m6">
|
261 |
+
<input placeholder="<?php echo __("S3 Key",'xcloner-backup-and-restore')?>" id="aws_key" type="text" name="xcloner_aws_key" class="validate" value="<?php echo get_option("xcloner_aws_key")?>" autocomplete="off" >
|
262 |
</div>
|
263 |
</div>
|
264 |
|
265 |
<div class="row">
|
266 |
<div class="col s12 m3 label">
|
267 |
+
<label for="aws_secret"><?php echo __("S3 Secret",'xcloner-backup-and-restore')?></label>
|
268 |
</div>
|
269 |
<div class=" col s12 m6">
|
270 |
+
<input placeholder="<?php echo __("S3 Secret",'xcloner-backup-and-restore')?>" id="aws_secret" type="text" name="xcloner_aws_secret" class="validate" value="<?php echo get_option("xcloner_aws_secret")?>" autocomplete="off" >
|
271 |
</div>
|
272 |
</div>
|
273 |
|
274 |
<div class="row">
|
275 |
<div class="col s12 m3 label">
|
276 |
+
<label for="aws_region"><?php echo __("S3 Region",'xcloner-backup-and-restore')?></label>
|
277 |
</div>
|
278 |
<div class=" col s12 m6">
|
279 |
<select placeholder="<?php echo __("example: us-east-1",'xcloner-backup-and-restore')?>" id="aws_region" type="text" name="xcloner_aws_region" class="validate" value="<?php echo get_option("xcloner_aws_region")?>" autocomplete="off" >
|
280 |
+
<option readonly value=""><?php echo __("Please Select AWS S3 Region or Leave Unselected for Custom Endpoint")?></option>
|
281 |
<?php
|
282 |
$aws_regions = $remote_storage->get_aws_regions();
|
283 |
|
293 |
|
294 |
<div class="row">
|
295 |
<div class="col s12 m3 label">
|
296 |
+
<label for="aws_endpoint"><?php echo __("S3 EndPoint",'xcloner-backup-and-restore')?></label>
|
297 |
</div>
|
298 |
<div class=" col s12 m6">
|
299 |
+
<input placeholder="<?php echo __("S3 EndPoint, leave blank if you want to use the default Amazon AWS Service",'xcloner-backup-and-restore')?>" id="aws_endpoint" type="text" name="xcloner_aws_endpoint" class="validate" value="<?php echo get_option("xcloner_aws_endpoint")?>" autocomplete="off" >
|
300 |
</div>
|
301 |
</div>
|
302 |
|
303 |
<div class="row">
|
304 |
<div class="col s12 m3 label">
|
305 |
+
<label for="aws_bucket_name"><?php echo __("S3 Bucket Name",'xcloner-backup-and-restore')?></label>
|
306 |
+
</div>
|
307 |
+
<div class=" col s12 m6">
|
308 |
+
<input placeholder="<?php echo __("S3 Bucket Name",'xcloner-backup-and-restore')?>" id="aws_bucket_name" type="text" name="xcloner_aws_bucket_name" class="validate" value="<?php echo get_option("xcloner_aws_bucket_name")?>" autocomplete="off" >
|
309 |
+
</div>
|
310 |
+
</div>
|
311 |
+
|
312 |
+
<div class="row">
|
313 |
+
<div class="col s12 m3 label">
|
314 |
+
<label for="aws_prefix"><?php echo __("S3 Prefix",'xcloner-backup-and-restore')?></label>
|
315 |
+
</div>
|
316 |
+
<div class=" col s12 m6">
|
317 |
+
<input placeholder="<?php echo __("S3 Prefix, use / ending to define a folder",'xcloner-backup-and-restore')?>" id="aws_prefix" type="text" name="xcloner_aws_prefix" class="validate" value="<?php echo get_option("xcloner_aws_prefix")?>" autocomplete="off" >
|
318 |
+
</div>
|
319 |
+
</div>
|
320 |
+
|
321 |
+
<div class="row">
|
322 |
+
<div class="col s12 m3 label">
|
323 |
+
<label for="aws_cleanup_days"><?php echo __("S3 Cleanup (days)",'xcloner-backup-and-restore')?></label>
|
324 |
</div>
|
325 |
<div class=" col s12 m6">
|
326 |
<input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="aws_cleanup_days" type="text" name="xcloner_aws_cleanup_days" class="validate" value="<?php echo get_option("xcloner_aws_cleanup_days")?>">
|
801 |
</form>
|
802 |
|
803 |
<script>
|
804 |
+
|
805 |
+
function checkEndpoint(){
|
806 |
+
if(jQuery("#aws_region").val() != ""){
|
807 |
+
jQuery('#aws_endpoint').parent().parent().hide();
|
808 |
+
}else{
|
809 |
+
jQuery('#aws_endpoint').parent().parent().show();
|
810 |
+
}
|
811 |
+
}
|
812 |
+
|
813 |
jQuery(document).ready(function(){
|
814 |
|
815 |
var remote_storage = new Xcloner_Remote_Storage();
|
816 |
+
|
817 |
+
checkEndpoint()
|
818 |
+
jQuery("#aws_region").on("change", function(){
|
819 |
+
checkEndpoint();
|
820 |
+
|
821 |
+
})
|
822 |
|
823 |
jQuery(".remote-storage .status").on("change", function(){
|
824 |
remote_storage.toggle_status(this);
|
845 |
jQuery('.collapsible').collapsible();
|
846 |
|
847 |
Materialize.updateTextFields();
|
848 |
+
|
849 |
+
|
850 |
});
|
851 |
|
852 |
</script>
|
includes/class-xcloner-remote-storage.php
CHANGED
@@ -55,12 +55,14 @@ class Xcloner_Remote_Storage{
|
|
55 |
"sftp_cleanup_days" => "float",
|
56 |
),
|
57 |
"aws" => array(
|
58 |
-
"text" => "
|
59 |
"aws_enable" => "int",
|
60 |
"aws_key" => "string",
|
61 |
"aws_secret" => "string",
|
|
|
62 |
"aws_region" => "string",
|
63 |
"aws_bucket_name" => "string",
|
|
|
64 |
"aws_cleanup_days" => "float",
|
65 |
),
|
66 |
"dropbox" => array(
|
@@ -184,7 +186,7 @@ class Xcloner_Remote_Storage{
|
|
184 |
update_option($check_field, $sanitized_value);
|
185 |
}
|
186 |
|
187 |
-
$this->xcloner->trigger_message(__("%s storage settings saved.", 'xcloner-backup-and-restore'), "success",
|
188 |
}
|
189 |
|
190 |
}
|
@@ -193,10 +195,10 @@ class Xcloner_Remote_Storage{
|
|
193 |
{
|
194 |
try{
|
195 |
$this->verify_filesystem($action);
|
196 |
-
$this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success",
|
197 |
$this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action)));
|
198 |
}catch(Exception $e){
|
199 |
-
$this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error",
|
200 |
}
|
201 |
}
|
202 |
|
@@ -424,11 +426,11 @@ class Xcloner_Remote_Storage{
|
|
424 |
|
425 |
public function get_aws_filesystem()
|
426 |
{
|
427 |
-
$this->logger->info(sprintf("Creating the
|
428 |
|
429 |
if (version_compare(phpversion(), '5.5.0', '<'))
|
430 |
{
|
431 |
-
throw new Exception("
|
432 |
}
|
433 |
|
434 |
if (!class_exists('XmlWriter'))
|
@@ -437,16 +439,28 @@ class Xcloner_Remote_Storage{
|
|
437 |
}
|
438 |
|
439 |
|
440 |
-
$
|
441 |
-
'credentials' =>
|
442 |
'key' => get_option("xcloner_aws_key"),
|
443 |
'secret' => get_option("xcloner_aws_secret")
|
444 |
-
|
445 |
'region' => get_option("xcloner_aws_region"),
|
446 |
'version' => 'latest',
|
447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
|
449 |
-
$adapter = new AwsS3Adapter($client, get_option("xcloner_aws_bucket_name"));
|
450 |
$filesystem = new Filesystem($adapter, new Config([
|
451 |
'disable_asserts' => true,
|
452 |
]));
|
55 |
"sftp_cleanup_days" => "float",
|
56 |
),
|
57 |
"aws" => array(
|
58 |
+
"text" => "S3",
|
59 |
"aws_enable" => "int",
|
60 |
"aws_key" => "string",
|
61 |
"aws_secret" => "string",
|
62 |
+
"aws_endpoint" => "string",
|
63 |
"aws_region" => "string",
|
64 |
"aws_bucket_name" => "string",
|
65 |
+
"aws_prefix" => "string",
|
66 |
"aws_cleanup_days" => "float",
|
67 |
),
|
68 |
"dropbox" => array(
|
186 |
update_option($check_field, $sanitized_value);
|
187 |
}
|
188 |
|
189 |
+
$this->xcloner->trigger_message(__("%s storage settings saved.", 'xcloner-backup-and-restore'), "success", $this->storage_fields[$action]['text']);
|
190 |
}
|
191 |
|
192 |
}
|
195 |
{
|
196 |
try{
|
197 |
$this->verify_filesystem($action);
|
198 |
+
$this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success", $this->storage_fields[$action]['text']);
|
199 |
$this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action)));
|
200 |
}catch(Exception $e){
|
201 |
+
$this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error", $this->storage_fields[$action]['text']);
|
202 |
}
|
203 |
}
|
204 |
|
426 |
|
427 |
public function get_aws_filesystem()
|
428 |
{
|
429 |
+
$this->logger->info(sprintf("Creating the S3 remote storage connection"), array(""));
|
430 |
|
431 |
if (version_compare(phpversion(), '5.5.0', '<'))
|
432 |
{
|
433 |
+
throw new Exception("S3 class requires PHP 5.5 to be installed!");
|
434 |
}
|
435 |
|
436 |
if (!class_exists('XmlWriter'))
|
439 |
}
|
440 |
|
441 |
|
442 |
+
$credentials = array(
|
443 |
+
'credentials' => array(
|
444 |
'key' => get_option("xcloner_aws_key"),
|
445 |
'secret' => get_option("xcloner_aws_secret")
|
446 |
+
),
|
447 |
'region' => get_option("xcloner_aws_region"),
|
448 |
'version' => 'latest',
|
449 |
+
);
|
450 |
+
|
451 |
+
if(get_option('xcloner_aws_endpoint') != "" && !get_option("xcloner_aws_region")){
|
452 |
+
|
453 |
+
$credentials['endpoint'] = get_option('xcloner_aws_endpoint');
|
454 |
+
#$credentials['use_path_style_endpoint'] = true;
|
455 |
+
#$credentials['bucket_endpoint'] = false;
|
456 |
+
|
457 |
+
|
458 |
+
}
|
459 |
+
|
460 |
+
|
461 |
+
$client = new S3Client($credentials);
|
462 |
|
463 |
+
$adapter = new AwsS3Adapter($client, get_option("xcloner_aws_bucket_name"), get_option("xcloner_aws_prefix"));
|
464 |
$filesystem = new Filesystem($adapter, new Config([
|
465 |
'disable_asserts' => true,
|
466 |
]));
|
includes/class-xcloner-scheduler.php
CHANGED
@@ -324,19 +324,20 @@ class Xcloner_Scheduler{
|
|
324 |
|
325 |
$this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $schedule, "", $additional);
|
326 |
|
327 |
-
//CHECK IF WE SHOULD DELETE BACKUP AFTER REMOTE TRANSFER IS DONE
|
328 |
-
if($schedule['remote_storage'] && $this->xcloner_settings->get_xcloner_option('xcloner_cleanup_delete_after_remote_transfer'))
|
329 |
-
{
|
330 |
-
$this->logger->info(sprintf("Deleting %s from local storage matching rule xcloner_cleanup_delete_after_remote_transfer",$return['extra']['backup_parent']));
|
331 |
-
$this->xcloner_file_system->delete_backup_by_name($return['extra']['backup_parent']);
|
332 |
-
|
333 |
-
}
|
334 |
}catch(Exception $e)
|
335 |
{
|
336 |
$this->logger->error($e->getMessage());
|
337 |
}
|
338 |
}
|
339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
$this->xcloner_file_system->remove_tmp_filesystem();
|
341 |
|
342 |
$this->xcloner_file_system->backup_storage_cleanup();
|
324 |
|
325 |
$this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $schedule, "", $additional);
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
}catch(Exception $e)
|
328 |
{
|
329 |
$this->logger->error($e->getMessage());
|
330 |
}
|
331 |
}
|
332 |
|
333 |
+
//CHECK IF WE SHOULD DELETE BACKUP AFTER REMOTE TRANSFER IS DONE
|
334 |
+
if($schedule['remote_storage'] && $this->xcloner_settings->get_xcloner_option('xcloner_cleanup_delete_after_remote_transfer'))
|
335 |
+
{
|
336 |
+
$this->logger->info(sprintf("Deleting %s from local storage matching rule xcloner_cleanup_delete_after_remote_transfer",$return['extra']['backup_parent']));
|
337 |
+
$this->xcloner_file_system->delete_backup_by_name($return['extra']['backup_parent']);
|
338 |
+
|
339 |
+
}
|
340 |
+
|
341 |
$this->xcloner_file_system->remove_tmp_filesystem();
|
342 |
|
343 |
$this->xcloner_file_system->backup_storage_cleanup();
|
xcloner.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Plugin Name: XCloner - Site Backup and Restore
|
16 |
* Plugin URI: http://www.xcloner.com
|
17 |
* Description: XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV, Backblaze, Azure accounts.
|
18 |
-
* Version: 4.0.
|
19 |
* Author: Liuta Ovidiu
|
20 |
* Author URI: http://www.thinkovi.com
|
21 |
* License: GPL-2.0+
|
15 |
* Plugin Name: XCloner - Site Backup and Restore
|
16 |
* Plugin URI: http://www.xcloner.com
|
17 |
* Description: XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV, Backblaze, Azure accounts.
|
18 |
+
* Version: 4.0.6
|
19 |
* Author: Liuta Ovidiu
|
20 |
* Author URI: http://www.thinkovi.com
|
21 |
* License: GPL-2.0+
|