@@ -350,10 +350,10 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | if(defined('DOING_CRON') || $_POST['hash'] == "generate_hash"){ |
| 352 | 352 | $this->xcloner_settings->generate_new_hash(); |
| 353 | - }else{ |
|
| 353 | + } else{ |
|
| 354 | 354 | $this->xcloner_settings->set_hash($_POST['hash']); |
| 355 | 355 | } |
| 356 | - }else{ |
|
| 356 | + } else{ |
|
| 357 | 357 | add_action( 'shutdown', function(){ |
| 358 | 358 | $this->xcloner_file_system = new Xcloner_File_System($this); |
| 359 | 359 | $this->xcloner_file_system->remove_tmp_filesystem(); |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | try{ |
| 461 | 461 | $this->xcloner_scheduler->xcloner_scheduler_callback(0, $schedule); |
| 462 | - }catch(Exception $e){ |
|
| 462 | + } catch(Exception $e){ |
|
| 463 | 463 | $this->get_xcloner_logger()->error($e->getMessage()); |
| 464 | 464 | } |
| 465 | 465 | |
@@ -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) |
@@ -324,7 +328,7 @@ discard block |
||
| 324 | 328 | |
| 325 | 329 | $this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $schedule, "", $additional); |
| 326 | 330 | |
| 327 | - }catch(Exception $e) |
|
| 331 | + } catch(Exception $e) |
|
| 328 | 332 | { |
| 329 | 333 | $this->logger->error($e->getMessage()); |
| 330 | 334 | } |
@@ -354,7 +358,7 @@ discard block |
||
| 354 | 358 | |
| 355 | 359 | $this->__xcloner_scheduler_callback($id, $schedule); |
| 356 | 360 | |
| 357 | - }catch(Exception $e){ |
|
| 361 | + } catch(Exception $e){ |
|
| 358 | 362 | |
| 359 | 363 | //send email to site admin if email notification is not set in the scheduler |
| 360 | 364 | if(!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |