@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class Xcloner_Scheduler{ |
|
| 3 | +class Xcloner_Scheduler { |
|
| 4 | 4 | |
| 5 | 5 | private $db; |
| 6 | 6 | private $scheduler_table = "xcloner_scheduler"; |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | global $wpdb; |
| 23 | 23 | |
| 24 | - $this->db = $wpdb; |
|
| 25 | - $wpdb->show_errors = false; |
|
| 24 | + $this->db = $wpdb; |
|
| 25 | + $wpdb->show_errors = false; |
|
| 26 | 26 | |
| 27 | 27 | $this->xcloner_container = $xcloner_container; |
| 28 | 28 | $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
@@ -40,18 +40,18 @@ discard block |
||
| 40 | 40 | $this->xcloner_container = $container; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function get_scheduler_list($return_only_enabled = 0 ) |
|
| 43 | + public function get_scheduler_list($return_only_enabled = 0) |
|
| 44 | 44 | { |
| 45 | 45 | $list = $this->db->get_results("SELECT * FROM ".$this->scheduler_table); |
| 46 | 46 | |
| 47 | - if($return_only_enabled) |
|
| 47 | + if ($return_only_enabled) |
|
| 48 | 48 | { |
| 49 | - $new_list= array(); |
|
| 49 | + $new_list = array(); |
|
| 50 | 50 | |
| 51 | - foreach($list as $res) |
|
| 52 | - if($res->status) |
|
| 51 | + foreach ($list as $res) |
|
| 52 | + if ($res->status) |
|
| 53 | 53 | { |
| 54 | - $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
|
| 54 | + $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)) + (get_option('gmt_offset') * HOUR_IN_SECONDS); |
|
| 55 | 55 | $new_list[] = $res; |
| 56 | 56 | } |
| 57 | 57 | $list = $new_list; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
| 79 | 79 | |
| 80 | - if(!$data) |
|
| 80 | + if (!$data) |
|
| 81 | 81 | return false; |
| 82 | 82 | |
| 83 | 83 | $params = json_decode($data['params']); |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | public function delete_schedule_by_id($id) |
| 96 | 96 | { |
| 97 | - $hook = 'xcloner_scheduler_'.$id; |
|
| 98 | - wp_clear_scheduled_hook( $hook, array($id) ); |
|
| 97 | + $hook = 'xcloner_scheduler_'.$id; |
|
| 98 | + wp_clear_scheduled_hook($hook, array($id)); |
|
| 99 | 99 | |
| 100 | - $data = $this->db->delete( $this->scheduler_table , array( 'id' => $id ) ); |
|
| 100 | + $data = $this->db->delete($this->scheduler_table, array('id' => $id)); |
|
| 101 | 101 | |
| 102 | 102 | return $data; |
| 103 | 103 | } |
@@ -106,12 +106,12 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $list = $this->get_scheduler_list(); |
| 108 | 108 | |
| 109 | - foreach($list as $schedule) |
|
| 109 | + foreach ($list as $schedule) |
|
| 110 | 110 | { |
| 111 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 111 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 112 | 112 | |
| 113 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 114 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 113 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 114 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
@@ -119,26 +119,26 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $list = $this->get_scheduler_list(); |
| 121 | 121 | |
| 122 | - foreach($list as $schedule) |
|
| 122 | + foreach ($list as $schedule) |
|
| 123 | 123 | { |
| 124 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 124 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 125 | 125 | |
| 126 | 126 | //adding the xcloner_scheduler hook with xcloner_scheduler_callback callback |
| 127 | - add_action( $hook, array($this, 'xcloner_scheduler_callback'), 10, 1 ); |
|
| 127 | + add_action($hook, array($this, 'xcloner_scheduler_callback'), 10, 1); |
|
| 128 | 128 | |
| 129 | - if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
|
| 129 | + if (!wp_next_scheduled($hook, array($schedule->id)) and $schedule->status) { |
|
| 130 | 130 | |
| 131 | - if($schedule->recurrence == "single") |
|
| 131 | + if ($schedule->recurrence == "single") |
|
| 132 | 132 | { |
| 133 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 134 | - }else{ |
|
| 135 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 133 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 134 | + } else { |
|
| 135 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - }elseif(!$schedule->status) |
|
| 138 | + }elseif (!$schedule->status) |
|
| 139 | 139 | { |
| 140 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 141 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 140 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 141 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
@@ -147,18 +147,18 @@ discard block |
||
| 147 | 147 | public function update_cron_hook($id) |
| 148 | 148 | { |
| 149 | 149 | $schedule = $this->get_schedule_by_id_object($id); |
| 150 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 150 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 151 | 151 | |
| 152 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 153 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 152 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 153 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 154 | 154 | |
| 155 | 155 | if ($schedule->status) { |
| 156 | 156 | |
| 157 | - if($schedule->recurrence == "single") |
|
| 157 | + if ($schedule->recurrence == "single") |
|
| 158 | 158 | { |
| 159 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 160 | - }else{ |
|
| 161 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 159 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 160 | + } else { |
|
| 161 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | } |
@@ -166,16 +166,16 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | public function disable_single_cron($schedule_id) |
| 168 | 168 | { |
| 169 | - $hook = 'xcloner_scheduler_'.$schedule_id; |
|
| 170 | - $timestamp = wp_next_scheduled( $hook , array($schedule_id) ); |
|
| 171 | - wp_unschedule_event( $timestamp, $hook, array($schedule_id) ); |
|
| 169 | + $hook = 'xcloner_scheduler_'.$schedule_id; |
|
| 170 | + $timestamp = wp_next_scheduled($hook, array($schedule_id)); |
|
| 171 | + wp_unschedule_event($timestamp, $hook, array($schedule_id)); |
|
| 172 | 172 | |
| 173 | 173 | $schedule['status'] = 0; |
| 174 | 174 | |
| 175 | 175 | $update = $this->db->update( |
| 176 | 176 | $this->scheduler_table, |
| 177 | 177 | $schedule, |
| 178 | - array( 'id' => $schedule_id ), |
|
| 178 | + array('id' => $schedule_id), |
|
| 179 | 179 | array( |
| 180 | 180 | '%s', |
| 181 | 181 | '%s' |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $update = $this->db->update( |
| 192 | 192 | $this->scheduler_table, |
| 193 | 193 | $schedule, |
| 194 | - array( 'id' => $schedule_id ), |
|
| 194 | + array('id' => $schedule_id), |
|
| 195 | 195 | array( |
| 196 | 196 | '%s', |
| 197 | 197 | '%s' |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | $update = $this->db->update( |
| 208 | 208 | $this->scheduler_table, |
| 209 | 209 | $schedule, |
| 210 | - array( 'id' => $schedule_id ), |
|
| 210 | + array('id' => $schedule_id), |
|
| 211 | 211 | array( |
| 212 | 212 | '%s', |
| 213 | 213 | '%s' |
@@ -228,25 +228,25 @@ discard block |
||
| 228 | 228 | #$this->get_xcloner_container()->get_xcloner_settings()->set_hash($hash); |
| 229 | 229 | |
| 230 | 230 | //$this->xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
| 231 | - $this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 232 | - $this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database(); |
|
| 233 | - $this->archive_system = $this->get_xcloner_container()->get_archive_system(); |
|
| 234 | - $this->logger = $this->get_xcloner_container()->get_xcloner_logger()->withName("xcloner_scheduler"); |
|
| 235 | - $this->xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
| 231 | + $this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 232 | + $this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database(); |
|
| 233 | + $this->archive_system = $this->get_xcloner_container()->get_archive_system(); |
|
| 234 | + $this->logger = $this->get_xcloner_container()->get_xcloner_logger()->withName("xcloner_scheduler"); |
|
| 235 | + $this->xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
| 236 | 236 | |
| 237 | 237 | $this->logger->info(sprintf("New schedule hash is %s", $this->xcloner_settings->get_hash())); |
| 238 | 238 | |
| 239 | - if(isset($schedule['backup_params']->diff_start_date) && $schedule['backup_params']->diff_start_date) |
|
| 239 | + if (isset($schedule['backup_params']->diff_start_date) && $schedule['backup_params']->diff_start_date) |
|
| 240 | 240 | { |
| 241 | 241 | $this->xcloner_file_system->set_diff_timestamp_start($schedule['backup_params']->diff_start_date); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - if($schedule['recurrence'] == "single") |
|
| 244 | + if ($schedule['recurrence'] == "single") |
|
| 245 | 245 | { |
| 246 | 246 | $this->disable_single_cron($schedule['id']); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if(!$schedule) |
|
| 249 | + if (!$schedule) |
|
| 250 | 250 | { |
| 251 | 251 | $this->logger->info(sprintf("Could not load schedule with id'%s'", $id), array("CRON")); |
| 252 | 252 | return; |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $init = 1; |
| 264 | 264 | $continue = 1; |
| 265 | 265 | |
| 266 | - while($continue) |
|
| 266 | + while ($continue) |
|
| 267 | 267 | { |
| 268 | 268 | $continue = $this->xcloner_file_system->start_file_recursion($init); |
| 269 | 269 | |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | $init = 1; |
| 278 | 278 | $return['finished'] = 0; |
| 279 | 279 | |
| 280 | - while(!$return['finished']) |
|
| 280 | + while (!$return['finished']) |
|
| 281 | 281 | { |
| 282 | - $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
| 282 | + $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
| 283 | 283 | $init = 0; |
| 284 | 284 | } |
| 285 | 285 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $return['finished'] = 0; |
| 292 | 292 | $return['extra'] = array(); |
| 293 | 293 | |
| 294 | - while(!$return['finished']) |
|
| 294 | + while (!$return['finished']) |
|
| 295 | 295 | { |
| 296 | 296 | $return = $this->archive_system->start_incremental_backup((array)$schedule['backup_params'], $return['extra'], $init); |
| 297 | 297 | $init = 0; |
@@ -300,38 +300,38 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | //getting the last backup archive file |
| 302 | 302 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 303 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 303 | + if ($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 304 | 304 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
| 305 | 305 | |
| 306 | 306 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
| 307 | 307 | |
| 308 | - if(isset($schedule['remote_storage']) && $schedule['remote_storage'] && array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
| 308 | + if (isset($schedule['remote_storage']) && $schedule['remote_storage'] && array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
| 309 | 309 | { |
| 310 | 310 | $backup_file = $return['extra']['backup_parent']; |
| 311 | 311 | |
| 312 | 312 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
| 313 | 313 | |
| 314 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 314 | + if (method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 315 | 315 | call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
|
| 318 | + if (isset($schedule['backup_params']->email_notification) and $to = $schedule['backup_params']->email_notification) |
|
| 319 | 319 | { |
| 320 | - try{ |
|
| 320 | + try { |
|
| 321 | 321 | $from = ""; |
| 322 | 322 | $additional['lines_total'] = $return['extra']['lines_total']; |
| 323 | - $subject = sprintf(__("%s - new backup generated %s") , $schedule['name'], $return['extra']['backup_parent']); |
|
| 323 | + $subject = sprintf(__("%s - new backup generated %s"), $schedule['name'], $return['extra']['backup_parent']); |
|
| 324 | 324 | |
| 325 | 325 | $this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $schedule, "", $additional); |
| 326 | 326 | |
| 327 | 327 | //CHECK IF WE SHOULD DELETE BACKUP AFTER REMOTE TRANSFER IS DONE |
| 328 | - if($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_delete_after_remote_transfer')) |
|
| 328 | + if ($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_delete_after_remote_transfer')) |
|
| 329 | 329 | { |
| 330 | - $this->logger->info(sprintf("Deleting %s from local storage matching rule xcloner_cleanup_delete_after_remote_transfer",$return['extra']['backup_parent'])); |
|
| 330 | + $this->logger->info(sprintf("Deleting %s from local storage matching rule xcloner_cleanup_delete_after_remote_transfer", $return['extra']['backup_parent'])); |
|
| 331 | 331 | $this->xcloner_file_system->delete_backup_by_name($return['extra']['backup_parent']); |
| 332 | 332 | |
| 333 | 333 | } |
| 334 | - }catch(Exception $e) |
|
| 334 | + }catch (Exception $e) |
|
| 335 | 335 | { |
| 336 | 336 | $this->logger->error($e->getMessage()); |
| 337 | 337 | } |
@@ -344,27 +344,27 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | public function xcloner_scheduler_callback($id, $schedule = "") |
| 346 | 346 | { |
| 347 | - if($id) |
|
| 347 | + if ($id) |
|
| 348 | 348 | { |
| 349 | 349 | $schedule = $this->get_schedule_by_id($id); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - try{ |
|
| 352 | + try { |
|
| 353 | 353 | |
| 354 | 354 | $this->__xcloner_scheduler_callback($id, $schedule); |
| 355 | 355 | |
| 356 | - }catch(Exception $e){ |
|
| 356 | + }catch (Exception $e) { |
|
| 357 | 357 | |
| 358 | 358 | //send email to site admin if email notification is not set in the scheduler |
| 359 | - if(!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |
|
| 359 | + if (!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |
|
| 360 | 360 | { |
| 361 | 361 | $schedule['backup_params']->email_notification = get_option('admin_email'); |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - if(isset($schedule['backup_params']->email_notification) && $to=$schedule['backup_params']->email_notification) |
|
| 364 | + if (isset($schedule['backup_params']->email_notification) && $to = $schedule['backup_params']->email_notification) |
|
| 365 | 365 | { |
| 366 | 366 | $from = ""; |
| 367 | - $this->archive_system->send_notification($to, $from, $schedule['name']." - backup error","", "", $e->getMessage()); |
|
| 367 | + $this->archive_system->send_notification($to, $from, $schedule['name']." - backup error", "", "", $e->getMessage()); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | } |
@@ -377,10 +377,10 @@ discard block |
||
| 377 | 377 | $new_schedules = array(); |
| 378 | 378 | |
| 379 | 379 | foreach ($schedules as $key => $row) { |
| 380 | - if(in_array($key, $this->allowed_schedules)) |
|
| 380 | + if (in_array($key, $this->allowed_schedules)) |
|
| 381 | 381 | { |
| 382 | 382 | $new_schedules[$key] = $row; |
| 383 | - $intervals[$key] = $row['interval']; |
|
| 383 | + $intervals[$key] = $row['interval']; |
|
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | |
@@ -48,10 +48,11 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $new_list= array(); |
| 50 | 50 | |
| 51 | - foreach($list as $res) |
|
| 52 | - if($res->status) |
|
| 51 | + foreach($list as $res) { |
|
| 52 | + if($res->status) |
|
| 53 | 53 | { |
| 54 | 54 | $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
| 55 | + } |
|
| 55 | 56 | $new_list[] = $res; |
| 56 | 57 | } |
| 57 | 58 | $list = $new_list; |
@@ -77,8 +78,9 @@ discard block |
||
| 77 | 78 | { |
| 78 | 79 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
| 79 | 80 | |
| 80 | - if(!$data) |
|
| 81 | - return false; |
|
| 81 | + if(!$data) { |
|
| 82 | + return false; |
|
| 83 | + } |
|
| 82 | 84 | |
| 83 | 85 | $params = json_decode($data['params']); |
| 84 | 86 | |
@@ -131,11 +133,11 @@ discard block |
||
| 131 | 133 | if($schedule->recurrence == "single") |
| 132 | 134 | { |
| 133 | 135 | wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
| 134 | - }else{ |
|
| 136 | + } else{ |
|
| 135 | 137 | wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
| 136 | 138 | } |
| 137 | 139 | |
| 138 | - }elseif(!$schedule->status) |
|
| 140 | + } elseif(!$schedule->status) |
|
| 139 | 141 | { |
| 140 | 142 | $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
| 141 | 143 | wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
@@ -157,7 +159,7 @@ discard block |
||
| 157 | 159 | if($schedule->recurrence == "single") |
| 158 | 160 | { |
| 159 | 161 | wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
| 160 | - }else{ |
|
| 162 | + } else{ |
|
| 161 | 163 | wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
| 162 | 164 | } |
| 163 | 165 | |
@@ -300,8 +302,9 @@ discard block |
||
| 300 | 302 | |
| 301 | 303 | //getting the last backup archive file |
| 302 | 304 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 303 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 304 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 305 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
| 306 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 307 | + } |
|
| 305 | 308 | |
| 306 | 309 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
| 307 | 310 | |
@@ -311,8 +314,9 @@ discard block |
||
| 311 | 314 | |
| 312 | 315 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
| 313 | 316 | |
| 314 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 315 | - call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
| 317 | + if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) { |
|
| 318 | + call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
| 319 | + } |
|
| 316 | 320 | } |
| 317 | 321 | |
| 318 | 322 | if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
@@ -331,7 +335,7 @@ discard block |
||
| 331 | 335 | $this->xcloner_file_system->delete_backup_by_name($return['extra']['backup_parent']); |
| 332 | 336 | |
| 333 | 337 | } |
| 334 | - }catch(Exception $e) |
|
| 338 | + } catch(Exception $e) |
|
| 335 | 339 | { |
| 336 | 340 | $this->logger->error($e->getMessage()); |
| 337 | 341 | } |
@@ -353,7 +357,7 @@ discard block |
||
| 353 | 357 | |
| 354 | 358 | $this->__xcloner_scheduler_callback($id, $schedule); |
| 355 | 359 | |
| 356 | - }catch(Exception $e){ |
|
| 360 | + } catch(Exception $e){ |
|
| 357 | 361 | |
| 358 | 362 | //send email to site admin if email notification is not set in the scheduler |
| 359 | 363 | if(!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |
@@ -209,274 +209,274 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | public function settings_init() |
| 211 | 211 | { |
| 212 | - global $wpdb; |
|
| 213 | - $this->xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
|
| 212 | + global $wpdb; |
|
| 213 | + $this->xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
|
| 214 | 214 | |
| 215 | - //ADDING MISSING OPTIONS |
|
| 216 | - if( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
|
| 215 | + //ADDING MISSING OPTIONS |
|
| 216 | + if( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
|
| 217 | 217 | add_option( 'xcloner_mysql_settings_page' ); |
| 218 | 218 | } // end if |
| 219 | 219 | |
| 220 | - if( false == get_option( 'xcloner_cron_settings_page' ) ) { |
|
| 220 | + if( false == get_option( 'xcloner_cron_settings_page' ) ) { |
|
| 221 | 221 | add_option( 'xcloner_cron_settings_page' ); |
| 222 | 222 | } // end if |
| 223 | 223 | |
| 224 | - if( false == get_option( 'xcloner_system_settings_page' ) ) { |
|
| 224 | + if( false == get_option( 'xcloner_system_settings_page' ) ) { |
|
| 225 | 225 | add_option( 'xcloner_system_settings_page' ); |
| 226 | 226 | } // end if |
| 227 | 227 | |
| 228 | - if( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
|
| 228 | + if( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
|
| 229 | 229 | add_option( 'xcloner_cleanup_settings_page' ); |
| 230 | 230 | } // end if |
| 231 | 231 | |
| 232 | 232 | |
| 233 | - //ADDING SETTING SECTIONS |
|
| 234 | - //GENERAL section |
|
| 235 | - add_settings_section( |
|
| 236 | - 'xcloner_general_settings_group', |
|
| 237 | - __(' '), |
|
| 238 | - array($this, 'xcloner_settings_section_cb'), |
|
| 239 | - 'xcloner_settings_page' |
|
| 240 | - ); |
|
| 241 | - //MYSQL section |
|
| 242 | - add_settings_section( |
|
| 243 | - 'xcloner_mysql_settings_group', |
|
| 244 | - __(' '), |
|
| 245 | - array($this, 'xcloner_settings_section_cb'), |
|
| 246 | - 'xcloner_mysql_settings_page' |
|
| 247 | - ); |
|
| 233 | + //ADDING SETTING SECTIONS |
|
| 234 | + //GENERAL section |
|
| 235 | + add_settings_section( |
|
| 236 | + 'xcloner_general_settings_group', |
|
| 237 | + __(' '), |
|
| 238 | + array($this, 'xcloner_settings_section_cb'), |
|
| 239 | + 'xcloner_settings_page' |
|
| 240 | + ); |
|
| 241 | + //MYSQL section |
|
| 242 | + add_settings_section( |
|
| 243 | + 'xcloner_mysql_settings_group', |
|
| 244 | + __(' '), |
|
| 245 | + array($this, 'xcloner_settings_section_cb'), |
|
| 246 | + 'xcloner_mysql_settings_page' |
|
| 247 | + ); |
|
| 248 | 248 | |
| 249 | - //SYSTEM section |
|
| 250 | - add_settings_section( |
|
| 251 | - 'xcloner_system_settings_group', |
|
| 252 | - __('These are advanced options recommended for developers!','xcloner-backup-and-restore'), |
|
| 253 | - array($this, 'xcloner_settings_section_cb'), |
|
| 254 | - 'xcloner_system_settings_page' |
|
| 255 | - ); |
|
| 249 | + //SYSTEM section |
|
| 250 | + add_settings_section( |
|
| 251 | + 'xcloner_system_settings_group', |
|
| 252 | + __('These are advanced options recommended for developers!','xcloner-backup-and-restore'), |
|
| 253 | + array($this, 'xcloner_settings_section_cb'), |
|
| 254 | + 'xcloner_system_settings_page' |
|
| 255 | + ); |
|
| 256 | 256 | |
| 257 | - //CLEANUP section |
|
| 258 | - add_settings_section( |
|
| 259 | - 'xcloner_cleanup_settings_group', |
|
| 260 | - __(' '), |
|
| 261 | - array($this, 'xcloner_settings_section_cb'), |
|
| 262 | - 'xcloner_cleanup_settings_page' |
|
| 263 | - ); |
|
| 257 | + //CLEANUP section |
|
| 258 | + add_settings_section( |
|
| 259 | + 'xcloner_cleanup_settings_group', |
|
| 260 | + __(' '), |
|
| 261 | + array($this, 'xcloner_settings_section_cb'), |
|
| 262 | + 'xcloner_cleanup_settings_page' |
|
| 263 | + ); |
|
| 264 | 264 | |
| 265 | 265 | |
| 266 | 266 | //CRON section |
| 267 | - add_settings_section( |
|
| 268 | - 'xcloner_cron_settings_group', |
|
| 269 | - __(' '), |
|
| 270 | - array($this, 'xcloner_settings_section_cb'), |
|
| 271 | - 'xcloner_cron_settings_page' |
|
| 272 | - ); |
|
| 267 | + add_settings_section( |
|
| 268 | + 'xcloner_cron_settings_group', |
|
| 269 | + __(' '), |
|
| 270 | + array($this, 'xcloner_settings_section_cb'), |
|
| 271 | + 'xcloner_cron_settings_page' |
|
| 272 | + ); |
|
| 273 | 273 | |
| 274 | 274 | |
| 275 | 275 | |
| 276 | 276 | //REGISTERING THE 'GENERAL SECTION' FIELDS |
| 277 | 277 | register_setting('xcloner_general_settings_group', 'xcloner_backup_compression_level', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 278 | - add_settings_field( |
|
| 279 | - 'xcloner_backup_compression_level', |
|
| 280 | - __('Backup Compression Level','xcloner-backup-and-restore'), |
|
| 281 | - array($this, 'do_form_range_field'), |
|
| 282 | - 'xcloner_settings_page', |
|
| 283 | - 'xcloner_general_settings_group', |
|
| 284 | - array('xcloner_backup_compression_level', |
|
| 285 | - __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load','xcloner-backup-and-restore'), |
|
| 286 | - 0, |
|
| 287 | - 9 |
|
| 288 | - ) |
|
| 289 | - ); |
|
| 278 | + add_settings_field( |
|
| 279 | + 'xcloner_backup_compression_level', |
|
| 280 | + __('Backup Compression Level','xcloner-backup-and-restore'), |
|
| 281 | + array($this, 'do_form_range_field'), |
|
| 282 | + 'xcloner_settings_page', |
|
| 283 | + 'xcloner_general_settings_group', |
|
| 284 | + array('xcloner_backup_compression_level', |
|
| 285 | + __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load','xcloner-backup-and-restore'), |
|
| 286 | + 0, |
|
| 287 | + 9 |
|
| 288 | + ) |
|
| 289 | + ); |
|
| 290 | 290 | |
| 291 | - register_setting('xcloner_general_settings_group', 'xcloner_start_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 292 | - add_settings_field( |
|
| 293 | - 'xcloner_start_path', |
|
| 294 | - __('Backup Start Location','xcloner-backup-and-restore'), |
|
| 295 | - array($this, 'do_form_text_field'), |
|
| 296 | - 'xcloner_settings_page', |
|
| 297 | - 'xcloner_general_settings_group', |
|
| 298 | - array('xcloner_start_path', |
|
| 291 | + register_setting('xcloner_general_settings_group', 'xcloner_start_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 292 | + add_settings_field( |
|
| 293 | + 'xcloner_start_path', |
|
| 294 | + __('Backup Start Location','xcloner-backup-and-restore'), |
|
| 295 | + array($this, 'do_form_text_field'), |
|
| 296 | + 'xcloner_settings_page', |
|
| 297 | + 'xcloner_general_settings_group', |
|
| 298 | + array('xcloner_start_path', |
|
| 299 | 299 | __('Base path location from where XCloner can start the Backup.','xcloner-backup-and-restore'), |
| 300 | 300 | $this->get_xcloner_start_path(), |
| 301 | 301 | //'disabled' |
| 302 | 302 | ) |
| 303 | - ); |
|
| 303 | + ); |
|
| 304 | 304 | |
| 305 | - register_setting('xcloner_general_settings_group', 'xcloner_store_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 306 | - add_settings_field( |
|
| 307 | - 'xcloner_store_path', |
|
| 308 | - __('Backup Storage Location','xcloner-backup-and-restore'), |
|
| 309 | - array($this, 'do_form_text_field'), |
|
| 310 | - 'xcloner_settings_page', |
|
| 311 | - 'xcloner_general_settings_group', |
|
| 312 | - array('xcloner_store_path', |
|
| 305 | + register_setting('xcloner_general_settings_group', 'xcloner_store_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 306 | + add_settings_field( |
|
| 307 | + 'xcloner_store_path', |
|
| 308 | + __('Backup Storage Location','xcloner-backup-and-restore'), |
|
| 309 | + array($this, 'do_form_text_field'), |
|
| 310 | + 'xcloner_settings_page', |
|
| 311 | + 'xcloner_general_settings_group', |
|
| 312 | + array('xcloner_store_path', |
|
| 313 | 313 | __('Location where XCloner will store the Backup archives.','xcloner-backup-and-restore'), |
| 314 | 314 | $this->get_xcloner_store_path(), |
| 315 | 315 | //'disabled' |
| 316 | 316 | ) |
| 317 | - ); |
|
| 317 | + ); |
|
| 318 | 318 | |
| 319 | - register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 320 | - add_settings_field( |
|
| 321 | - 'xcloner_enable_log', |
|
| 322 | - __('Enable XCloner Backup Log','xcloner-backup-and-restore'), |
|
| 323 | - array($this, 'do_form_switch_field'), |
|
| 324 | - 'xcloner_settings_page', |
|
| 325 | - 'xcloner_general_settings_group', |
|
| 326 | - array('xcloner_enable_log', |
|
| 319 | + register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 320 | + add_settings_field( |
|
| 321 | + 'xcloner_enable_log', |
|
| 322 | + __('Enable XCloner Backup Log','xcloner-backup-and-restore'), |
|
| 323 | + array($this, 'do_form_switch_field'), |
|
| 324 | + 'xcloner_settings_page', |
|
| 325 | + 'xcloner_general_settings_group', |
|
| 326 | + array('xcloner_enable_log', |
|
| 327 | 327 | sprintf(__('Enable the XCloner Backup log. You will find it stored unde the Backup Storage Location, file %s','xcloner-backup-and-restore'), $this->get_logger_filename()) |
| 328 | 328 | ) |
| 329 | 329 | ); |
| 330 | 330 | |
| 331 | 331 | register_setting('xcloner_general_settings_group', 'xcloner_enable_pre_update_backup', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 332 | - add_settings_field( |
|
| 333 | - 'xcloner_enable_pre_update_backup', |
|
| 334 | - __('Generate Backups before Automatic WP Upgrades','xcloner-backup-and-restore'), |
|
| 335 | - array($this, 'do_form_switch_field'), |
|
| 336 | - 'xcloner_settings_page', |
|
| 337 | - 'xcloner_general_settings_group', |
|
| 338 | - array('xcloner_enable_pre_update_backup', |
|
| 332 | + add_settings_field( |
|
| 333 | + 'xcloner_enable_pre_update_backup', |
|
| 334 | + __('Generate Backups before Automatic WP Upgrades','xcloner-backup-and-restore'), |
|
| 335 | + array($this, 'do_form_switch_field'), |
|
| 336 | + 'xcloner_settings_page', |
|
| 337 | + 'xcloner_general_settings_group', |
|
| 338 | + array('xcloner_enable_pre_update_backup', |
|
| 339 | 339 | sprintf(__('Attempt to generate a core, plugins, themes or languages files backup before the automatic update of Wordpress core, plugins, themes or languages files.','xcloner-backup-and-restore'), $this->get_logger_filename()) |
| 340 | 340 | ) |
| 341 | 341 | ); |
| 342 | 342 | |
| 343 | 343 | register_setting('xcloner_general_settings_group', 'xcloner_regex_exclude', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 344 | - add_settings_field( |
|
| 345 | - 'xcloner_regex_exclude', |
|
| 346 | - __('Regex Exclude Files','xcloner-backup-and-restore'), |
|
| 347 | - array($this, 'do_form_textarea_field'), |
|
| 348 | - 'xcloner_settings_page', |
|
| 349 | - 'xcloner_general_settings_group', |
|
| 350 | - array('xcloner_regex_exclude', |
|
| 344 | + add_settings_field( |
|
| 345 | + 'xcloner_regex_exclude', |
|
| 346 | + __('Regex Exclude Files','xcloner-backup-and-restore'), |
|
| 347 | + array($this, 'do_form_textarea_field'), |
|
| 348 | + 'xcloner_settings_page', |
|
| 349 | + 'xcloner_general_settings_group', |
|
| 350 | + array('xcloner_regex_exclude', |
|
| 351 | 351 | __('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line','xcloner-backup-and-restore'), |
| 352 | 352 | //$this->get_xcloner_store_path(), |
| 353 | 353 | //'disabled' |
| 354 | 354 | ) |
| 355 | - ); |
|
| 355 | + ); |
|
| 356 | 356 | |
| 357 | 357 | //REGISTERING THE 'MYSQL SECTION' FIELDS |
| 358 | 358 | register_setting('xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 359 | - add_settings_field( |
|
| 360 | - 'xcloner_enable_mysql_backup', |
|
| 361 | - __('Enable Mysql Backup','xcloner-backup-and-restore'), |
|
| 362 | - array($this, 'do_form_switch_field'), |
|
| 363 | - 'xcloner_mysql_settings_page', |
|
| 364 | - 'xcloner_mysql_settings_group', |
|
| 365 | - array('xcloner_enable_mysql_backup', |
|
| 359 | + add_settings_field( |
|
| 360 | + 'xcloner_enable_mysql_backup', |
|
| 361 | + __('Enable Mysql Backup','xcloner-backup-and-restore'), |
|
| 362 | + array($this, 'do_form_switch_field'), |
|
| 363 | + 'xcloner_mysql_settings_page', |
|
| 364 | + 'xcloner_mysql_settings_group', |
|
| 365 | + array('xcloner_enable_mysql_backup', |
|
| 366 | 366 | __('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.','xcloner-backup-and-restore') |
| 367 | 367 | ) |
| 368 | - ); |
|
| 368 | + ); |
|
| 369 | 369 | |
| 370 | - register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables'); |
|
| 371 | - add_settings_field( |
|
| 372 | - 'xcloner_backup_only_wp_tables', |
|
| 373 | - __('Backup only WP tables','xcloner-backup-and-restore'), |
|
| 374 | - array($this, 'do_form_switch_field'), |
|
| 375 | - 'xcloner_mysql_settings_page', |
|
| 376 | - 'xcloner_mysql_settings_group', |
|
| 377 | - array('xcloner_backup_only_wp_tables', |
|
| 370 | + register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables'); |
|
| 371 | + add_settings_field( |
|
| 372 | + 'xcloner_backup_only_wp_tables', |
|
| 373 | + __('Backup only WP tables','xcloner-backup-and-restore'), |
|
| 374 | + array($this, 'do_form_switch_field'), |
|
| 375 | + 'xcloner_mysql_settings_page', |
|
| 376 | + 'xcloner_mysql_settings_group', |
|
| 377 | + array('xcloner_backup_only_wp_tables', |
|
| 378 | 378 | sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix','xcloner-backup-and-restore'), $this->get_table_prefix()) |
| 379 | 379 | ) |
| 380 | - ); |
|
| 380 | + ); |
|
| 381 | 381 | |
| 382 | - register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 383 | - add_settings_field( |
|
| 384 | - 'xcloner_mysql_hostname', |
|
| 385 | - __('Mysql Hostname','xcloner-backup-and-restore'), |
|
| 386 | - array($this, 'do_form_text_field'), |
|
| 387 | - 'xcloner_mysql_settings_page', |
|
| 388 | - 'xcloner_mysql_settings_group', |
|
| 389 | - array('xcloner_mysql_hostname', |
|
| 382 | + register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 383 | + add_settings_field( |
|
| 384 | + 'xcloner_mysql_hostname', |
|
| 385 | + __('Mysql Hostname','xcloner-backup-and-restore'), |
|
| 386 | + array($this, 'do_form_text_field'), |
|
| 387 | + 'xcloner_mysql_settings_page', |
|
| 388 | + 'xcloner_mysql_settings_group', |
|
| 389 | + array('xcloner_mysql_hostname', |
|
| 390 | 390 | __('Wordpress mysql hostname','xcloner-backup-and-restore'), |
| 391 | 391 | $this->get_db_hostname(), |
| 392 | 392 | 'disabled' |
| 393 | 393 | ) |
| 394 | - ); |
|
| 394 | + ); |
|
| 395 | 395 | |
| 396 | - register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 397 | - add_settings_field( |
|
| 398 | - 'xcloner_mysql_username', |
|
| 399 | - __('Mysql Username','xcloner-backup-and-restore'), |
|
| 400 | - array($this, 'do_form_text_field'), |
|
| 401 | - 'xcloner_mysql_settings_page', |
|
| 402 | - 'xcloner_mysql_settings_group', |
|
| 403 | - array('xcloner_mysql_username', |
|
| 396 | + register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 397 | + add_settings_field( |
|
| 398 | + 'xcloner_mysql_username', |
|
| 399 | + __('Mysql Username','xcloner-backup-and-restore'), |
|
| 400 | + array($this, 'do_form_text_field'), |
|
| 401 | + 'xcloner_mysql_settings_page', |
|
| 402 | + 'xcloner_mysql_settings_group', |
|
| 403 | + array('xcloner_mysql_username', |
|
| 404 | 404 | __('Wordpress mysql username','xcloner-backup-and-restore'), |
| 405 | 405 | $this->get_db_username(), |
| 406 | 406 | 'disabled' |
| 407 | 407 | ) |
| 408 | - ); |
|
| 408 | + ); |
|
| 409 | 409 | |
| 410 | - register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 411 | - add_settings_field( |
|
| 412 | - 'xcloner_mysql_database', |
|
| 413 | - __('Mysql Database','xcloner-backup-and-restore'), |
|
| 414 | - array($this, 'do_form_text_field'), |
|
| 415 | - 'xcloner_mysql_settings_page', |
|
| 416 | - 'xcloner_mysql_settings_group', |
|
| 417 | - array('xcloner_mysql_database', |
|
| 410 | + register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 411 | + add_settings_field( |
|
| 412 | + 'xcloner_mysql_database', |
|
| 413 | + __('Mysql Database','xcloner-backup-and-restore'), |
|
| 414 | + array($this, 'do_form_text_field'), |
|
| 415 | + 'xcloner_mysql_settings_page', |
|
| 416 | + 'xcloner_mysql_settings_group', |
|
| 417 | + array('xcloner_mysql_database', |
|
| 418 | 418 | __('Wordpress mysql database','xcloner-backup-and-restore'), |
| 419 | 419 | $this->get_db_database(), |
| 420 | 420 | 'disabled' |
| 421 | 421 | ) |
| 422 | - ); |
|
| 422 | + ); |
|
| 423 | 423 | |
| 424 | - //REGISTERING THE 'SYSTEM SECTION' FIELDS |
|
| 425 | - register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 426 | - add_settings_field( |
|
| 427 | - 'xcloner_size_limit_per_request', |
|
| 428 | - __('Data Size Limit Per Request','xcloner-backup-and-restore'), |
|
| 429 | - array($this, 'do_form_range_field'), |
|
| 430 | - 'xcloner_system_settings_page', |
|
| 431 | - 'xcloner_system_settings_group', |
|
| 432 | - array('xcloner_size_limit_per_request', |
|
| 433 | - __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB','xcloner-backup-and-restore'), |
|
| 434 | - 0, |
|
| 435 | - 1024 |
|
| 436 | - ) |
|
| 437 | - ); |
|
| 424 | + //REGISTERING THE 'SYSTEM SECTION' FIELDS |
|
| 425 | + register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 426 | + add_settings_field( |
|
| 427 | + 'xcloner_size_limit_per_request', |
|
| 428 | + __('Data Size Limit Per Request','xcloner-backup-and-restore'), |
|
| 429 | + array($this, 'do_form_range_field'), |
|
| 430 | + 'xcloner_system_settings_page', |
|
| 431 | + 'xcloner_system_settings_group', |
|
| 432 | + array('xcloner_size_limit_per_request', |
|
| 433 | + __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB','xcloner-backup-and-restore'), |
|
| 434 | + 0, |
|
| 435 | + 1024 |
|
| 436 | + ) |
|
| 437 | + ); |
|
| 438 | 438 | |
| 439 | 439 | register_setting('xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 440 | - add_settings_field( |
|
| 441 | - 'xcloner_files_to_process_per_request', |
|
| 442 | - __('Files To Process Per Request','xcloner-backup-and-restore'), |
|
| 443 | - array($this, 'do_form_range_field'), |
|
| 444 | - 'xcloner_system_settings_page', |
|
| 445 | - 'xcloner_system_settings_group', |
|
| 446 | - array('xcloner_files_to_process_per_request', |
|
| 447 | - __('Use this option to set how many files XCloner should process at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 448 | - 0, |
|
| 449 | - 1000 |
|
| 450 | - ) |
|
| 451 | - ); |
|
| 440 | + add_settings_field( |
|
| 441 | + 'xcloner_files_to_process_per_request', |
|
| 442 | + __('Files To Process Per Request','xcloner-backup-and-restore'), |
|
| 443 | + array($this, 'do_form_range_field'), |
|
| 444 | + 'xcloner_system_settings_page', |
|
| 445 | + 'xcloner_system_settings_group', |
|
| 446 | + array('xcloner_files_to_process_per_request', |
|
| 447 | + __('Use this option to set how many files XCloner should process at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 448 | + 0, |
|
| 449 | + 1000 |
|
| 450 | + ) |
|
| 451 | + ); |
|
| 452 | 452 | |
| 453 | 453 | register_setting('xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 454 | - add_settings_field( |
|
| 455 | - 'xcloner_directories_to_scan_per_request', |
|
| 456 | - __('Directories To Scan Per Request','xcloner-backup-and-restore'), |
|
| 457 | - array($this, 'do_form_range_field'), |
|
| 458 | - 'xcloner_system_settings_page', |
|
| 459 | - 'xcloner_system_settings_group', |
|
| 460 | - array('xcloner_directories_to_scan_per_request', |
|
| 461 | - __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 462 | - 0, |
|
| 463 | - 1000 |
|
| 464 | - ) |
|
| 465 | - ); |
|
| 454 | + add_settings_field( |
|
| 455 | + 'xcloner_directories_to_scan_per_request', |
|
| 456 | + __('Directories To Scan Per Request','xcloner-backup-and-restore'), |
|
| 457 | + array($this, 'do_form_range_field'), |
|
| 458 | + 'xcloner_system_settings_page', |
|
| 459 | + 'xcloner_system_settings_group', |
|
| 460 | + array('xcloner_directories_to_scan_per_request', |
|
| 461 | + __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 462 | + 0, |
|
| 463 | + 1000 |
|
| 464 | + ) |
|
| 465 | + ); |
|
| 466 | 466 | |
| 467 | 467 | register_setting('xcloner_system_settings_group', 'xcloner_database_records_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 468 | - add_settings_field( |
|
| 469 | - 'xcloner_database_records_per_request', |
|
| 470 | - __('Database Records Per Request','xcloner-backup-and-restore'), |
|
| 471 | - array($this, 'do_form_range_field'), |
|
| 472 | - 'xcloner_system_settings_page', |
|
| 473 | - 'xcloner_system_settings_group', |
|
| 474 | - array('xcloner_database_records_per_request', |
|
| 475 | - __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records','xcloner-backup-and-restore'), |
|
| 476 | - 0, |
|
| 477 | - 100000 |
|
| 478 | - ) |
|
| 479 | - ); |
|
| 468 | + add_settings_field( |
|
| 469 | + 'xcloner_database_records_per_request', |
|
| 470 | + __('Database Records Per Request','xcloner-backup-and-restore'), |
|
| 471 | + array($this, 'do_form_range_field'), |
|
| 472 | + 'xcloner_system_settings_page', |
|
| 473 | + 'xcloner_system_settings_group', |
|
| 474 | + array('xcloner_database_records_per_request', |
|
| 475 | + __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records','xcloner-backup-and-restore'), |
|
| 476 | + 0, |
|
| 477 | + 100000 |
|
| 478 | + ) |
|
| 479 | + ); |
|
| 480 | 480 | |
| 481 | 481 | /*register_setting('xcloner_system_settings_group', 'xcloner_diff_backup_recreate_period', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 482 | 482 | add_settings_field( |
@@ -491,102 +491,102 @@ discard block |
||
| 491 | 491 | );*/ |
| 492 | 492 | |
| 493 | 493 | register_setting('xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 494 | - add_settings_field( |
|
| 495 | - 'xcloner_exclude_files_larger_than_mb', |
|
| 496 | - __('Exclude files larger than (MB)','xcloner-backup-and-restore'), |
|
| 497 | - array($this, 'do_form_number_field'), |
|
| 498 | - 'xcloner_system_settings_page', |
|
| 499 | - 'xcloner_system_settings_group', |
|
| 500 | - array('xcloner_exclude_files_larger_than_mb', |
|
| 501 | - __('Use this option to automatically exclude files larger than a certain size in MB, or set to 0 to include all. Range 0-1000 MB','xcloner-backup-and-restore'), |
|
| 502 | - ) |
|
| 503 | - ); |
|
| 494 | + add_settings_field( |
|
| 495 | + 'xcloner_exclude_files_larger_than_mb', |
|
| 496 | + __('Exclude files larger than (MB)','xcloner-backup-and-restore'), |
|
| 497 | + array($this, 'do_form_number_field'), |
|
| 498 | + 'xcloner_system_settings_page', |
|
| 499 | + 'xcloner_system_settings_group', |
|
| 500 | + array('xcloner_exclude_files_larger_than_mb', |
|
| 501 | + __('Use this option to automatically exclude files larger than a certain size in MB, or set to 0 to include all. Range 0-1000 MB','xcloner-backup-and-restore'), |
|
| 502 | + ) |
|
| 503 | + ); |
|
| 504 | 504 | |
| 505 | 505 | register_setting('xcloner_system_settings_group', 'xcloner_split_backup_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 506 | - add_settings_field( |
|
| 507 | - 'xcloner_split_backup_limit', |
|
| 508 | - __('Split Backup Archive Limit (MB)','xcloner-backup-and-restore'), |
|
| 509 | - array($this, 'do_form_number_field'), |
|
| 510 | - 'xcloner_system_settings_page', |
|
| 511 | - 'xcloner_system_settings_group', |
|
| 512 | - array('xcloner_split_backup_limit', |
|
| 513 | - __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB','xcloner-backup-and-restore'), |
|
| 514 | - ) |
|
| 515 | - ); |
|
| 506 | + add_settings_field( |
|
| 507 | + 'xcloner_split_backup_limit', |
|
| 508 | + __('Split Backup Archive Limit (MB)','xcloner-backup-and-restore'), |
|
| 509 | + array($this, 'do_form_number_field'), |
|
| 510 | + 'xcloner_system_settings_page', |
|
| 511 | + 'xcloner_system_settings_group', |
|
| 512 | + array('xcloner_split_backup_limit', |
|
| 513 | + __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB','xcloner-backup-and-restore'), |
|
| 514 | + ) |
|
| 515 | + ); |
|
| 516 | 516 | |
| 517 | - register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root'); |
|
| 518 | - add_settings_field( |
|
| 519 | - 'xcloner_force_tmp_path_site_root', |
|
| 520 | - __('Force Temporary Path Within XCloner Storage','xcloner-backup-and-restore'), |
|
| 521 | - array($this, 'do_form_switch_field'), |
|
| 522 | - 'xcloner_system_settings_page', |
|
| 523 | - 'xcloner_system_settings_group', |
|
| 524 | - array('xcloner_force_tmp_path_site_root', |
|
| 517 | + register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root'); |
|
| 518 | + add_settings_field( |
|
| 519 | + 'xcloner_force_tmp_path_site_root', |
|
| 520 | + __('Force Temporary Path Within XCloner Storage','xcloner-backup-and-restore'), |
|
| 521 | + array($this, 'do_form_switch_field'), |
|
| 522 | + 'xcloner_system_settings_page', |
|
| 523 | + 'xcloner_system_settings_group', |
|
| 524 | + array('xcloner_force_tmp_path_site_root', |
|
| 525 | 525 | sprintf(__('Enable this option if you want the XCloner Temporary Path to be within your XCloner Storage Location','xcloner-backup-and-restore'), $this->get_table_prefix()) |
| 526 | 526 | ) |
| 527 | - ); |
|
| 527 | + ); |
|
| 528 | 528 | |
| 529 | 529 | //REGISTERING THE 'CLEANUP SECTION' FIELDS |
| 530 | 530 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 531 | - add_settings_field( |
|
| 532 | - 'xcloner_cleanup_retention_limit_days', |
|
| 533 | - __('Cleanup by Date(days)','xcloner-backup-and-restore'), |
|
| 534 | - array($this, 'do_form_number_field'), |
|
| 535 | - 'xcloner_cleanup_settings_page', |
|
| 536 | - 'xcloner_cleanup_settings_group', |
|
| 537 | - array('xcloner_cleanup_retention_limit_days', |
|
| 531 | + add_settings_field( |
|
| 532 | + 'xcloner_cleanup_retention_limit_days', |
|
| 533 | + __('Cleanup by Date(days)','xcloner-backup-and-restore'), |
|
| 534 | + array($this, 'do_form_number_field'), |
|
| 535 | + 'xcloner_cleanup_settings_page', |
|
| 536 | + 'xcloner_cleanup_settings_group', |
|
| 537 | + array('xcloner_cleanup_retention_limit_days', |
|
| 538 | 538 | __('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option','xcloner-backup-and-restore') |
| 539 | 539 | ) |
| 540 | - ); |
|
| 540 | + ); |
|
| 541 | 541 | |
| 542 | 542 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 543 | - add_settings_field( |
|
| 544 | - 'xcloner_cleanup_retention_limit_archives', |
|
| 545 | - __('Cleanup by Quantity','xcloner-backup-and-restore'), |
|
| 546 | - array($this, 'do_form_number_field'), |
|
| 547 | - 'xcloner_cleanup_settings_page', |
|
| 548 | - 'xcloner_cleanup_settings_group', |
|
| 549 | - array('xcloner_cleanup_retention_limit_archives', |
|
| 543 | + add_settings_field( |
|
| 544 | + 'xcloner_cleanup_retention_limit_archives', |
|
| 545 | + __('Cleanup by Quantity','xcloner-backup-and-restore'), |
|
| 546 | + array($this, 'do_form_number_field'), |
|
| 547 | + 'xcloner_cleanup_settings_page', |
|
| 548 | + 'xcloner_cleanup_settings_group', |
|
| 549 | + array('xcloner_cleanup_retention_limit_archives', |
|
| 550 | 550 | __('Specify the maximum number of backup archives to keep on the server. 0 disables this option','xcloner-backup-and-restore') |
| 551 | 551 | ) |
| 552 | - ); |
|
| 552 | + ); |
|
| 553 | 553 | |
| 554 | 554 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 555 | - add_settings_field( |
|
| 556 | - 'xcloner_cleanup_capacity_limit', |
|
| 557 | - __('Cleanup by Capacity(MB)','xcloner-backup-and-restore'), |
|
| 558 | - array($this, 'do_form_number_field'), |
|
| 559 | - 'xcloner_cleanup_settings_page', |
|
| 560 | - 'xcloner_cleanup_settings_group', |
|
| 561 | - array('xcloner_cleanup_capacity_limit', |
|
| 555 | + add_settings_field( |
|
| 556 | + 'xcloner_cleanup_capacity_limit', |
|
| 557 | + __('Cleanup by Capacity(MB)','xcloner-backup-and-restore'), |
|
| 558 | + array($this, 'do_form_number_field'), |
|
| 559 | + 'xcloner_cleanup_settings_page', |
|
| 560 | + 'xcloner_cleanup_settings_group', |
|
| 561 | + array('xcloner_cleanup_capacity_limit', |
|
| 562 | 562 | __('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option','xcloner-backup-and-restore') |
| 563 | 563 | ) |
| 564 | - ); |
|
| 564 | + ); |
|
| 565 | 565 | |
| 566 | - register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_delete_after_remote_transfer', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 567 | - add_settings_field( |
|
| 568 | - 'xcloner_cleanup_delete_after_remote_transfer', |
|
| 569 | - __('Delete Backup After Sending it to Remote Storage','xcloner-backup-and-restore'), |
|
| 570 | - array($this, 'do_form_switch_field'), |
|
| 571 | - 'xcloner_cleanup_settings_page', |
|
| 572 | - 'xcloner_cleanup_settings_group', |
|
| 573 | - array('xcloner_cleanup_delete_after_remote_transfer', |
|
| 566 | + register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_delete_after_remote_transfer', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 567 | + add_settings_field( |
|
| 568 | + 'xcloner_cleanup_delete_after_remote_transfer', |
|
| 569 | + __('Delete Backup After Sending it to Remote Storage','xcloner-backup-and-restore'), |
|
| 570 | + array($this, 'do_form_switch_field'), |
|
| 571 | + 'xcloner_cleanup_settings_page', |
|
| 572 | + 'xcloner_cleanup_settings_group', |
|
| 573 | + array('xcloner_cleanup_delete_after_remote_transfer', |
|
| 574 | 574 | __('Remove backups created automatically from local storage after sending the backup to remote storage','xcloner-backup-and-restore') |
| 575 | 575 | ) |
| 576 | - ); |
|
| 576 | + ); |
|
| 577 | 577 | |
| 578 | 578 | //REGISTERING THE 'CRON SECTION' FIELDS |
| 579 | 579 | register_setting('xcloner_cron_settings_group', 'xcloner_cron_frequency'); |
| 580 | - add_settings_field( |
|
| 581 | - 'xcloner_cron_frequency', |
|
| 582 | - __('Cron frequency','xcloner-backup-and-restore'), |
|
| 583 | - array($this, 'do_form_text_field'), |
|
| 584 | - 'xcloner_cron_settings_page', |
|
| 585 | - 'xcloner_cron_settings_group', |
|
| 586 | - array('xcloner_cron_frequency', |
|
| 580 | + add_settings_field( |
|
| 581 | + 'xcloner_cron_frequency', |
|
| 582 | + __('Cron frequency','xcloner-backup-and-restore'), |
|
| 583 | + array($this, 'do_form_text_field'), |
|
| 584 | + 'xcloner_cron_settings_page', |
|
| 585 | + 'xcloner_cron_settings_group', |
|
| 586 | + array('xcloner_cron_frequency', |
|
| 587 | 587 | __('Cron frequency') |
| 588 | 588 | ) |
| 589 | - ); |
|
| 589 | + ); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | // section content cb |
| 600 | 600 | public function xcloner_settings_section_cb() |
| 601 | 601 | { |
| 602 | - //echo '<p>WPOrg Section Introduction.</p>'; |
|
| 602 | + //echo '<p>WPOrg Section Introduction.</p>'; |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | // text field content cb |
@@ -614,8 +614,8 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | if(!$value) |
| 616 | 616 | $value = get_option($fieldname); |
| 617 | - // output the field |
|
| 618 | - ?> |
|
| 617 | + // output the field |
|
| 618 | + ?> |
|
| 619 | 619 | <div class="row"> |
| 620 | 620 | <div class="input-field col s10 m10 l8"> |
| 621 | 621 | <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
@@ -641,8 +641,8 @@ discard block |
||
| 641 | 641 | |
| 642 | 642 | if(!$value) |
| 643 | 643 | $value = get_option($fieldname); |
| 644 | - // output the field |
|
| 645 | - ?> |
|
| 644 | + // output the field |
|
| 645 | + ?> |
|
| 646 | 646 | <div class="row"> |
| 647 | 647 | <div class="input-field col s10 m10 l8"> |
| 648 | 648 | <textarea class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value=""><?php echo isset($value) ? esc_attr($value) : ''; ?></textarea> |
@@ -685,8 +685,8 @@ discard block |
||
| 685 | 685 | |
| 686 | 686 | if(!$value) |
| 687 | 687 | $value = get_option($fieldname); |
| 688 | - // output the field |
|
| 689 | - ?> |
|
| 688 | + // output the field |
|
| 689 | + ?> |
|
| 690 | 690 | <div class="row"> |
| 691 | 691 | <div class="input-field col s10 m5 l3"> |
| 692 | 692 | <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="number" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
@@ -4,14 +4,14 @@ discard block |
||
| 4 | 4 | { |
| 5 | 5 | private $logger_file = "xcloner_main_%s.log"; |
| 6 | 6 | private $logger_file_hash = "xcloner%s.log"; |
| 7 | - private $hash ; |
|
| 7 | + private $hash; |
|
| 8 | 8 | private $xcloner_sanitization; |
| 9 | 9 | private $xcloner_container; |
| 10 | 10 | |
| 11 | 11 | public function __construct(Xcloner $xcloner_container, $hash = "") |
| 12 | 12 | { |
| 13 | 13 | $this->xcloner_container = $xcloner_container; |
| 14 | - if(isset($hash)) |
|
| 14 | + if (isset($hash)) |
|
| 15 | 15 | $this->set_hash($hash); |
| 16 | 16 | } |
| 17 | 17 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function get_logger_filename($include_hash = 0) |
| 24 | 24 | { |
| 25 | - if($include_hash) |
|
| 25 | + if ($include_hash) |
|
| 26 | 26 | $filename = sprintf($this->logger_file_hash, $this->get_hash()); |
| 27 | 27 | else |
| 28 | 28 | $filename = sprintf($this->logger_file, $this->get_server_unique_hash(5)); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function get_xcloner_start_path() |
| 34 | 34 | { |
| 35 | - if(!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path'))) |
|
| 35 | + if (!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path'))) |
|
| 36 | 36 | $path = realpath(ABSPATH); |
| 37 | 37 | else |
| 38 | 38 | $path = get_option('xcloner_start_path'); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function get_xcloner_store_path() |
| 51 | 51 | { |
| 52 | - if(!get_option('xcloner_store_path') or !is_dir(get_option('xcloner_store_path'))) |
|
| 52 | + if (!get_option('xcloner_store_path') or !is_dir(get_option('xcloner_store_path'))) |
|
| 53 | 53 | $path = realpath(XCLONER_STORAGE_PATH); |
| 54 | 54 | else |
| 55 | 55 | $path = get_option('xcloner_store_path'); |
@@ -66,18 +66,18 @@ discard block |
||
| 66 | 66 | public function get_xcloner_tmp_path($suffix = true) |
| 67 | 67 | { |
| 68 | 68 | $path = sys_get_temp_dir(); |
| 69 | - if(!is_dir($path)) |
|
| 69 | + if (!is_dir($path)) |
|
| 70 | 70 | { |
| 71 | 71 | @mkdir($path); |
| 72 | 72 | @chmod($path, 0777); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if(!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root')) |
|
| 75 | + if (!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root')) |
|
| 76 | 76 | { |
| 77 | 77 | $path = $this->get_xcloner_store_path(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if($suffix) |
|
| 80 | + if ($suffix) |
|
| 81 | 81 | { |
| 82 | 82 | $path = $path.DS.".".$this->get_xcloner_tmp_path_suffix(); |
| 83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | public function get_enable_mysql_backup() |
| 89 | 89 | { |
| 90 | - if(get_option('xcloner_enable_mysql_backup')) |
|
| 90 | + if (get_option('xcloner_enable_mysql_backup')) |
|
| 91 | 91 | return true; |
| 92 | 92 | |
| 93 | 93 | return false; |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public function get_backup_extension_name($ext = "") |
| 97 | 97 | { |
| 98 | - if(!$ext) |
|
| 98 | + if (!$ext) |
|
| 99 | 99 | { |
| 100 | - if(get_option('xcloner_backup_compression_level')) |
|
| 100 | + if (get_option('xcloner_backup_compression_level')) |
|
| 101 | 101 | $ext = ".tgz"; |
| 102 | 102 | else |
| 103 | 103 | $ext = ".tar"; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | public function get_hash() |
| 109 | 109 | { |
| 110 | - if(!$this->hash){ |
|
| 110 | + if (!$this->hash) { |
|
| 111 | 111 | $this->set_hash("-".$this->get_server_unique_hash(5)); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -119,17 +119,17 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $hash = "-".md5(rand()); |
| 121 | 121 | |
| 122 | - $this->set_hash(substr( $hash, 0, 6)); |
|
| 122 | + $this->set_hash(substr($hash, 0, 6)); |
|
| 123 | 123 | |
| 124 | 124 | return $hash; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | public function set_hash($hash = "") |
| 128 | 128 | { |
| 129 | - if(substr($hash, 0, 1) != "-" and strlen($hash)) |
|
| 129 | + if (substr($hash, 0, 1) != "-" and strlen($hash)) |
|
| 130 | 130 | $hash = "-".$hash; |
| 131 | 131 | |
| 132 | - $this->hash = substr( $hash, 0, 6); |
|
| 132 | + $this->hash = substr($hash, 0, 6); |
|
| 133 | 133 | |
| 134 | 134 | return $this; |
| 135 | 135 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $data = parse_url(get_site_url()); |
| 140 | 140 | |
| 141 | - $backup_name = "backup_[domain]".(isset($data['port'])?"_".$data['port']:"")."-[time]-".($this->get_enable_mysql_backup()?"sql":"nosql"); |
|
| 141 | + $backup_name = "backup_[domain]".(isset($data['port']) ? "_".$data['port'] : "")."-[time]-".($this->get_enable_mysql_backup() ? "sql" : "nosql"); |
|
| 142 | 142 | |
| 143 | 143 | return $backup_name; |
| 144 | 144 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | global $wpdb; |
| 149 | 149 | |
| 150 | - if(!$data = get_option('xcloner_mysql_hostname')) |
|
| 150 | + if (!$data = get_option('xcloner_mysql_hostname')) |
|
| 151 | 151 | $data = $wpdb->dbhost; |
| 152 | 152 | |
| 153 | 153 | return $data; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | { |
| 158 | 158 | global $wpdb; |
| 159 | 159 | |
| 160 | - if(!$data = get_option('xcloner_mysql_username')) |
|
| 160 | + if (!$data = get_option('xcloner_mysql_username')) |
|
| 161 | 161 | $data = $wpdb->dbuser; |
| 162 | 162 | |
| 163 | 163 | return $data; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | global $wpdb; |
| 169 | 169 | |
| 170 | - if(!$data = get_option('xcloner_mysql_password')) |
|
| 170 | + if (!$data = get_option('xcloner_mysql_password')) |
|
| 171 | 171 | $data = $wpdb->dbpassword; |
| 172 | 172 | |
| 173 | 173 | return $data; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | { |
| 178 | 178 | global $wpdb; |
| 179 | 179 | |
| 180 | - if(!$data = get_option('xcloner_mysql_database')) |
|
| 180 | + if (!$data = get_option('xcloner_mysql_database')) |
|
| 181 | 181 | $data = $wpdb->dbname; |
| 182 | 182 | |
| 183 | 183 | return $data; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $hash = md5(get_home_url().__DIR__); |
| 203 | 203 | |
| 204 | - if($strlen) |
|
| 204 | + if ($strlen) |
|
| 205 | 205 | $hash = substr($hash, 0, $strlen); |
| 206 | 206 | |
| 207 | 207 | return $hash; |
@@ -213,20 +213,20 @@ discard block |
||
| 213 | 213 | $this->xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
| 214 | 214 | |
| 215 | 215 | //ADDING MISSING OPTIONS |
| 216 | - if( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
|
| 217 | - add_option( 'xcloner_mysql_settings_page' ); |
|
| 216 | + if (false == get_option('xcloner_mysql_settings_page')) { |
|
| 217 | + add_option('xcloner_mysql_settings_page'); |
|
| 218 | 218 | } // end if |
| 219 | 219 | |
| 220 | - if( false == get_option( 'xcloner_cron_settings_page' ) ) { |
|
| 221 | - add_option( 'xcloner_cron_settings_page' ); |
|
| 220 | + if (false == get_option('xcloner_cron_settings_page')) { |
|
| 221 | + add_option('xcloner_cron_settings_page'); |
|
| 222 | 222 | } // end if |
| 223 | 223 | |
| 224 | - if( false == get_option( 'xcloner_system_settings_page' ) ) { |
|
| 225 | - add_option( 'xcloner_system_settings_page' ); |
|
| 224 | + if (false == get_option('xcloner_system_settings_page')) { |
|
| 225 | + add_option('xcloner_system_settings_page'); |
|
| 226 | 226 | } // end if |
| 227 | 227 | |
| 228 | - if( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
|
| 229 | - add_option( 'xcloner_cleanup_settings_page' ); |
|
| 228 | + if (false == get_option('xcloner_cleanup_settings_page')) { |
|
| 229 | + add_option('xcloner_cleanup_settings_page'); |
|
| 230 | 230 | } // end if |
| 231 | 231 | |
| 232 | 232 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | //SYSTEM section |
| 250 | 250 | add_settings_section( |
| 251 | 251 | 'xcloner_system_settings_group', |
| 252 | - __('These are advanced options recommended for developers!','xcloner-backup-and-restore'), |
|
| 252 | + __('These are advanced options recommended for developers!', 'xcloner-backup-and-restore'), |
|
| 253 | 253 | array($this, 'xcloner_settings_section_cb'), |
| 254 | 254 | 'xcloner_system_settings_page' |
| 255 | 255 | ); |
@@ -277,12 +277,12 @@ discard block |
||
| 277 | 277 | register_setting('xcloner_general_settings_group', 'xcloner_backup_compression_level', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 278 | 278 | add_settings_field( |
| 279 | 279 | 'xcloner_backup_compression_level', |
| 280 | - __('Backup Compression Level','xcloner-backup-and-restore'), |
|
| 280 | + __('Backup Compression Level', 'xcloner-backup-and-restore'), |
|
| 281 | 281 | array($this, 'do_form_range_field'), |
| 282 | 282 | 'xcloner_settings_page', |
| 283 | 283 | 'xcloner_general_settings_group', |
| 284 | 284 | array('xcloner_backup_compression_level', |
| 285 | - __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load','xcloner-backup-and-restore'), |
|
| 285 | + __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load', 'xcloner-backup-and-restore'), |
|
| 286 | 286 | 0, |
| 287 | 287 | 9 |
| 288 | 288 | ) |
@@ -291,12 +291,12 @@ discard block |
||
| 291 | 291 | register_setting('xcloner_general_settings_group', 'xcloner_start_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
| 292 | 292 | add_settings_field( |
| 293 | 293 | 'xcloner_start_path', |
| 294 | - __('Backup Start Location','xcloner-backup-and-restore'), |
|
| 294 | + __('Backup Start Location', 'xcloner-backup-and-restore'), |
|
| 295 | 295 | array($this, 'do_form_text_field'), |
| 296 | 296 | 'xcloner_settings_page', |
| 297 | 297 | 'xcloner_general_settings_group', |
| 298 | 298 | array('xcloner_start_path', |
| 299 | - __('Base path location from where XCloner can start the Backup.','xcloner-backup-and-restore'), |
|
| 299 | + __('Base path location from where XCloner can start the Backup.', 'xcloner-backup-and-restore'), |
|
| 300 | 300 | $this->get_xcloner_start_path(), |
| 301 | 301 | //'disabled' |
| 302 | 302 | ) |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | register_setting('xcloner_general_settings_group', 'xcloner_store_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
| 306 | 306 | add_settings_field( |
| 307 | 307 | 'xcloner_store_path', |
| 308 | - __('Backup Storage Location','xcloner-backup-and-restore'), |
|
| 308 | + __('Backup Storage Location', 'xcloner-backup-and-restore'), |
|
| 309 | 309 | array($this, 'do_form_text_field'), |
| 310 | 310 | 'xcloner_settings_page', |
| 311 | 311 | 'xcloner_general_settings_group', |
| 312 | 312 | array('xcloner_store_path', |
| 313 | - __('Location where XCloner will store the Backup archives.','xcloner-backup-and-restore'), |
|
| 313 | + __('Location where XCloner will store the Backup archives.', 'xcloner-backup-and-restore'), |
|
| 314 | 314 | $this->get_xcloner_store_path(), |
| 315 | 315 | //'disabled' |
| 316 | 316 | ) |
@@ -319,36 +319,36 @@ discard block |
||
| 319 | 319 | register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 320 | 320 | add_settings_field( |
| 321 | 321 | 'xcloner_enable_log', |
| 322 | - __('Enable XCloner Backup Log','xcloner-backup-and-restore'), |
|
| 322 | + __('Enable XCloner Backup Log', 'xcloner-backup-and-restore'), |
|
| 323 | 323 | array($this, 'do_form_switch_field'), |
| 324 | 324 | 'xcloner_settings_page', |
| 325 | 325 | 'xcloner_general_settings_group', |
| 326 | 326 | array('xcloner_enable_log', |
| 327 | - sprintf(__('Enable the XCloner Backup log. You will find it stored unde the Backup Storage Location, file %s','xcloner-backup-and-restore'), $this->get_logger_filename()) |
|
| 327 | + sprintf(__('Enable the XCloner Backup log. You will find it stored unde the Backup Storage Location, file %s', 'xcloner-backup-and-restore'), $this->get_logger_filename()) |
|
| 328 | 328 | ) |
| 329 | 329 | ); |
| 330 | 330 | |
| 331 | 331 | register_setting('xcloner_general_settings_group', 'xcloner_enable_pre_update_backup', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 332 | 332 | add_settings_field( |
| 333 | 333 | 'xcloner_enable_pre_update_backup', |
| 334 | - __('Generate Backups before Automatic WP Upgrades','xcloner-backup-and-restore'), |
|
| 334 | + __('Generate Backups before Automatic WP Upgrades', 'xcloner-backup-and-restore'), |
|
| 335 | 335 | array($this, 'do_form_switch_field'), |
| 336 | 336 | 'xcloner_settings_page', |
| 337 | 337 | 'xcloner_general_settings_group', |
| 338 | 338 | array('xcloner_enable_pre_update_backup', |
| 339 | - sprintf(__('Attempt to generate a core, plugins, themes or languages files backup before the automatic update of Wordpress core, plugins, themes or languages files.','xcloner-backup-and-restore'), $this->get_logger_filename()) |
|
| 339 | + sprintf(__('Attempt to generate a core, plugins, themes or languages files backup before the automatic update of Wordpress core, plugins, themes or languages files.', 'xcloner-backup-and-restore'), $this->get_logger_filename()) |
|
| 340 | 340 | ) |
| 341 | 341 | ); |
| 342 | 342 | |
| 343 | 343 | register_setting('xcloner_general_settings_group', 'xcloner_regex_exclude', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 344 | 344 | add_settings_field( |
| 345 | 345 | 'xcloner_regex_exclude', |
| 346 | - __('Regex Exclude Files','xcloner-backup-and-restore'), |
|
| 346 | + __('Regex Exclude Files', 'xcloner-backup-and-restore'), |
|
| 347 | 347 | array($this, 'do_form_textarea_field'), |
| 348 | 348 | 'xcloner_settings_page', |
| 349 | 349 | 'xcloner_general_settings_group', |
| 350 | 350 | array('xcloner_regex_exclude', |
| 351 | - __('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line','xcloner-backup-and-restore'), |
|
| 351 | + __('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line', 'xcloner-backup-and-restore'), |
|
| 352 | 352 | //$this->get_xcloner_store_path(), |
| 353 | 353 | //'disabled' |
| 354 | 354 | ) |
@@ -358,36 +358,36 @@ discard block |
||
| 358 | 358 | register_setting('xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 359 | 359 | add_settings_field( |
| 360 | 360 | 'xcloner_enable_mysql_backup', |
| 361 | - __('Enable Mysql Backup','xcloner-backup-and-restore'), |
|
| 361 | + __('Enable Mysql Backup', 'xcloner-backup-and-restore'), |
|
| 362 | 362 | array($this, 'do_form_switch_field'), |
| 363 | 363 | 'xcloner_mysql_settings_page', |
| 364 | 364 | 'xcloner_mysql_settings_group', |
| 365 | 365 | array('xcloner_enable_mysql_backup', |
| 366 | - __('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.','xcloner-backup-and-restore') |
|
| 366 | + __('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.', 'xcloner-backup-and-restore') |
|
| 367 | 367 | ) |
| 368 | 368 | ); |
| 369 | 369 | |
| 370 | 370 | register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables'); |
| 371 | 371 | add_settings_field( |
| 372 | 372 | 'xcloner_backup_only_wp_tables', |
| 373 | - __('Backup only WP tables','xcloner-backup-and-restore'), |
|
| 373 | + __('Backup only WP tables', 'xcloner-backup-and-restore'), |
|
| 374 | 374 | array($this, 'do_form_switch_field'), |
| 375 | 375 | 'xcloner_mysql_settings_page', |
| 376 | 376 | 'xcloner_mysql_settings_group', |
| 377 | 377 | array('xcloner_backup_only_wp_tables', |
| 378 | - sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix','xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 378 | + sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix', 'xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 379 | 379 | ) |
| 380 | 380 | ); |
| 381 | 381 | |
| 382 | 382 | register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 383 | 383 | add_settings_field( |
| 384 | 384 | 'xcloner_mysql_hostname', |
| 385 | - __('Mysql Hostname','xcloner-backup-and-restore'), |
|
| 385 | + __('Mysql Hostname', 'xcloner-backup-and-restore'), |
|
| 386 | 386 | array($this, 'do_form_text_field'), |
| 387 | 387 | 'xcloner_mysql_settings_page', |
| 388 | 388 | 'xcloner_mysql_settings_group', |
| 389 | 389 | array('xcloner_mysql_hostname', |
| 390 | - __('Wordpress mysql hostname','xcloner-backup-and-restore'), |
|
| 390 | + __('Wordpress mysql hostname', 'xcloner-backup-and-restore'), |
|
| 391 | 391 | $this->get_db_hostname(), |
| 392 | 392 | 'disabled' |
| 393 | 393 | ) |
@@ -396,12 +396,12 @@ discard block |
||
| 396 | 396 | register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 397 | 397 | add_settings_field( |
| 398 | 398 | 'xcloner_mysql_username', |
| 399 | - __('Mysql Username','xcloner-backup-and-restore'), |
|
| 399 | + __('Mysql Username', 'xcloner-backup-and-restore'), |
|
| 400 | 400 | array($this, 'do_form_text_field'), |
| 401 | 401 | 'xcloner_mysql_settings_page', |
| 402 | 402 | 'xcloner_mysql_settings_group', |
| 403 | 403 | array('xcloner_mysql_username', |
| 404 | - __('Wordpress mysql username','xcloner-backup-and-restore'), |
|
| 404 | + __('Wordpress mysql username', 'xcloner-backup-and-restore'), |
|
| 405 | 405 | $this->get_db_username(), |
| 406 | 406 | 'disabled' |
| 407 | 407 | ) |
@@ -410,12 +410,12 @@ discard block |
||
| 410 | 410 | register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 411 | 411 | add_settings_field( |
| 412 | 412 | 'xcloner_mysql_database', |
| 413 | - __('Mysql Database','xcloner-backup-and-restore'), |
|
| 413 | + __('Mysql Database', 'xcloner-backup-and-restore'), |
|
| 414 | 414 | array($this, 'do_form_text_field'), |
| 415 | 415 | 'xcloner_mysql_settings_page', |
| 416 | 416 | 'xcloner_mysql_settings_group', |
| 417 | 417 | array('xcloner_mysql_database', |
| 418 | - __('Wordpress mysql database','xcloner-backup-and-restore'), |
|
| 418 | + __('Wordpress mysql database', 'xcloner-backup-and-restore'), |
|
| 419 | 419 | $this->get_db_database(), |
| 420 | 420 | 'disabled' |
| 421 | 421 | ) |
@@ -425,12 +425,12 @@ discard block |
||
| 425 | 425 | register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 426 | 426 | add_settings_field( |
| 427 | 427 | 'xcloner_size_limit_per_request', |
| 428 | - __('Data Size Limit Per Request','xcloner-backup-and-restore'), |
|
| 428 | + __('Data Size Limit Per Request', 'xcloner-backup-and-restore'), |
|
| 429 | 429 | array($this, 'do_form_range_field'), |
| 430 | 430 | 'xcloner_system_settings_page', |
| 431 | 431 | 'xcloner_system_settings_group', |
| 432 | 432 | array('xcloner_size_limit_per_request', |
| 433 | - __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB','xcloner-backup-and-restore'), |
|
| 433 | + __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB', 'xcloner-backup-and-restore'), |
|
| 434 | 434 | 0, |
| 435 | 435 | 1024 |
| 436 | 436 | ) |
@@ -439,12 +439,12 @@ discard block |
||
| 439 | 439 | register_setting('xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 440 | 440 | add_settings_field( |
| 441 | 441 | 'xcloner_files_to_process_per_request', |
| 442 | - __('Files To Process Per Request','xcloner-backup-and-restore'), |
|
| 442 | + __('Files To Process Per Request', 'xcloner-backup-and-restore'), |
|
| 443 | 443 | array($this, 'do_form_range_field'), |
| 444 | 444 | 'xcloner_system_settings_page', |
| 445 | 445 | 'xcloner_system_settings_group', |
| 446 | 446 | array('xcloner_files_to_process_per_request', |
| 447 | - __('Use this option to set how many files XCloner should process at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 447 | + __('Use this option to set how many files XCloner should process at one time before doing another AJAX call', 'xcloner-backup-and-restore'), |
|
| 448 | 448 | 0, |
| 449 | 449 | 1000 |
| 450 | 450 | ) |
@@ -453,12 +453,12 @@ discard block |
||
| 453 | 453 | register_setting('xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 454 | 454 | add_settings_field( |
| 455 | 455 | 'xcloner_directories_to_scan_per_request', |
| 456 | - __('Directories To Scan Per Request','xcloner-backup-and-restore'), |
|
| 456 | + __('Directories To Scan Per Request', 'xcloner-backup-and-restore'), |
|
| 457 | 457 | array($this, 'do_form_range_field'), |
| 458 | 458 | 'xcloner_system_settings_page', |
| 459 | 459 | 'xcloner_system_settings_group', |
| 460 | 460 | array('xcloner_directories_to_scan_per_request', |
| 461 | - __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 461 | + __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call', 'xcloner-backup-and-restore'), |
|
| 462 | 462 | 0, |
| 463 | 463 | 1000 |
| 464 | 464 | ) |
@@ -467,12 +467,12 @@ discard block |
||
| 467 | 467 | register_setting('xcloner_system_settings_group', 'xcloner_database_records_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 468 | 468 | add_settings_field( |
| 469 | 469 | 'xcloner_database_records_per_request', |
| 470 | - __('Database Records Per Request','xcloner-backup-and-restore'), |
|
| 470 | + __('Database Records Per Request', 'xcloner-backup-and-restore'), |
|
| 471 | 471 | array($this, 'do_form_range_field'), |
| 472 | 472 | 'xcloner_system_settings_page', |
| 473 | 473 | 'xcloner_system_settings_group', |
| 474 | 474 | array('xcloner_database_records_per_request', |
| 475 | - __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records','xcloner-backup-and-restore'), |
|
| 475 | + __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records', 'xcloner-backup-and-restore'), |
|
| 476 | 476 | 0, |
| 477 | 477 | 100000 |
| 478 | 478 | ) |
@@ -493,36 +493,36 @@ discard block |
||
| 493 | 493 | register_setting('xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 494 | 494 | add_settings_field( |
| 495 | 495 | 'xcloner_exclude_files_larger_than_mb', |
| 496 | - __('Exclude files larger than (MB)','xcloner-backup-and-restore'), |
|
| 496 | + __('Exclude files larger than (MB)', 'xcloner-backup-and-restore'), |
|
| 497 | 497 | array($this, 'do_form_number_field'), |
| 498 | 498 | 'xcloner_system_settings_page', |
| 499 | 499 | 'xcloner_system_settings_group', |
| 500 | 500 | array('xcloner_exclude_files_larger_than_mb', |
| 501 | - __('Use this option to automatically exclude files larger than a certain size in MB, or set to 0 to include all. Range 0-1000 MB','xcloner-backup-and-restore'), |
|
| 501 | + __('Use this option to automatically exclude files larger than a certain size in MB, or set to 0 to include all. Range 0-1000 MB', 'xcloner-backup-and-restore'), |
|
| 502 | 502 | ) |
| 503 | 503 | ); |
| 504 | 504 | |
| 505 | 505 | register_setting('xcloner_system_settings_group', 'xcloner_split_backup_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 506 | 506 | add_settings_field( |
| 507 | 507 | 'xcloner_split_backup_limit', |
| 508 | - __('Split Backup Archive Limit (MB)','xcloner-backup-and-restore'), |
|
| 508 | + __('Split Backup Archive Limit (MB)', 'xcloner-backup-and-restore'), |
|
| 509 | 509 | array($this, 'do_form_number_field'), |
| 510 | 510 | 'xcloner_system_settings_page', |
| 511 | 511 | 'xcloner_system_settings_group', |
| 512 | 512 | array('xcloner_split_backup_limit', |
| 513 | - __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB','xcloner-backup-and-restore'), |
|
| 513 | + __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB', 'xcloner-backup-and-restore'), |
|
| 514 | 514 | ) |
| 515 | 515 | ); |
| 516 | 516 | |
| 517 | 517 | register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root'); |
| 518 | 518 | add_settings_field( |
| 519 | 519 | 'xcloner_force_tmp_path_site_root', |
| 520 | - __('Force Temporary Path Within XCloner Storage','xcloner-backup-and-restore'), |
|
| 520 | + __('Force Temporary Path Within XCloner Storage', 'xcloner-backup-and-restore'), |
|
| 521 | 521 | array($this, 'do_form_switch_field'), |
| 522 | 522 | 'xcloner_system_settings_page', |
| 523 | 523 | 'xcloner_system_settings_group', |
| 524 | 524 | array('xcloner_force_tmp_path_site_root', |
| 525 | - sprintf(__('Enable this option if you want the XCloner Temporary Path to be within your XCloner Storage Location','xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 525 | + sprintf(__('Enable this option if you want the XCloner Temporary Path to be within your XCloner Storage Location', 'xcloner-backup-and-restore'), $this->get_table_prefix()) |
|
| 526 | 526 | ) |
| 527 | 527 | ); |
| 528 | 528 | |
@@ -530,48 +530,48 @@ discard block |
||
| 530 | 530 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 531 | 531 | add_settings_field( |
| 532 | 532 | 'xcloner_cleanup_retention_limit_days', |
| 533 | - __('Cleanup by Date(days)','xcloner-backup-and-restore'), |
|
| 533 | + __('Cleanup by Date(days)', 'xcloner-backup-and-restore'), |
|
| 534 | 534 | array($this, 'do_form_number_field'), |
| 535 | 535 | 'xcloner_cleanup_settings_page', |
| 536 | 536 | 'xcloner_cleanup_settings_group', |
| 537 | 537 | array('xcloner_cleanup_retention_limit_days', |
| 538 | - __('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option','xcloner-backup-and-restore') |
|
| 538 | + __('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option', 'xcloner-backup-and-restore') |
|
| 539 | 539 | ) |
| 540 | 540 | ); |
| 541 | 541 | |
| 542 | 542 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 543 | 543 | add_settings_field( |
| 544 | 544 | 'xcloner_cleanup_retention_limit_archives', |
| 545 | - __('Cleanup by Quantity','xcloner-backup-and-restore'), |
|
| 545 | + __('Cleanup by Quantity', 'xcloner-backup-and-restore'), |
|
| 546 | 546 | array($this, 'do_form_number_field'), |
| 547 | 547 | 'xcloner_cleanup_settings_page', |
| 548 | 548 | 'xcloner_cleanup_settings_group', |
| 549 | 549 | array('xcloner_cleanup_retention_limit_archives', |
| 550 | - __('Specify the maximum number of backup archives to keep on the server. 0 disables this option','xcloner-backup-and-restore') |
|
| 550 | + __('Specify the maximum number of backup archives to keep on the server. 0 disables this option', 'xcloner-backup-and-restore') |
|
| 551 | 551 | ) |
| 552 | 552 | ); |
| 553 | 553 | |
| 554 | 554 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 555 | 555 | add_settings_field( |
| 556 | 556 | 'xcloner_cleanup_capacity_limit', |
| 557 | - __('Cleanup by Capacity(MB)','xcloner-backup-and-restore'), |
|
| 557 | + __('Cleanup by Capacity(MB)', 'xcloner-backup-and-restore'), |
|
| 558 | 558 | array($this, 'do_form_number_field'), |
| 559 | 559 | 'xcloner_cleanup_settings_page', |
| 560 | 560 | 'xcloner_cleanup_settings_group', |
| 561 | 561 | array('xcloner_cleanup_capacity_limit', |
| 562 | - __('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option','xcloner-backup-and-restore') |
|
| 562 | + __('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option', 'xcloner-backup-and-restore') |
|
| 563 | 563 | ) |
| 564 | 564 | ); |
| 565 | 565 | |
| 566 | 566 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_delete_after_remote_transfer', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 567 | 567 | add_settings_field( |
| 568 | 568 | 'xcloner_cleanup_delete_after_remote_transfer', |
| 569 | - __('Delete Backup After Sending it to Remote Storage','xcloner-backup-and-restore'), |
|
| 569 | + __('Delete Backup After Sending it to Remote Storage', 'xcloner-backup-and-restore'), |
|
| 570 | 570 | array($this, 'do_form_switch_field'), |
| 571 | 571 | 'xcloner_cleanup_settings_page', |
| 572 | 572 | 'xcloner_cleanup_settings_group', |
| 573 | 573 | array('xcloner_cleanup_delete_after_remote_transfer', |
| 574 | - __('Remove backups created automatically from local storage after sending the backup to remote storage','xcloner-backup-and-restore') |
|
| 574 | + __('Remove backups created automatically from local storage after sending the backup to remote storage', 'xcloner-backup-and-restore') |
|
| 575 | 575 | ) |
| 576 | 576 | ); |
| 577 | 577 | |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | register_setting('xcloner_cron_settings_group', 'xcloner_cron_frequency'); |
| 580 | 580 | add_settings_field( |
| 581 | 581 | 'xcloner_cron_frequency', |
| 582 | - __('Cron frequency','xcloner-backup-and-restore'), |
|
| 582 | + __('Cron frequency', 'xcloner-backup-and-restore'), |
|
| 583 | 583 | array($this, 'do_form_text_field'), |
| 584 | 584 | 'xcloner_cron_settings_page', |
| 585 | 585 | 'xcloner_cron_settings_group', |
@@ -605,20 +605,20 @@ discard block |
||
| 605 | 605 | // text field content cb |
| 606 | 606 | public function do_form_text_field($params) |
| 607 | 607 | { |
| 608 | - if(!isset($params['3'])) |
|
| 608 | + if (!isset($params['3'])) |
|
| 609 | 609 | $params[3] = 0; |
| 610 | - if(!isset($params['2'])) |
|
| 610 | + if (!isset($params['2'])) |
|
| 611 | 611 | $params[2] = 0; |
| 612 | 612 | |
| 613 | 613 | list($fieldname, $label, $value, $disabled) = $params; |
| 614 | 614 | |
| 615 | - if(!$value) |
|
| 615 | + if (!$value) |
|
| 616 | 616 | $value = get_option($fieldname); |
| 617 | 617 | // output the field |
| 618 | 618 | ?> |
| 619 | 619 | <div class="row"> |
| 620 | 620 | <div class="input-field col s10 m10 l8"> |
| 621 | - <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
|
| 621 | + <input class="validate" <?php echo ($disabled) ? "disabled" : ""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
|
| 622 | 622 | </div> |
| 623 | 623 | <div class="col s2 m2 "> |
| 624 | 624 | <a class="btn-floating tooltipped btn-small" data-position="left" data-delay="50" data-tooltip="<?php echo $label?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
@@ -632,20 +632,20 @@ discard block |
||
| 632 | 632 | // textarea field content cb |
| 633 | 633 | public function do_form_textarea_field($params) |
| 634 | 634 | { |
| 635 | - if(!isset($params['3'])) |
|
| 635 | + if (!isset($params['3'])) |
|
| 636 | 636 | $params[3] = 0; |
| 637 | - if(!isset($params['2'])) |
|
| 637 | + if (!isset($params['2'])) |
|
| 638 | 638 | $params[2] = 0; |
| 639 | 639 | |
| 640 | 640 | list($fieldname, $label, $value, $disabled) = $params; |
| 641 | 641 | |
| 642 | - if(!$value) |
|
| 642 | + if (!$value) |
|
| 643 | 643 | $value = get_option($fieldname); |
| 644 | 644 | // output the field |
| 645 | 645 | ?> |
| 646 | 646 | <div class="row"> |
| 647 | 647 | <div class="input-field col s10 m10 l8"> |
| 648 | - <textarea class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value=""><?php echo isset($value) ? esc_attr($value) : ''; ?></textarea> |
|
| 648 | + <textarea class="validate" <?php echo ($disabled) ? "disabled" : ""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value=""><?php echo isset($value) ? esc_attr($value) : ''; ?></textarea> |
|
| 649 | 649 | </div> |
| 650 | 650 | <div class="col s2 m2 "> |
| 651 | 651 | <a class="btn-floating tooltipped btn-small" data-position="center" data-html="true" data-delay="50" data-tooltip="<?php echo $label?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
@@ -676,20 +676,20 @@ discard block |
||
| 676 | 676 | // number field content cb |
| 677 | 677 | public function do_form_number_field($params) |
| 678 | 678 | { |
| 679 | - if(!isset($params['3'])) |
|
| 679 | + if (!isset($params['3'])) |
|
| 680 | 680 | $params[3] = 0; |
| 681 | - if(!isset($params['2'])) |
|
| 681 | + if (!isset($params['2'])) |
|
| 682 | 682 | $params[2] = 0; |
| 683 | 683 | |
| 684 | 684 | list($fieldname, $label, $value, $disabled) = $params; |
| 685 | 685 | |
| 686 | - if(!$value) |
|
| 686 | + if (!$value) |
|
| 687 | 687 | $value = get_option($fieldname); |
| 688 | 688 | // output the field |
| 689 | 689 | ?> |
| 690 | 690 | <div class="row"> |
| 691 | 691 | <div class="input-field col s10 m5 l3"> |
| 692 | - <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="number" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
|
| 692 | + <input class="validate" <?php echo ($disabled) ? "disabled" : ""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="number" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
|
| 693 | 693 | </div> |
| 694 | 694 | <div class="col s2 m2 "> |
| 695 | 695 | <a class="btn-floating tooltipped btn-small" data-html="true" data-position="center" data-delay="50" data-tooltip="<?php echo $label?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | public function do_form_range_field($params) |
| 704 | 704 | { |
| 705 | - if(!isset($params['4'])) |
|
| 705 | + if (!isset($params['4'])) |
|
| 706 | 706 | $params[4] = 0; |
| 707 | 707 | |
| 708 | 708 | list($fieldname, $label, $range_start, $range_end, $disabled) = $params; |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | <div class="row"> |
| 712 | 712 | <div class="input-field col s10 m10 l8"> |
| 713 | 713 | <p class="range-field"> |
| 714 | - <input <?php echo ($disabled)?"disabled":""?> type="range" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" min="<?php echo $range_start?>" max="<?php echo $range_end?>" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>" /> |
|
| 714 | + <input <?php echo ($disabled) ? "disabled" : ""?> type="range" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" min="<?php echo $range_start?>" max="<?php echo $range_end?>" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>" /> |
|
| 715 | 715 | </p> |
| 716 | 716 | </div> |
| 717 | 717 | <div class="col s2 m2 "> |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | |
| 725 | 725 | public function do_form_switch_field($params) |
| 726 | 726 | { |
| 727 | - if(!isset($params['2'])) |
|
| 727 | + if (!isset($params['2'])) |
|
| 728 | 728 | $params[2] = 0; |
| 729 | 729 | list($fieldname, $label, $disabled) = $params; |
| 730 | 730 | $value = get_option($fieldname); |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | <div class="switch"> |
| 735 | 735 | <label> |
| 736 | 736 | Off |
| 737 | - <input <?php echo ($disabled)?"disabled":""?> type="checkbox" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" value="1" <?php echo ($value) ? 'checked="checked"' : ''; ?>"> |
|
| 737 | + <input <?php echo ($disabled) ? "disabled" : ""?> type="checkbox" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" value="1" <?php echo ($value) ? 'checked="checked"' : ''; ?>"> |
|
| 738 | 738 | <span class="lever"></span> |
| 739 | 739 | On |
| 740 | 740 | </label> |