@@ -42,10 +42,11 @@ discard block |
||
42 | 42 | { |
43 | 43 | $new_list= array(); |
44 | 44 | |
45 | - foreach($list as $res) |
|
46 | - if($res->status) |
|
45 | + foreach($list as $res) { |
|
46 | + if($res->status) |
|
47 | 47 | { |
48 | 48 | $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
49 | + } |
|
49 | 50 | $new_list[] = $res; |
50 | 51 | } |
51 | 52 | $list = $new_list; |
@@ -71,8 +72,9 @@ discard block |
||
71 | 72 | { |
72 | 73 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
73 | 74 | |
74 | - if(!$data) |
|
75 | - return false; |
|
75 | + if(!$data) { |
|
76 | + return false; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | $params = json_decode($data['params']); |
78 | 80 | |
@@ -122,12 +124,13 @@ discard block |
||
122 | 124 | |
123 | 125 | if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
124 | 126 | |
125 | - if($schedule->recurrence == "single") |
|
126 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
127 | - else |
|
128 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
127 | + if($schedule->recurrence == "single") { |
|
128 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
129 | + } else { |
|
130 | + wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
131 | + } |
|
129 | 132 | |
130 | - }elseif(!$schedule->status) |
|
133 | + } elseif(!$schedule->status) |
|
131 | 134 | { |
132 | 135 | $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
133 | 136 | wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
@@ -146,9 +149,9 @@ discard block |
||
146 | 149 | |
147 | 150 | if ($schedule->status) { |
148 | 151 | |
149 | - if($schedule->recurrence == "single") |
|
150 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
151 | - else{ |
|
152 | + if($schedule->recurrence == "single") { |
|
153 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
154 | + } else{ |
|
152 | 155 | wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
153 | 156 | } |
154 | 157 | |
@@ -274,8 +277,9 @@ discard block |
||
274 | 277 | |
275 | 278 | //getting the last backup archive file |
276 | 279 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
277 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
278 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
280 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
281 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
282 | + } |
|
279 | 283 | |
280 | 284 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
281 | 285 | |
@@ -285,8 +289,9 @@ discard block |
||
285 | 289 | |
286 | 290 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
287 | 291 | |
288 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
289 | - call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
292 | + if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) { |
|
293 | + call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
294 | + } |
|
290 | 295 | } |
291 | 296 | |
292 | 297 | |
@@ -296,7 +301,7 @@ discard block |
||
296 | 301 | $from = "XCloner Schedule - ".$schedule['name']; |
297 | 302 | $additional['lines_total'] = $return['extra']['lines_total']; |
298 | 303 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule, "", $additional); |
299 | - }catch(Exception $e) |
|
304 | + } catch(Exception $e) |
|
300 | 305 | { |
301 | 306 | $this->logger->error($e->getMessage()); |
302 | 307 | } |
@@ -315,7 +320,7 @@ discard block |
||
315 | 320 | |
316 | 321 | $this->__xcloner_scheduler_callback($id, $schedule); |
317 | 322 | |
318 | - }catch(Exception $e){ |
|
323 | + } catch(Exception $e){ |
|
319 | 324 | |
320 | 325 | //send email to site admin if email notification is not set in the scheduler |
321 | 326 | if(!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |