@@ -35,10 +35,11 @@ discard block |
||
35 | 35 | { |
36 | 36 | $new_list= array(); |
37 | 37 | |
38 | - foreach($list as $res) |
|
39 | - if($res->status) |
|
38 | + foreach($list as $res) { |
|
39 | + if($res->status) |
|
40 | 40 | { |
41 | 41 | $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)); |
42 | + } |
|
42 | 43 | $new_list[] = $res; |
43 | 44 | } |
44 | 45 | $list = $new_list; |
@@ -64,8 +65,9 @@ discard block |
||
64 | 65 | { |
65 | 66 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
66 | 67 | |
67 | - if(!$data) |
|
68 | - return false; |
|
68 | + if(!$data) { |
|
69 | + return false; |
|
70 | + } |
|
69 | 71 | |
70 | 72 | $params = json_decode($data['params']); |
71 | 73 | |
@@ -115,12 +117,13 @@ discard block |
||
115 | 117 | |
116 | 118 | if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
117 | 119 | |
118 | - if($schedule->recurrence == "single") |
|
119 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
120 | - else |
|
121 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
120 | + if($schedule->recurrence == "single") { |
|
121 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
122 | + } else { |
|
123 | + wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
124 | + } |
|
122 | 125 | |
123 | - }elseif(!$schedule->status) |
|
126 | + } elseif(!$schedule->status) |
|
124 | 127 | { |
125 | 128 | $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
126 | 129 | wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
@@ -139,9 +142,9 @@ discard block |
||
139 | 142 | |
140 | 143 | if ($schedule->status) { |
141 | 144 | |
142 | - if($schedule->recurrence == "single") |
|
143 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
144 | - else{ |
|
145 | + if($schedule->recurrence == "single") { |
|
146 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
147 | + } else{ |
|
145 | 148 | wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
146 | 149 | } |
147 | 150 | |
@@ -271,8 +274,9 @@ discard block |
||
271 | 274 | |
272 | 275 | //getting the last backup archive file |
273 | 276 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
274 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
275 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
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(); |
|
279 | + } |
|
276 | 280 | |
277 | 281 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
278 | 282 | |
@@ -282,8 +286,9 @@ discard block |
||
282 | 286 | |
283 | 287 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
284 | 288 | |
285 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
286 | - call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
289 | + if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) { |
|
290 | + call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
291 | + } |
|
287 | 292 | } |
288 | 293 | |
289 | 294 | |
@@ -292,7 +297,7 @@ discard block |
||
292 | 297 | try{ |
293 | 298 | $from = "XCloner Schedule - ".$schedule['name']; |
294 | 299 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule); |
295 | - }catch(Exception $e) |
|
300 | + } catch(Exception $e) |
|
296 | 301 | { |
297 | 302 | $this->logger->error($e->getMessage()); |
298 | 303 | } |
@@ -311,7 +316,7 @@ discard block |
||
311 | 316 | |
312 | 317 | $this->__xcloner_scheduler_callback($id, $schedule); |
313 | 318 | |
314 | - }catch(Exception $e){ |
|
319 | + } catch(Exception $e){ |
|
315 | 320 | |
316 | 321 | if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
317 | 322 | { |