@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | try{ |
26 | 26 | $option = Util::normalizePath($path); |
27 | - }catch(Exception $e){ |
|
27 | + } catch(Exception $e){ |
|
28 | 28 | add_settings_error('xcloner_error_message', '', __($e->getMessage()), 'error'); |
29 | 29 | } |
30 | 30 |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | public function transfer_file($file, $start = 0, $hash = "") |
21 | 21 | { |
22 | - if(!$this->target_url) |
|
23 | - throw new Exception("Please setup a target url for upload"); |
|
22 | + if(!$this->target_url) { |
|
23 | + throw new Exception("Please setup a target url for upload"); |
|
24 | + } |
|
24 | 25 | |
25 | 26 | |
26 | 27 | $fp = $this->get_storage_filesystem()->readStream($file); |
@@ -68,8 +69,9 @@ discard block |
||
68 | 69 | |
69 | 70 | $result = json_decode($original_result); |
70 | 71 | |
71 | - if(!$result) |
|
72 | - throw new Exception("We have received no valid response from the remote host, original message: ". $original_result); |
|
72 | + if(!$result) { |
|
73 | + throw new Exception("We have received no valid response from the remote host, original message: ". $original_result); |
|
74 | + } |
|
73 | 75 | |
74 | 76 | if($result->status != 200) |
75 | 77 | { |
@@ -94,7 +96,7 @@ discard block |
||
94 | 96 | . ($postname ?: basename($filename)) |
95 | 97 | . ($mimetype ? ";type=$mimetype" : ''); |
96 | 98 | |
97 | - }else{ |
|
99 | + } else{ |
|
98 | 100 | |
99 | 101 | return curl_file_create($filename, $mimetype, $postname); |
100 | 102 |
@@ -33,7 +33,10 @@ |
||
33 | 33 | <li class="active"> |
34 | 34 | <div class="collapsible-header active"><i class="material-icons">bug_report</i>XCloner Debugger</div> |
35 | 35 | <div class="collapsible-body"> |
36 | - <div class="console" id="xcloner-console"><?php if(isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div> |
|
36 | + <div class="console" id="xcloner-console"><?php if(isset($logger_content)) { |
|
37 | + echo implode("<br />\n", $logger_content); |
|
38 | +} |
|
39 | +?></div> |
|
37 | 40 | </div> |
38 | 41 | </li> |
39 | 42 | </ul> |
@@ -61,8 +61,9 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function enqueue_styles($hook) { |
63 | 63 | |
64 | - if(!stristr($hook, "page_".$this->plugin_name) || (isset($_GET['option']) and $_GET['option']=="com_cloner")) |
|
65 | - return; |
|
64 | + if(!stristr($hook, "page_".$this->plugin_name) || (isset($_GET['option']) and $_GET['option']=="com_cloner")) { |
|
65 | + return; |
|
66 | + } |
|
66 | 67 | |
67 | 68 | /** |
68 | 69 | * This function is provided for demonstration purposes only. |
@@ -93,8 +94,9 @@ discard block |
||
93 | 94 | */ |
94 | 95 | public function enqueue_scripts($hook) { |
95 | 96 | |
96 | - if(!stristr($hook, "page_".$this->plugin_name)) |
|
97 | - return; |
|
97 | + if(!stristr($hook, "page_".$this->plugin_name)) { |
|
98 | + return; |
|
99 | + } |
|
98 | 100 | |
99 | 101 | /** |
100 | 102 | * This function is provided for demonstration purposes only. |
@@ -234,15 +236,15 @@ discard block |
||
234 | 236 | settings_fields('xcloner_general_settings_group'); |
235 | 237 | do_settings_sections('xcloner_settings_page'); |
236 | 238 | |
237 | - }elseif( $active_tab == 'mysql_options' ) { |
|
239 | + } elseif( $active_tab == 'mysql_options' ) { |
|
238 | 240 | |
239 | 241 | settings_fields('xcloner_mysql_settings_group'); |
240 | 242 | do_settings_sections('xcloner_mysql_settings_page'); |
241 | - }elseif( $active_tab == 'system_options' ) { |
|
243 | + } elseif( $active_tab == 'system_options' ) { |
|
242 | 244 | |
243 | 245 | settings_fields('xcloner_system_settings_group'); |
244 | 246 | do_settings_sections('xcloner_system_settings_page'); |
245 | - }elseif( $active_tab == 'cleanup_options' ) { |
|
247 | + } elseif( $active_tab == 'cleanup_options' ) { |
|
246 | 248 | |
247 | 249 | settings_fields('xcloner_cleanup_settings_group'); |
248 | 250 | do_settings_sections('xcloner_cleanup_settings_page'); |
@@ -58,8 +58,9 @@ |
||
58 | 58 | |
59 | 59 | public function xcloner_backup_add_admin_menu() |
60 | 60 | { |
61 | - if ( function_exists('add_menu_page') ) |
|
62 | - add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup'); |
|
61 | + if ( function_exists('add_menu_page') ) { |
|
62 | + add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup'); |
|
63 | + } |
|
63 | 64 | |
64 | 65 | if ( function_exists('add_submenu_page') ) |
65 | 66 | { |
@@ -27,12 +27,16 @@ discard block |
||
27 | 27 | |
28 | 28 | <?php if($storage_selection):?> |
29 | 29 | <option value="" selected><?php echo __('Change To Local Storage...', 'xcloner-backup-and-restore') ?></option> |
30 | - <?php else: ?> |
|
30 | + <?php else { |
|
31 | + : ?> |
|
31 | 32 | <option value="" selected><?php echo __('Change To Remote Storage...', 'xcloner-backup-and-restore') ?></option> |
32 | - <?php endif;?> |
|
33 | + <?php endif; |
|
34 | +} |
|
35 | +?> |
|
33 | 36 | |
34 | 37 | <?php foreach($available_storages as $storage=>$text):?> |
35 | - <option value="<?php echo $storage?>"<?php if($storage == $storage_selection) echo "selected"?>><?php echo $text?></option> |
|
38 | + <option value="<?php echo $storage?>"<?php if($storage == $storage_selection) { |
|
39 | + echo "selected"?>><?php echo $text?></option> |
|
36 | 40 | <?php endforeach?> |
37 | 41 | </select> |
38 | 42 | <?php endif?> |
@@ -60,16 +64,19 @@ discard block |
||
60 | 64 | |
61 | 65 | <?php |
62 | 66 | $i = 0; |
67 | +} |
|
63 | 68 | foreach($backup_list as $file_info):?> |
64 | 69 | <?php |
65 | - if($storage_selection == "gdrive") |
|
66 | - $file_info['path'] = $file_info['filename'].".".$file_info['extension']; |
|
70 | + if($storage_selection == "gdrive") { |
|
71 | + $file_info['path'] = $file_info['filename'].".".$file_info['extension']; |
|
72 | + } |
|
67 | 73 | $file_exists_on_local_storage = true; |
68 | 74 | |
69 | 75 | if($storage_selection) |
70 | 76 | { |
71 | - if(!$xcloner_file_system->get_storage_filesystem()->has($file_info['path'])) |
|
72 | - $file_exists_on_local_storage = false; |
|
77 | + if(!$xcloner_file_system->get_storage_filesystem()->has($file_info['path'])) { |
|
78 | + $file_exists_on_local_storage = false; |
|
79 | + } |
|
73 | 80 | } |
74 | 81 | |
75 | 82 | ?> |
@@ -100,8 +107,9 @@ discard block |
||
100 | 107 | $child_exists_on_local_storage = true; |
101 | 108 | if($storage_selection) |
102 | 109 | { |
103 | - if(!$xcloner_file_system->get_storage_filesystem()->has($child[0])) |
|
104 | - $child_exists_on_local_storage = false; |
|
110 | + if(!$xcloner_file_system->get_storage_filesystem()->has($child[0])) { |
|
111 | + $child_exists_on_local_storage = false; |
|
112 | + } |
|
105 | 113 | } |
106 | 114 | ?> |
107 | 115 | <?php if(!$child_exists_on_local_storage): ?> |
@@ -118,11 +126,14 @@ discard block |
||
118 | 126 | </ul> |
119 | 127 | <?php endif;?> |
120 | 128 | </td> |
121 | - <td><?php if(isset($file_info['timestamp'])) echo date("d M, Y H:i", $file_info['timestamp'])?></td> |
|
129 | + <td><?php if(isset($file_info['timestamp'])) { |
|
130 | + echo date("d M, Y H:i", $file_info['timestamp'])?></td> |
|
122 | 131 | <td><?php echo size_format($file_info['size'])?></td> |
123 | 132 | <td> |
124 | 133 | <?php if(!$storage_selection):?> |
125 | - <a href="#<?php echo $file_info['basename'];?>" class="download" title="<?php echo __('Download Backup','xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
134 | + <a href="#<?php echo $file_info['basename']; |
|
135 | +} |
|
136 | +?>" class="download" title="<?php echo __('Download Backup','xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
126 | 137 | |
127 | 138 | <?php if(sizeof($available_storages)):?> |
128 | 139 | <a href="#<?php echo $file_info['basename']?>" class="cloud-upload" title="<?php echo __('Send Backup To Remote Storage','xcloner-backup-and-restore')?>"><i class="material-icons">cloud_upload</i></a> |
@@ -26,17 +26,22 @@ discard block |
||
26 | 26 | $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_archive"); |
27 | 27 | $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
28 | 28 | |
29 | - if($value = $this->xcloner_settings->get_xcloner_option('xcloner_size_limit_per_request')) |
|
30 | - $this->file_size_per_request_limit = $value*1024*1024; //MB |
|
29 | + if($value = $this->xcloner_settings->get_xcloner_option('xcloner_size_limit_per_request')) { |
|
30 | + $this->file_size_per_request_limit = $value*1024*1024; |
|
31 | + } |
|
32 | + //MB |
|
31 | 33 | |
32 | - if($value = $this->xcloner_settings->get_xcloner_option('xcloner_files_to_process_per_request')) |
|
33 | - $this->files_to_process_per_request = $value; |
|
34 | + if($value = $this->xcloner_settings->get_xcloner_option('xcloner_files_to_process_per_request')) { |
|
35 | + $this->files_to_process_per_request = $value; |
|
36 | + } |
|
34 | 37 | |
35 | - if($value = get_option('xcloner_backup_compression_level')) |
|
36 | - $this->compression_level = $value; |
|
38 | + if($value = get_option('xcloner_backup_compression_level')) { |
|
39 | + $this->compression_level = $value; |
|
40 | + } |
|
37 | 41 | |
38 | - if($value = get_option('xcloner_split_backup_limit')) |
|
39 | - $this->xcloner_split_backup_limit = $value; |
|
42 | + if($value = get_option('xcloner_split_backup_limit')) { |
|
43 | + $this->xcloner_split_backup_limit = $value; |
|
44 | + } |
|
40 | 45 | |
41 | 46 | $this->xcloner_split_backup_limit = $this->xcloner_split_backup_limit * 1024*1024; //transform to bytes |
42 | 47 | |
@@ -73,8 +78,9 @@ discard block |
||
73 | 78 | //$this->archive_name = $this->archive_name."-diff-".date("Y-m-d_H-i",$diff_timestamp_start); |
74 | 79 | $new_name = $this->archive_name; |
75 | 80 | |
76 | - if(!stristr($new_name, "-diff")) |
|
77 | - $new_name = $this->archive_name . "-diff".date("Y-m-d_H-i",$diff_timestamp_start); |
|
81 | + if(!stristr($new_name, "-diff")) { |
|
82 | + $new_name = $this->archive_name . "-diff".date("Y-m-d_H-i",$diff_timestamp_start); |
|
83 | + } |
|
78 | 84 | |
79 | 85 | $this->archive_name = $new_name; |
80 | 86 | |
@@ -83,8 +89,9 @@ discard block |
||
83 | 89 | if(isset($part) and $part) |
84 | 90 | { |
85 | 91 | $new_name = preg_replace('/-part(\d*)/', "-part".$part, $this->archive_name); |
86 | - if(!stristr($new_name, "-part")) |
|
87 | - $new_name = $this->archive_name . "-part".$part; |
|
92 | + if(!stristr($new_name, "-part")) { |
|
93 | + $new_name = $this->archive_name . "-part".$part; |
|
94 | + } |
|
88 | 95 | |
89 | 96 | $this->archive_name = $new_name; |
90 | 97 | } |
@@ -139,8 +146,9 @@ discard block |
||
139 | 146 | |
140 | 147 | $headers = array('Content-Type: text/html; charset=UTF-8'); |
141 | 148 | |
142 | - if($admin_email and $from ) |
|
143 | - $headers[] = 'From: '.$from.' <'.$admin_email.'>'; |
|
149 | + if($admin_email and $from ) { |
|
150 | + $headers[] = 'From: '.$from.' <'.$admin_email.'>'; |
|
151 | + } |
|
144 | 152 | |
145 | 153 | $return = wp_mail( $to, $subject, $body, $headers ); |
146 | 154 | |
@@ -182,8 +190,9 @@ discard block |
||
182 | 190 | |
183 | 191 | $backup_parts = $this->filesystem->get_multipart_files($backup_name); |
184 | 192 | |
185 | - if(!$backups_counter = sizeof($backup_parts)) |
|
186 | - $backups_counter = 1; |
|
193 | + if(!$backups_counter = sizeof($backup_parts)) { |
|
194 | + $backups_counter = 1; |
|
195 | + } |
|
187 | 196 | |
188 | 197 | $body .= sprintf(__("Backup Parts: %s"), $backups_counter); |
189 | 198 | $body .= "<br />"; |
@@ -202,8 +211,9 @@ discard block |
||
202 | 211 | $body .= "<br /><br />"; |
203 | 212 | } |
204 | 213 | |
205 | - if($this->xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
|
206 | - $body .= __("Latest 50 Log Lines: ")."<br />".implode("<br />\n", $this->logger->getLastDebugLines(50)); |
|
214 | + if($this->xcloner_settings->get_xcloner_option('xcloner_enable_log')) { |
|
215 | + $body .= __("Latest 50 Log Lines: ")."<br />".implode("<br />\n", $this->logger->getLastDebugLines(50)); |
|
216 | + } |
|
207 | 217 | |
208 | 218 | $attachments = $this->filesystem->get_backup_attachments(); |
209 | 219 | |
@@ -238,18 +248,21 @@ discard block |
||
238 | 248 | { |
239 | 249 | $return = array(); |
240 | 250 | |
241 | - if(!isset($extra_params['backup_part'])) |
|
242 | - $extra_params['backup_part'] = 0; |
|
251 | + if(!isset($extra_params['backup_part'])) { |
|
252 | + $extra_params['backup_part'] = 0; |
|
253 | + } |
|
243 | 254 | |
244 | 255 | $return['extra']['backup_part'] = $extra_params['backup_part']; |
245 | 256 | |
246 | - if(isset( $extra_params['backup_archive_name'])) |
|
247 | - $this->set_archive_name($extra_params['backup_archive_name'], $return['extra']['backup_part']); |
|
248 | - else |
|
249 | - $this->set_archive_name($backup_params['backup_name']); |
|
257 | + if(isset( $extra_params['backup_archive_name'])) { |
|
258 | + $this->set_archive_name($extra_params['backup_archive_name'], $return['extra']['backup_part']); |
|
259 | + } else { |
|
260 | + $this->set_archive_name($backup_params['backup_name']); |
|
261 | + } |
|
250 | 262 | |
251 | - if(!$this->get_archive_name()) |
|
252 | - $this->set_archive_name(); |
|
263 | + if(!$this->get_archive_name()) { |
|
264 | + $this->set_archive_name(); |
|
265 | + } |
|
253 | 266 | |
254 | 267 | $this->backup_archive = new Tar(); |
255 | 268 | $this->backup_archive->setCompression($this->compression_level); |
@@ -264,7 +277,7 @@ discard block |
||
264 | 277 | |
265 | 278 | $return['extra']['backup_init'] = 1; |
266 | 279 | |
267 | - }else{ |
|
280 | + } else{ |
|
268 | 281 | $this->logger->info(sprintf(__("Opening for append the backup archive %s"), $this->get_archive_name())); |
269 | 282 | |
270 | 283 | $this->backup_archive->openForAppend($archive_info->getPath().DS.$archive_info->getFilename()); |
@@ -276,11 +289,13 @@ discard block |
||
276 | 289 | $return['extra']['backup_archive_name'] = $this->get_archive_name(); |
277 | 290 | $return['extra']['backup_archive_name_full'] = $this->get_archive_name_with_extension(); |
278 | 291 | |
279 | - if(!isset($extra_params['start_at_line'])) |
|
280 | - $extra_params['start_at_line'] = 0; |
|
292 | + if(!isset($extra_params['start_at_line'])) { |
|
293 | + $extra_params['start_at_line'] = 0; |
|
294 | + } |
|
281 | 295 | |
282 | - if(!isset($extra_params['start_at_byte'])) |
|
283 | - $extra_params['start_at_byte'] = 0; |
|
296 | + if(!isset($extra_params['start_at_byte'])) { |
|
297 | + $extra_params['start_at_byte'] = 0; |
|
298 | + } |
|
284 | 299 | |
285 | 300 | if(!$this->filesystem->get_tmp_filesystem()->has($this->filesystem->get_included_files_handler())) |
286 | 301 | { |
@@ -302,7 +317,7 @@ discard block |
||
302 | 317 | if(!$extra_params['start_at_line']) |
303 | 318 | { |
304 | 319 | $file->seek(1); |
305 | - }else{ |
|
320 | + } else{ |
|
306 | 321 | $file->seek($extra_params['start_at_line']+1); |
307 | 322 | } |
308 | 323 | |
@@ -344,8 +359,9 @@ discard block |
||
344 | 359 | |
345 | 360 | $file_info = $this->filesystem->get_filesystem($start_filesystem)->getMetadata($relative_path); |
346 | 361 | |
347 | - if(!isset($file_info['size'])) |
|
348 | - $file_info['size'] = 0; |
|
362 | + if(!isset($file_info['size'])) { |
|
363 | + $file_info['size'] = 0; |
|
364 | + } |
|
349 | 365 | |
350 | 366 | if($start_filesystem == "tmp_filesystem") |
351 | 367 | { |
@@ -356,11 +372,13 @@ discard block |
||
356 | 372 | |
357 | 373 | $append = 0; |
358 | 374 | |
359 | - if($file_info['size'] > $byte_limit*512 or $start_byte) |
|
360 | - $append = 1; |
|
375 | + if($file_info['size'] > $byte_limit*512 or $start_byte) { |
|
376 | + $append = 1; |
|
377 | + } |
|
361 | 378 | |
362 | - if(!isset($return['extra']['backup_size'])) |
|
363 | - $return['extra']['backup_size'] =0; |
|
379 | + if(!isset($return['extra']['backup_size'])) { |
|
380 | + $return['extra']['backup_size'] =0; |
|
381 | + } |
|
364 | 382 | |
365 | 383 | $return['extra']['backup_size'] = $archive_info->getSize(); |
366 | 384 | |
@@ -396,8 +414,7 @@ discard block |
||
396 | 414 | |
397 | 415 | if($last_position>0){ |
398 | 416 | $start_byte = $last_position; |
399 | - } |
|
400 | - else{ |
|
417 | + } else{ |
|
401 | 418 | $extra_params['start_at_line']++; |
402 | 419 | $file->next(); |
403 | 420 | $start_byte = 0; |
@@ -434,8 +451,9 @@ discard block |
||
434 | 451 | $this->logger->info(sprintf("Closing the backup archive %s with 2*512 zero bytes blocks.", $this->get_archive_name_with_extension())); |
435 | 452 | $this->backup_archive->close(); |
436 | 453 | |
437 | - if($return['extra']['backup_part']) |
|
438 | - $this->write_multipart_file($this->get_archive_name_with_extension()); |
|
454 | + if($return['extra']['backup_part']) { |
|
455 | + $this->write_multipart_file($this->get_archive_name_with_extension()); |
|
456 | + } |
|
439 | 457 | |
440 | 458 | $return['extra']['start_at_line'] = $extra_params['start_at_line']-1; |
441 | 459 | |
@@ -487,12 +505,13 @@ discard block |
||
487 | 505 | $this->set_archive_name($this->get_archive_name(), ++$part); |
488 | 506 | $this->rename_archive($old_name, $this->get_archive_name_with_extension()); |
489 | 507 | |
490 | - if($this->filesystem->get_storage_filesystem()->has($this->get_archive_name_multipart())) |
|
491 | - $this->filesystem->get_storage_filesystem()->delete($this->get_archive_name_multipart()); |
|
508 | + if($this->filesystem->get_storage_filesystem()->has($this->get_archive_name_multipart())) { |
|
509 | + $this->filesystem->get_storage_filesystem()->delete($this->get_archive_name_multipart()); |
|
510 | + } |
|
492 | 511 | |
493 | 512 | $this->write_multipart_file($this->get_archive_name_with_extension()); |
494 | 513 | |
495 | - }else |
|
514 | + } else |
|
496 | 515 | { |
497 | 516 | $this->logger->info(sprintf("Creating new multipart info file %s",$this->get_archive_name_with_extension())); |
498 | 517 | $this->write_multipart_file($this->get_archive_name_with_extension()); |
@@ -522,13 +541,15 @@ discard block |
||
522 | 541 | $start_adapter = $this->filesystem->get_adapter($filesystem); |
523 | 542 | $start_filesystem = $this->filesystem->get_adapter($filesystem); |
524 | 543 | |
525 | - if(!$file_info['path']) |
|
526 | - return; |
|
544 | + if(!$file_info['path']) { |
|
545 | + return; |
|
546 | + } |
|
527 | 547 | |
528 | - if(isset($file_info['archive_prefix_path'])) |
|
529 | - $file_info['target_path'] = $file_info['archive_prefix_path']."/".$file_info['path']; |
|
530 | - else |
|
531 | - $file_info['target_path'] = $file_info['path']; |
|
548 | + if(isset($file_info['archive_prefix_path'])) { |
|
549 | + $file_info['target_path'] = $file_info['archive_prefix_path']."/".$file_info['path']; |
|
550 | + } else { |
|
551 | + $file_info['target_path'] = $file_info['path']; |
|
552 | + } |
|
532 | 553 | |
533 | 554 | $last_position = $start_at_byte; |
534 | 555 | |
@@ -538,8 +559,7 @@ discard block |
||
538 | 559 | $bytes_wrote = $file_info['size']; |
539 | 560 | $this->logger->info(sprintf("Adding %s bytes of file %s to archive %s ", $bytes_wrote, $file_info['target_path'], $this->get_archive_name_with_extension())); |
540 | 561 | $this->backup_archive->addFile($start_adapter->applyPathPrefix($file_info['path']), $file_info['target_path']); |
541 | - } |
|
542 | - else{ |
|
562 | + } else{ |
|
543 | 563 | $tmp_file = md5($file_info['path']); |
544 | 564 | |
545 | 565 | //we isolate file to tmp if we are at byte 0, the starting point of file reading |
@@ -548,16 +568,16 @@ discard block |
||
548 | 568 | $this->logger->info(sprintf("Copying %s file to tmp filesystem file %s to prevent reading changes", $file_info['path'], $tmp_file)); |
549 | 569 | $file_stream = $start_filesystem->readStream($file_info['path']); |
550 | 570 | |
551 | - if(is_resource($file_stream['stream'])) |
|
552 | - $this->filesystem->get_tmp_filesystem()->writeStream($tmp_file, $file_stream['stream']); |
|
571 | + if(is_resource($file_stream['stream'])) { |
|
572 | + $this->filesystem->get_tmp_filesystem()->writeStream($tmp_file, $file_stream['stream']); |
|
573 | + } |
|
553 | 574 | } |
554 | 575 | |
555 | 576 | if($this->filesystem->get_tmp_filesystem()->has($tmp_file)) |
556 | 577 | { |
557 | 578 | $is_tmp = 1; |
558 | 579 | $last_position = $this->backup_archive->appendFileData($this->filesystem->get_tmp_filesystem_adapter()->applyPathPrefix($tmp_file), $file_info['target_path'], $start_at_byte, $byte_limit); |
559 | - } |
|
560 | - else{ |
|
580 | + } else{ |
|
561 | 581 | $is_tmp = 0; |
562 | 582 | $last_position = $this->backup_archive->appendFileData($start_adapter->applyPathPrefix($file_info['path']), $file_info['target_path'], $start_at_byte, $byte_limit); |
563 | 583 | } |
@@ -566,8 +586,7 @@ discard block |
||
566 | 586 | if($last_position == -1) |
567 | 587 | { |
568 | 588 | $bytes_wrote = $file_info['size'] - $start_at_byte; |
569 | - } |
|
570 | - else |
|
589 | + } else |
|
571 | 590 | { |
572 | 591 | $bytes_wrote = $last_position - $start_at_byte; |
573 | 592 | } |
@@ -576,8 +595,7 @@ discard block |
||
576 | 595 | if($is_tmp) |
577 | 596 | { |
578 | 597 | $this->logger->info(sprintf("Appended %s bytes, starting position %s, of tmp file %s (%s) to archive %s ", $bytes_wrote, $start_at_byte, $tmp_file, $file_info['target_path'], $this->get_archive_name())); |
579 | - } |
|
580 | - else{ |
|
598 | + } else{ |
|
581 | 599 | $this->logger->info(sprintf("Appended %s bytes, starting position %s, of original file %s to archive %s ", $bytes_wrote, $start_at_byte, $file_info['target_path'], $tmp_file, $this->get_archive_name())); |
582 | 600 | } |
583 | 601 |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | error_reporting(0); |
33 | 33 | } |
34 | 34 | |
35 | - if( ob_get_length() ) |
|
36 | - ob_end_clean(); |
|
35 | + if( ob_get_length() ) { |
|
36 | + ob_end_clean(); |
|
37 | + } |
|
37 | 38 | ob_start(); |
38 | 39 | |
39 | 40 | $wpdb->show_errors = false; |
@@ -86,7 +87,7 @@ discard block |
||
86 | 87 | { |
87 | 88 | $this->xcloner_database->init($data); |
88 | 89 | |
89 | - }catch(Exception $e){ |
|
90 | + } catch(Exception $e){ |
|
90 | 91 | |
91 | 92 | $this->send_response($e->getMessage()); |
92 | 93 | $this->logger->error($e->getMessage()); |
@@ -113,8 +114,9 @@ discard block |
||
113 | 114 | $schedule = array(); |
114 | 115 | $response = array(); |
115 | 116 | |
116 | - if(isset($_POST['data'])) |
|
117 | - $params = json_decode(stripslashes($_POST['data'])); |
|
117 | + if(isset($_POST['data'])) { |
|
118 | + $params = json_decode(stripslashes($_POST['data'])); |
|
119 | + } |
|
118 | 120 | |
119 | 121 | $this->process_params($params); |
120 | 122 | |
@@ -125,7 +127,7 @@ discard block |
||
125 | 127 | $this->form_params['backup_params']['email_notification'] = $this->xcloner_sanitization->sanitize_input_as_string($_POST['email_notification']); |
126 | 128 | if($_POST['diff_start_date']){ |
127 | 129 | $this->form_params['backup_params']['diff_start_date'] = strtotime($this->xcloner_sanitization->sanitize_input_as_string($_POST['diff_start_date'])); |
128 | - }else{ |
|
130 | + } else{ |
|
129 | 131 | $this->form_params['backup_params']['diff_start_date'] = ""; |
130 | 132 | } |
131 | 133 | $this->form_params['backup_params']['schedule_name'] = $this->xcloner_sanitization->sanitize_input_as_string($_POST['schedule_name']); |
@@ -144,8 +146,9 @@ discard block |
||
144 | 146 | { |
145 | 147 | $table = str_replace("\r","", $table); |
146 | 148 | $data = explode(".", $table); |
147 | - if(isset($data[1])) |
|
148 | - $return[$data[0]][] = $data[1]; |
|
149 | + if(isset($data[1])) { |
|
150 | + $return[$data[0]][] = $data[1]; |
|
151 | + } |
|
149 | 152 | } |
150 | 153 | |
151 | 154 | $this->form_params['database'] = ($return); |
@@ -156,19 +159,21 @@ discard block |
||
156 | 159 | foreach($excluded_files as $file) |
157 | 160 | { |
158 | 161 | $file = str_replace("\r","", $file); |
159 | - if($file) |
|
160 | - $return[] = $file; |
|
162 | + if($file) { |
|
163 | + $return[] = $file; |
|
164 | + } |
|
161 | 165 | } |
162 | 166 | |
163 | 167 | $this->form_params['excluded_files'] = ($return); |
164 | 168 | |
165 | 169 | $schedule['start_at'] = $this->form_params['backup_params']['start_at']; |
166 | 170 | |
167 | - if(!isset($_POST['status'])) |
|
168 | - $schedule['status'] = 0; |
|
169 | - else |
|
170 | - $schedule['status'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['status']); |
|
171 | - }else{ |
|
171 | + if(!isset($_POST['status'])) { |
|
172 | + $schedule['status'] = 0; |
|
173 | + } else { |
|
174 | + $schedule['status'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['status']); |
|
175 | + } |
|
176 | + } else{ |
|
172 | 177 | |
173 | 178 | $schedule['status'] = 1; |
174 | 179 | $schedule['start_at'] = strtotime($this->form_params['backup_params']['schedule_start_date'] . |
@@ -183,7 +188,7 @@ discard block |
||
183 | 188 | if(!$schedule['start_at']) |
184 | 189 | { |
185 | 190 | $schedule['start_at'] = date('Y-m-d H:i:s', time()); |
186 | - }else{ |
|
191 | + } else{ |
|
187 | 192 | $schedule['start_at'] = date('Y-m-d H:i:s', $schedule['start_at'] - (get_option( 'gmt_offset' ) * HOUR_IN_SECONDS) ); |
188 | 193 | } |
189 | 194 | |
@@ -203,7 +208,7 @@ discard block |
||
203 | 208 | '%s' |
204 | 209 | ) |
205 | 210 | ); |
206 | - }else { |
|
211 | + } else { |
|
207 | 212 | $wpdb->update( |
208 | 213 | $wpdb->prefix.'xcloner_scheduler', |
209 | 214 | $schedule, |
@@ -244,8 +249,9 @@ discard block |
||
244 | 249 | |
245 | 250 | $init = (int)$_POST['init']; |
246 | 251 | |
247 | - if($params === NULL) |
|
248 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
252 | + if($params === NULL) { |
|
253 | + die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
254 | + } |
|
249 | 255 | |
250 | 256 | $this->process_params($params); |
251 | 257 | |
@@ -254,7 +260,7 @@ discard block |
||
254 | 260 | //$return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'], $this->form_params['extra'], $init); |
255 | 261 | try{ |
256 | 262 | $return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'], $this->form_params['extra'], $init); |
257 | - }catch(Exception $e) |
|
263 | + } catch(Exception $e) |
|
258 | 264 | { |
259 | 265 | $return = array(); |
260 | 266 | $return['error'] = true; |
@@ -266,8 +272,9 @@ discard block |
||
266 | 272 | if($return['finished']) |
267 | 273 | { |
268 | 274 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
269 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
270 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
275 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
276 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
277 | + } |
|
271 | 278 | } |
272 | 279 | |
273 | 280 | $data = $return; |
@@ -282,7 +289,7 @@ discard block |
||
282 | 289 | $subject = ""; |
283 | 290 | $additional['lines_total'] = $return['extra']['lines_total']; |
284 | 291 | $this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $this->form_params,"", $additional); |
285 | - }catch(Exception $e) |
|
292 | + } catch(Exception $e) |
|
286 | 293 | { |
287 | 294 | $this->logger->error($e->getMessage()); |
288 | 295 | } |
@@ -306,18 +313,20 @@ discard block |
||
306 | 313 | |
307 | 314 | $init = (int)$_POST['init']; |
308 | 315 | |
309 | - if($params === NULL) |
|
310 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
316 | + if($params === NULL) { |
|
317 | + die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
318 | + } |
|
311 | 319 | |
312 | 320 | $this->process_params($params); |
313 | 321 | |
314 | 322 | //$xcloner_database = $this->init_db(); |
315 | 323 | $return = $this->xcloner_database->start_database_recursion($this->form_params['database'], $this->form_params['extra'], $init); |
316 | 324 | |
317 | - if(isset($return['error']) and $return['error']) |
|
318 | - $data['finished'] = 1; |
|
319 | - else |
|
320 | - $data['finished'] = $return['finished']; |
|
325 | + if(isset($return['error']) and $return['error']) { |
|
326 | + $data['finished'] = 1; |
|
327 | + } else { |
|
328 | + $data['finished'] = $return['finished']; |
|
329 | + } |
|
321 | 330 | |
322 | 331 | $data['extra'] = $return; |
323 | 332 | |
@@ -336,8 +345,9 @@ discard block |
||
336 | 345 | $params = json_decode(stripslashes($_POST['data'])); |
337 | 346 | $init = (int)$_POST['init']; |
338 | 347 | |
339 | - if($params === NULL) |
|
340 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
348 | + if($params === NULL) { |
|
349 | + die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
350 | + } |
|
341 | 351 | |
342 | 352 | $hash = $this->process_params($params); |
343 | 353 | |
@@ -360,8 +370,9 @@ discard block |
||
360 | 370 | */ |
361 | 371 | private function process_params($params) |
362 | 372 | { |
363 | - if(isset($params->hash)) |
|
364 | - $this->xcloner_settings->set_hash($params->hash); |
|
373 | + if(isset($params->hash)) { |
|
374 | + $this->xcloner_settings->set_hash($params->hash); |
|
375 | + } |
|
365 | 376 | |
366 | 377 | $this->form_params['extra'] = array(); |
367 | 378 | $this->form_params['backup_params'] = array(); |
@@ -414,8 +425,9 @@ discard block |
||
414 | 425 | |
415 | 426 | if(isset($params->extra)) |
416 | 427 | { |
417 | - foreach($params->extra as $key=>$value) |
|
418 | - $this->form_params['extra'][$key] = $this->xcloner_sanitization->sanitize_input_as_raw($value); |
|
428 | + foreach($params->extra as $key=>$value) { |
|
429 | + $this->form_params['extra'][$key] = $this->xcloner_sanitization->sanitize_input_as_raw($value); |
|
430 | + } |
|
419 | 431 | } |
420 | 432 | |
421 | 433 | if(isset($this->form_params['backup_params']['diff_start_date']) and $this->form_params['backup_params']['diff_start_date']) |
@@ -455,7 +467,7 @@ discard block |
||
455 | 467 | |
456 | 468 | try{ |
457 | 469 | $files = $this->xcloner_file_system->list_directory($folder); |
458 | - }catch(Exception $e){ |
|
470 | + } catch(Exception $e){ |
|
459 | 471 | |
460 | 472 | print $e->getMessage(); |
461 | 473 | $this->logger->error($e->getMessage()); |
@@ -475,15 +487,17 @@ discard block |
||
475 | 487 | $children = false; |
476 | 488 | $text = $file['basename']; |
477 | 489 | |
478 | - if($file['type'] == "dir") |
|
479 | - $children = true; |
|
480 | - else |
|
481 | - $text .= " (". $this->xcloner_requirements->file_format_size($file['size']).")"; |
|
490 | + if($file['type'] == "dir") { |
|
491 | + $children = true; |
|
492 | + } else { |
|
493 | + $text .= " (". $this->xcloner_requirements->file_format_size($file['size']).")"; |
|
494 | + } |
|
482 | 495 | |
483 | - if($this->xcloner_file_system->is_excluded($file)) |
|
484 | - $selected = true; |
|
485 | - else |
|
486 | - $selected = false; |
|
496 | + if($this->xcloner_file_system->is_excluded($file)) { |
|
497 | + $selected = true; |
|
498 | + } else { |
|
499 | + $selected = false; |
|
500 | + } |
|
487 | 501 | |
488 | 502 | $data[] = array( |
489 | 503 | 'id' => $file['path'], |
@@ -519,22 +533,24 @@ discard block |
||
519 | 533 | { |
520 | 534 | try{ |
521 | 535 | $return = $this->xcloner_database->get_all_databases(); |
522 | - }catch(Exception $e){ |
|
536 | + } catch(Exception $e){ |
|
523 | 537 | $this->logger->error($e->getMessage()); |
524 | 538 | } |
525 | 539 | |
526 | 540 | foreach($return as $database) |
527 | 541 | { |
528 | - if($xcloner_backup_only_wp_tables and $database['name'] != $this->xcloner_settings->get_db_database()) |
|
529 | - continue; |
|
542 | + if($xcloner_backup_only_wp_tables and $database['name'] != $this->xcloner_settings->get_db_database()) { |
|
543 | + continue; |
|
544 | + } |
|
530 | 545 | |
531 | 546 | $state = array(); |
532 | 547 | |
533 | 548 | if($database['name'] == $this->xcloner_settings->get_db_database()) |
534 | 549 | { |
535 | 550 | $state['selected'] = true; |
536 | - if($database['num_tables'] < 25) |
|
537 | - $state['opened'] = false; |
|
551 | + if($database['num_tables'] < 25) { |
|
552 | + $state['opened'] = false; |
|
553 | + } |
|
538 | 554 | } |
539 | 555 | |
540 | 556 | $data[] = array( |
@@ -547,13 +563,11 @@ discard block |
||
547 | 563 | ); |
548 | 564 | } |
549 | 565 | |
550 | - } |
|
551 | - |
|
552 | - else{ |
|
566 | + } else{ |
|
553 | 567 | |
554 | 568 | try{ |
555 | 569 | $return = $this->xcloner_database->list_tables($database, "", 1); |
556 | - }catch(Exception $e){ |
|
570 | + } catch(Exception $e){ |
|
557 | 571 | $this->logger->error($e->getMessage()); |
558 | 572 | } |
559 | 573 | |
@@ -561,11 +575,13 @@ discard block |
||
561 | 575 | { |
562 | 576 | $state = array(); |
563 | 577 | |
564 | - if($xcloner_backup_only_wp_tables and !stristr($table['name'], $this->xcloner_settings->get_table_prefix())) |
|
565 | - continue; |
|
578 | + if($xcloner_backup_only_wp_tables and !stristr($table['name'], $this->xcloner_settings->get_table_prefix())) { |
|
579 | + continue; |
|
580 | + } |
|
566 | 581 | |
567 | - if(isset($database['name']) and $database['name'] == $this->xcloner_settings->get_db_database()) |
|
568 | - $state = array('selected' => true); |
|
582 | + if(isset($database['name']) and $database['name'] == $this->xcloner_settings->get_db_database()) { |
|
583 | + $state = array('selected' => true); |
|
584 | + } |
|
569 | 585 | |
570 | 586 | $data[] = array( |
571 | 587 | 'id' => $table['name'], |
@@ -620,10 +636,11 @@ discard block |
||
620 | 636 | { |
621 | 637 | $action = "<a href=\"#".$res->id."\" class=\"edit\" title='Edit'> <i class=\"material-icons \">edit</i></a> |
622 | 638 | <a href=\"#".$res->id."\" class=\"delete\" title='Delete'><i class=\"material-icons \">delete</i></a>"; |
623 | - if($res->status) |
|
624 | - $status = '<i class="material-icons active status">timer</i>'; |
|
625 | - else |
|
626 | - $status = '<i class="material-icons status inactive">timer_off</i>'; |
|
639 | + if($res->status) { |
|
640 | + $status = '<i class="material-icons active status">timer</i>'; |
|
641 | + } else { |
|
642 | + $status = '<i class="material-icons status inactive">timer_off</i>'; |
|
643 | + } |
|
627 | 644 | |
628 | 645 | $next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)); |
629 | 646 | |
@@ -631,17 +648,19 @@ discard block |
||
631 | 648 | |
632 | 649 | $remote_storage = $res->remote_storage; |
633 | 650 | |
634 | - if(!$next_run_time >= time()) |
|
635 | - $next_run = " "; |
|
651 | + if(!$next_run_time >= time()) { |
|
652 | + $next_run = " "; |
|
653 | + } |
|
636 | 654 | |
637 | 655 | if(trim($next_run)) |
638 | 656 | { |
639 | 657 | $date_text = date(get_option('date_format')." ".get_option('time_format'), $next_run_time + (get_option( 'gmt_offset' ) * HOUR_IN_SECONDS)); |
640 | 658 | |
641 | - if($next_run_time >= time()) |
|
642 | - $next_run = "in ".human_time_diff($next_run_time, time()); |
|
643 | - else |
|
644 | - $next_run = __("executed", 'xcloner-backup-and-restore'); |
|
659 | + if($next_run_time >= time()) { |
|
660 | + $next_run = "in ".human_time_diff($next_run_time, time()); |
|
661 | + } else { |
|
662 | + $next_run = __("executed", 'xcloner-backup-and-restore'); |
|
663 | + } |
|
645 | 664 | |
646 | 665 | $next_run = "<a href='#' title='".$date_text."'>".$next_run."</a>"; |
647 | 666 | //$next_run .=" ($date_text)"; |
@@ -732,7 +751,7 @@ discard block |
||
732 | 751 | $tar->open($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file, $start); |
733 | 752 | |
734 | 753 | $data = $tar->contents(get_option('xcloner_files_to_process_per_request')); |
735 | - }catch(Exception $e) |
|
754 | + } catch(Exception $e) |
|
736 | 755 | { |
737 | 756 | $return['error'] = true; |
738 | 757 | $return['message'] = $e->getMessage(); |
@@ -760,15 +779,16 @@ discard block |
||
760 | 779 | { |
761 | 780 | $return['start'] = $data['start']; |
762 | 781 | $return['finished'] = 0; |
763 | - }else{ |
|
782 | + } else{ |
|
764 | 783 | if($this->xcloner_file_system->is_multipart($source_backup_file)) |
765 | 784 | { |
766 | 785 | $return['start'] = 0; |
767 | 786 | |
768 | 787 | ++$return['part']; |
769 | 788 | |
770 | - if($return['part'] < sizeof($backup_parts)) |
|
771 | - $return['finished'] = 0; |
|
789 | + if($return['part'] < sizeof($backup_parts)) { |
|
790 | + $return['finished'] = 0; |
|
791 | + } |
|
772 | 792 | |
773 | 793 | } |
774 | 794 | } |
@@ -794,7 +814,7 @@ discard block |
||
794 | 814 | { |
795 | 815 | $return = call_user_func_array(array($xcloner_remote_storage, "copy_backup_remote_to_local"), array($backup_file, $storage_type)); |
796 | 816 | } |
797 | - }catch(Exception $e){ |
|
817 | + } catch(Exception $e){ |
|
798 | 818 | |
799 | 819 | $return['error'] = 1; |
800 | 820 | $return['message'] = $e->getMessage(); |
@@ -833,7 +853,7 @@ discard block |
||
833 | 853 | { |
834 | 854 | $return = call_user_func_array(array($xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $storage_type)); |
835 | 855 | } |
836 | - }catch(Exception $e){ |
|
856 | + } catch(Exception $e){ |
|
837 | 857 | |
838 | 858 | $return['error'] = 1; |
839 | 859 | $return['message'] = $e->getMessage(); |
@@ -984,11 +1004,13 @@ discard block |
||
984 | 1004 | $file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']); |
985 | 1005 | $hash = $this->xcloner_sanitization->sanitize_input_as_string($_POST['hash']); |
986 | 1006 | |
987 | - if(isset($_POST['part'])) |
|
988 | - $return['part'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['part']); |
|
1007 | + if(isset($_POST['part'])) { |
|
1008 | + $return['part'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['part']); |
|
1009 | + } |
|
989 | 1010 | |
990 | - if(isset($_POST['uploaded_size'])) |
|
991 | - $return['uploaded_size'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['uploaded_size']); |
|
1011 | + if(isset($_POST['uploaded_size'])) { |
|
1012 | + $return['uploaded_size'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['uploaded_size']); |
|
1013 | + } |
|
992 | 1014 | |
993 | 1015 | $start = $this->xcloner_sanitization->sanitize_input_as_string($_POST['start']); |
994 | 1016 | $target_url = $this->xcloner_sanitization->sanitize_input_as_string($_POST['target_url']); |
@@ -1015,7 +1037,7 @@ discard block |
||
1015 | 1037 | $xcloner_file_transfer->set_target($target_url); |
1016 | 1038 | $return['start'] = $xcloner_file_transfer->transfer_file($file, $start, $hash); |
1017 | 1039 | |
1018 | - }catch(Exception $e){ |
|
1040 | + } catch(Exception $e){ |
|
1019 | 1041 | |
1020 | 1042 | $return = array(); |
1021 | 1043 | $return['error'] = true; |
@@ -1059,8 +1081,9 @@ discard block |
||
1059 | 1081 | $data['hash'] = $this->xcloner_settings->get_hash(); |
1060 | 1082 | } |
1061 | 1083 | |
1062 | - if( ob_get_length() ) |
|
1063 | - ob_clean(); |
|
1084 | + if( ob_get_length() ) { |
|
1085 | + ob_clean(); |
|
1086 | + } |
|
1064 | 1087 | wp_send_json($data); |
1065 | 1088 | |
1066 | 1089 | die(); |
@@ -70,48 +70,61 @@ |
||
70 | 70 | update_option( "xcloner_db_version", $xcloner_db_version ); |
71 | 71 | } |
72 | 72 | |
73 | - if(get_option('xcloner_backup_compression_level') === false) |
|
74 | - update_option('xcloner_backup_compression_level', 0); |
|
73 | + if(get_option('xcloner_backup_compression_level') === false) { |
|
74 | + update_option('xcloner_backup_compression_level', 0); |
|
75 | + } |
|
75 | 76 | |
76 | - if(get_option('xcloner_enable_log') === false) |
|
77 | - update_option('xcloner_enable_log', 1); |
|
77 | + if(get_option('xcloner_enable_log') === false) { |
|
78 | + update_option('xcloner_enable_log', 1); |
|
79 | + } |
|
78 | 80 | |
79 | - if(get_option('xcloner_enable_mysql_backup') === false) |
|
80 | - update_option('xcloner_enable_mysql_backup', 1); |
|
81 | + if(get_option('xcloner_enable_mysql_backup') === false) { |
|
82 | + update_option('xcloner_enable_mysql_backup', 1); |
|
83 | + } |
|
81 | 84 | |
82 | - if(get_option('xcloner_system_settings_page') === false) |
|
83 | - update_option('xcloner_system_settings_page', 100); |
|
85 | + if(get_option('xcloner_system_settings_page') === false) { |
|
86 | + update_option('xcloner_system_settings_page', 100); |
|
87 | + } |
|
84 | 88 | |
85 | - if(get_option('xcloner_files_to_process_per_request') === false) |
|
86 | - update_option('xcloner_files_to_process_per_request', 250); |
|
89 | + if(get_option('xcloner_files_to_process_per_request') === false) { |
|
90 | + update_option('xcloner_files_to_process_per_request', 250); |
|
91 | + } |
|
87 | 92 | |
88 | - if(get_option('xcloner_database_records_per_request') === false) |
|
89 | - update_option('xcloner_database_records_per_request', 10000); |
|
93 | + if(get_option('xcloner_database_records_per_request') === false) { |
|
94 | + update_option('xcloner_database_records_per_request', 10000); |
|
95 | + } |
|
90 | 96 | |
91 | - if(get_option('xcloner_exclude_files_larger_than_mb') === false) |
|
92 | - update_option('xcloner_exclude_files_larger_than_mb', 0); |
|
97 | + if(get_option('xcloner_exclude_files_larger_than_mb') === false) { |
|
98 | + update_option('xcloner_exclude_files_larger_than_mb', 0); |
|
99 | + } |
|
93 | 100 | |
94 | - if(get_option('xcloner_split_backup_limit') === false) |
|
95 | - update_option('xcloner_split_backup_limit', 2048); |
|
101 | + if(get_option('xcloner_split_backup_limit') === false) { |
|
102 | + update_option('xcloner_split_backup_limit', 2048); |
|
103 | + } |
|
96 | 104 | |
97 | - if(get_option('xcloner_size_limit_per_request') === false) |
|
98 | - update_option('xcloner_size_limit_per_request', 50); |
|
105 | + if(get_option('xcloner_size_limit_per_request') === false) { |
|
106 | + update_option('xcloner_size_limit_per_request', 50); |
|
107 | + } |
|
99 | 108 | |
100 | - if(get_option('xcloner_cleanup_retention_limit_days') === false) |
|
101 | - update_option('xcloner_cleanup_retention_limit_days', 60); |
|
109 | + if(get_option('xcloner_cleanup_retention_limit_days') === false) { |
|
110 | + update_option('xcloner_cleanup_retention_limit_days', 60); |
|
111 | + } |
|
102 | 112 | |
103 | - if(get_option('xcloner_cleanup_retention_limit_archives') === false) |
|
104 | - update_option('xcloner_cleanup_retention_limit_archives', 100); |
|
113 | + if(get_option('xcloner_cleanup_retention_limit_archives') === false) { |
|
114 | + update_option('xcloner_cleanup_retention_limit_archives', 100); |
|
115 | + } |
|
105 | 116 | |
106 | - if(get_option('xcloner_directories_to_scan_per_request') === false) |
|
107 | - update_option('xcloner_directories_to_scan_per_request', 25); |
|
117 | + if(get_option('xcloner_directories_to_scan_per_request') === false) { |
|
118 | + update_option('xcloner_directories_to_scan_per_request', 25); |
|
119 | + } |
|
108 | 120 | |
109 | 121 | /*if(!get_option('xcloner_diff_backup_recreate_period')) |
110 | 122 | update_option('xcloner_diff_backup_recreate_period', 10); |
111 | 123 | * */ |
112 | 124 | |
113 | - if(!get_option('xcloner_regex_exclude')) |
|
114 | - update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$".PHP_EOL."(.*)error_log$"); |
|
125 | + if(!get_option('xcloner_regex_exclude')) { |
|
126 | + update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$".PHP_EOL."(.*)error_log$"); |
|
127 | + } |
|
115 | 128 | |
116 | 129 | } |
117 | 130 |