@@ -334,6 +334,9 @@ |
||
334 | 334 | $this->xcloner_file_system->backup_storage_cleanup(); |
335 | 335 | } |
336 | 336 | |
337 | + /** |
|
338 | + * @param integer $id |
|
339 | + */ |
|
337 | 340 | public function xcloner_scheduler_callback($id, $schedule = "") |
338 | 341 | { |
339 | 342 | if($id) |
@@ -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,30 +300,30 @@ 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 = "XCloner Scheduler"; |
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 | - }catch(Exception $e) |
|
326 | + }catch (Exception $e) |
|
327 | 327 | { |
328 | 328 | $this->logger->error($e->getMessage()); |
329 | 329 | } |
@@ -336,27 +336,27 @@ discard block |
||
336 | 336 | |
337 | 337 | public function xcloner_scheduler_callback($id, $schedule = "") |
338 | 338 | { |
339 | - if($id) |
|
339 | + if ($id) |
|
340 | 340 | { |
341 | 341 | $schedule = $this->get_schedule_by_id($id); |
342 | 342 | } |
343 | 343 | |
344 | - try{ |
|
344 | + try { |
|
345 | 345 | |
346 | 346 | $this->__xcloner_scheduler_callback($id, $schedule); |
347 | 347 | |
348 | - }catch(Exception $e){ |
|
348 | + }catch (Exception $e) { |
|
349 | 349 | |
350 | 350 | //send email to site admin if email notification is not set in the scheduler |
351 | - if(!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |
|
351 | + if (!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |
|
352 | 352 | { |
353 | 353 | $schedule['backup_params']->email_notification = get_option('admin_email'); |
354 | 354 | } |
355 | 355 | |
356 | - if(isset($schedule['backup_params']->email_notification) && $to=$schedule['backup_params']->email_notification) |
|
356 | + if (isset($schedule['backup_params']->email_notification) && $to = $schedule['backup_params']->email_notification) |
|
357 | 357 | { |
358 | 358 | $from = "XCloner Scheduler"; |
359 | - $this->archive_system->send_notification($to, $from, $schedule['name']." - backup error","", "", $e->getMessage()); |
|
359 | + $this->archive_system->send_notification($to, $from, $schedule['name']." - backup error", "", "", $e->getMessage()); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | } |
@@ -369,10 +369,10 @@ discard block |
||
369 | 369 | $new_schedules = array(); |
370 | 370 | |
371 | 371 | foreach ($schedules as $key => $row) { |
372 | - if(in_array($key, $this->allowed_schedules)) |
|
372 | + if (in_array($key, $this->allowed_schedules)) |
|
373 | 373 | { |
374 | 374 | $new_schedules[$key] = $row; |
375 | - $intervals[$key] = $row['interval']; |
|
375 | + $intervals[$key] = $row['interval']; |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 |
@@ -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) |
@@ -323,7 +327,7 @@ discard block |
||
323 | 327 | $subject = sprintf(__("%s - new backup generated %s") , $schedule['name'], $return['extra']['backup_parent']); |
324 | 328 | |
325 | 329 | $this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $schedule, "", $additional); |
326 | - }catch(Exception $e) |
|
330 | + } catch(Exception $e) |
|
327 | 331 | { |
328 | 332 | $this->logger->error($e->getMessage()); |
329 | 333 | } |
@@ -345,7 +349,7 @@ discard block |
||
345 | 349 | |
346 | 350 | $this->__xcloner_scheduler_callback($id, $schedule); |
347 | 351 | |
348 | - }catch(Exception $e){ |
|
352 | + } catch(Exception $e){ |
|
349 | 353 | |
350 | 354 | //send email to site admin if email notification is not set in the scheduler |
351 | 355 | if(!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) |
@@ -580,6 +580,9 @@ discard block |
||
580 | 580 | |
581 | 581 | } |
582 | 582 | |
583 | + /** |
|
584 | + * @param mysqli $mysqli |
|
585 | + */ |
|
583 | 586 | private function update_wp_url($wp_path, $url, $mysqli) |
584 | 587 | { |
585 | 588 | $wp_config = $wp_path.DS."wp-config.php"; |
@@ -886,6 +889,9 @@ discard block |
||
886 | 889 | $this->send_response(200, $return); |
887 | 890 | } |
888 | 891 | |
892 | + /** |
|
893 | + * @param string $val |
|
894 | + */ |
|
889 | 895 | private function return_bytes($val) { |
890 | 896 | $val = trim($val); |
891 | 897 | $last = strtolower($val[strlen($val)-1]); |
@@ -943,6 +949,9 @@ discard block |
||
943 | 949 | return $files; |
944 | 950 | } |
945 | 951 | |
952 | + /** |
|
953 | + * @param string $field |
|
954 | + */ |
|
946 | 955 | private function sort_by( &$array, $field, $direction = 'asc') |
947 | 956 | { |
948 | 957 | $direction = strtolower($direction); |
@@ -988,6 +997,9 @@ discard block |
||
988 | 997 | * Serialize fix methods below for mysql query lines |
989 | 998 | */ |
990 | 999 | |
1000 | + /** |
|
1001 | + * @return string |
|
1002 | + */ |
|
991 | 1003 | function do_serialized_fix($query) |
992 | 1004 | { |
993 | 1005 | $query = str_replace(array("\\n","\\r","\\'"), array("","","\""), ($query)); |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('AUTH_KEY')) |
|
3 | +if (!defined('AUTH_KEY')) |
|
4 | 4 | { |
5 | 5 | define('AUTH_KEY', ''); |
6 | 6 | } |
7 | 7 | |
8 | -if(!defined("DS")) |
|
8 | +if (!defined("DS")) |
|
9 | 9 | { |
10 | 10 | define("DS", DIRECTORY_SEPARATOR); |
11 | 11 | } |
12 | 12 | |
13 | -if(!defined('XCLONER_PLUGIN_ACCESS') || XCLONER_PLUGIN_ACCESS != 1) |
|
13 | +if (!defined('XCLONER_PLUGIN_ACCESS') || XCLONER_PLUGIN_ACCESS != 1) |
|
14 | 14 | { |
15 | - if(!AUTH_KEY) |
|
15 | + if (!AUTH_KEY) |
|
16 | 16 | { |
17 | 17 | Xcloner_Restore::send_response("404", "Could not run restore script, AUTH_KEY not set!"); |
18 | 18 | exit; |
19 | 19 | } |
20 | 20 | |
21 | - if(!isset($_REQUEST['hash'])) |
|
21 | + if (!isset($_REQUEST['hash'])) |
|
22 | 22 | { |
23 | 23 | Xcloner_Restore::send_response("404", "Could not run restore script, sent HASH is empty!"); |
24 | 24 | exit; |
25 | 25 | } |
26 | 26 | |
27 | - if($_REQUEST['hash'] != AUTH_KEY) |
|
27 | + if ($_REQUEST['hash'] != AUTH_KEY) |
|
28 | 28 | { |
29 | 29 | Xcloner_Restore::send_response("404", "Could not run restore script, AUTH_KEY doesn't match the sent HASH!"); |
30 | 30 | exit; |
@@ -32,28 +32,28 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | //check minimum PHP version |
35 | -if(version_compare(phpversion(), Xcloner_Restore::xcloner_minimum_version, '<')) |
|
35 | +if (version_compare(phpversion(), Xcloner_Restore::xcloner_minimum_version, '<')) |
|
36 | 36 | { |
37 | - Xcloner_Restore::send_response(500, sprintf(("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s"),Xcloner_Restore::xcloner_minimum_version, phpversion()) ); |
|
37 | + Xcloner_Restore::send_response(500, sprintf(("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s"), Xcloner_Restore::xcloner_minimum_version, phpversion())); |
|
38 | 38 | exit; |
39 | 39 | |
40 | 40 | } |
41 | 41 | |
42 | -$file = dirname( __DIR__ ) . DS.'vendor'.DS.'autoload.php'; |
|
42 | +$file = dirname(__DIR__).DS.'vendor'.DS.'autoload.php'; |
|
43 | 43 | |
44 | -if(file_exists($file)) |
|
44 | +if (file_exists($file)) |
|
45 | 45 | { |
46 | 46 | |
47 | 47 | require_once($file); |
48 | 48 | } |
49 | -elseif(file_exists("vendor.phar") and extension_loaded('phar')) |
|
49 | +elseif (file_exists("vendor.phar") and extension_loaded('phar')) |
|
50 | 50 | { |
51 | 51 | require_once(__DIR__.DS."vendor.phar"); |
52 | -}else{ |
|
52 | +} else { |
|
53 | 53 | |
54 | - $file = dirname( __FILE__ ) . DS.'vendor'.DS.'autoload.php'; |
|
54 | + $file = dirname(__FILE__).DS.'vendor'.DS.'autoload.php'; |
|
55 | 55 | |
56 | - if(!file_exists($file)) |
|
56 | + if (!file_exists($file)) |
|
57 | 57 | { |
58 | 58 | Xcloner_Restore::send_response("404", "File $file does not exists, please extract the vendor.tgz archive on the server or enable PHP Phar module!"); |
59 | 59 | exit; |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | |
79 | 79 | //do not modify below |
80 | 80 | $that = ""; |
81 | -if(defined('XCLONER_PLUGIN_ACCESS') && XCLONER_PLUGIN_ACCESS) |
|
81 | +if (defined('XCLONER_PLUGIN_ACCESS') && XCLONER_PLUGIN_ACCESS) |
|
82 | 82 | { |
83 | 83 | $that = $this; |
84 | 84 | } |
85 | 85 | $xcloner_restore = new Xcloner_Restore($that); |
86 | 86 | |
87 | -try{ |
|
87 | +try { |
|
88 | 88 | $return = $xcloner_restore->init(); |
89 | 89 | $xcloner_restore->send_response(200, $return); |
90 | -}catch(Exception $e){ |
|
90 | +}catch (Exception $e) { |
|
91 | 91 | $xcloner_restore->send_response(417, $e->getMessage()); |
92 | 92 | } |
93 | 93 | |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | |
97 | 97 | const xcloner_minimum_version = "5.4.0"; |
98 | 98 | |
99 | - private $backup_archive_extensions = array("zip", "tar", "tgz", "tar.gz", "gz", "csv"); |
|
100 | - private $process_files_limit = 150; |
|
101 | - private $process_files_limit_list = 350; |
|
102 | - private $process_mysql_records_limit = 250; |
|
99 | + private $backup_archive_extensions = array("zip", "tar", "tgz", "tar.gz", "gz", "csv"); |
|
100 | + private $process_files_limit = 150; |
|
101 | + private $process_files_limit_list = 350; |
|
102 | + private $process_mysql_records_limit = 250; |
|
103 | 103 | private $adapter; |
104 | 104 | private $filesystem; |
105 | 105 | private $logger; |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | { |
112 | 112 | register_shutdown_function(array($this, 'exception_handler')); |
113 | 113 | |
114 | - if(defined('XCLONER_PLUGIN_ACCESS') && XCLONER_PLUGIN_ACCESS) |
|
114 | + if (defined('XCLONER_PLUGIN_ACCESS') && XCLONER_PLUGIN_ACCESS) |
|
115 | 115 | { |
116 | 116 | $dir = $parent_api->get_xcloner_container()->get_xcloner_settings()->get_xcloner_store_path(); |
117 | 117 | } |
118 | 118 | |
119 | - if(!isset($dir) || !$dir){ |
|
119 | + if (!isset($dir) || !$dir) { |
|
120 | 120 | $dir = dirname(__FILE__); |
121 | 121 | } |
122 | 122 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $this->backup_storage_dir = $dir; |
126 | 126 | |
127 | - $this->adapter = new Local($dir ,LOCK_EX, 'SKIP_LINKS'); |
|
127 | + $this->adapter = new Local($dir, LOCK_EX, 'SKIP_LINKS'); |
|
128 | 128 | $this->filesystem = new Filesystem($this->adapter, new Config([ |
129 | 129 | 'disable_asserts' => true, |
130 | 130 | ])); |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | |
134 | 134 | $logger_path = $this->get_logger_filename(); |
135 | 135 | |
136 | - if(!is_writeable($logger_path) and !touch($logger_path)) |
|
136 | + if (!is_writeable($logger_path) and !touch($logger_path)) |
|
137 | 137 | { |
138 | 138 | $logger_path = "php://stderr"; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $this->logger->pushHandler(new StreamHandler($logger_path, Logger::DEBUG)); |
142 | 142 | |
143 | - if(isset($_POST['API_ID'])){ |
|
144 | - $this->logger->info("Processing ajax request ID ".substr(filter_input(INPUT_POST, 'API_ID', FILTER_SANITIZE_STRING), 0 , 15)); |
|
143 | + if (isset($_POST['API_ID'])) { |
|
144 | + $this->logger->info("Processing ajax request ID ".substr(filter_input(INPUT_POST, 'API_ID', FILTER_SANITIZE_STRING), 0, 15)); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | } |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | |
151 | 151 | $error = error_get_last(); |
152 | 152 | |
153 | - if($error['type'] and $this->logger) |
|
153 | + if ($error['type'] and $this->logger) |
|
154 | 154 | { |
155 | - $this->logger->info($this->friendly_error_type ($error['type']).": ".var_export($error, true)); |
|
155 | + $this->logger->info($this->friendly_error_type($error['type']).": ".var_export($error, true)); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | } |
159 | 159 | |
160 | 160 | private function friendly_error_type($type) { |
161 | - static $levels=null; |
|
162 | - if ($levels===null) { |
|
163 | - $levels=[]; |
|
161 | + static $levels = null; |
|
162 | + if ($levels === null) { |
|
163 | + $levels = []; |
|
164 | 164 | foreach (get_defined_constants() as $key=>$value) { |
165 | - if (strpos($key,'E_')!==0) {continue;} |
|
166 | - $levels[$value]= $key; //substr($key,2); |
|
165 | + if (strpos($key, 'E_') !== 0) {continue; } |
|
166 | + $levels[$value] = $key; //substr($key,2); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | |
172 | 172 | public function get_logger_filename() |
173 | 173 | { |
174 | - $filename = $this->backup_storage_dir .DS. "xcloner_restore.log"; |
|
174 | + $filename = $this->backup_storage_dir.DS."xcloner_restore.log"; |
|
175 | 175 | |
176 | 176 | return $filename; |
177 | 177 | } |
178 | 178 | |
179 | 179 | public function init() |
180 | 180 | { |
181 | - if(isset($_POST['xcloner_action']) and $_POST['xcloner_action']) |
|
181 | + if (isset($_POST['xcloner_action']) and $_POST['xcloner_action']) |
|
182 | 182 | { |
183 | 183 | $method = filter_input(INPUT_POST, 'xcloner_action', FILTER_SANITIZE_STRING); |
184 | 184 | |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | |
187 | 187 | $method .= "_action"; |
188 | 188 | |
189 | - if(method_exists($this, $method)) |
|
189 | + if (method_exists($this, $method)) |
|
190 | 190 | { |
191 | 191 | $this->logger->debug(sprintf('Starting action %s', $method)); |
192 | 192 | return call_user_func(array($this, $method)); |
193 | 193 | |
194 | - }else{ |
|
195 | - throw new Exception($method ." does not exists"); |
|
194 | + } else { |
|
195 | + throw new Exception($method." does not exists"); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -201,38 +201,38 @@ discard block |
||
201 | 201 | |
202 | 202 | public function write_file_action() |
203 | 203 | { |
204 | - if(isset($_POST['file'])) |
|
204 | + if (isset($_POST['file'])) |
|
205 | 205 | { |
206 | 206 | $target_file = filter_input(INPUT_POST, 'file', FILTER_SANITIZE_STRING); |
207 | 207 | |
208 | - if(!$_POST['start']) |
|
208 | + if (!$_POST['start']) |
|
209 | 209 | $fp = fopen($target_file, "wb+"); |
210 | 210 | else |
211 | 211 | $fp = fopen($target_file, "ab+"); |
212 | 212 | |
213 | - if(!$fp) |
|
213 | + if (!$fp) |
|
214 | 214 | throw new Exception("Unable to open $target_file file for writing"); |
215 | 215 | |
216 | 216 | fseek($fp, $_POST['start']); |
217 | 217 | |
218 | - if(isset($_FILES['blob'])) |
|
218 | + if (isset($_FILES['blob'])) |
|
219 | 219 | { |
220 | 220 | $this->logger->debug(sprintf('Writing %s bytes to file %s starting position %s using FILES blob', filesize($_FILES['blob']['tmp_name']), $target_file, $_POST['start'])); |
221 | 221 | |
222 | 222 | $blob = file_get_contents($_FILES['blob']['tmp_name']); |
223 | 223 | |
224 | - if(!$bytes_written = fwrite($fp, $blob)) |
|
224 | + if (!$bytes_written = fwrite($fp, $blob)) |
|
225 | 225 | throw new Exception("Unable to write data to file $target_file"); |
226 | 226 | |
227 | 227 | @unlink($_FILES['blob']['tmp_name']); |
228 | - }elseif(isset($_POST['blob'])){ |
|
228 | + }elseif (isset($_POST['blob'])) { |
|
229 | 229 | $this->logger->debug(sprintf('Writing %s bytes to file %s starting position %s using POST blob', strlen($_POST['blob']), $target_file, $_POST['start'])); |
230 | 230 | |
231 | 231 | $blob = $_POST['blob']; |
232 | 232 | |
233 | - if(!$bytes_written = fwrite($fp, $blob)) |
|
233 | + if (!$bytes_written = fwrite($fp, $blob)) |
|
234 | 234 | throw new Exception("Unable to write data to file $target_file"); |
235 | - }else{ |
|
235 | + } else { |
|
236 | 236 | throw new Exception("Upload failed, did not receive any binary data"); |
237 | 237 | } |
238 | 238 | |
@@ -243,20 +243,20 @@ discard block |
||
243 | 243 | |
244 | 244 | } |
245 | 245 | |
246 | - public function mysql_connect($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db ) |
|
246 | + public function mysql_connect($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db) |
|
247 | 247 | { |
248 | 248 | $this->logger->info(sprintf('Connecting to mysql database %s with %s@%s', $remote_mysql_db, $remote_mysql_user, $remote_mysql_host)); |
249 | 249 | |
250 | 250 | $mysqli = new mysqli($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db); |
251 | 251 | |
252 | 252 | if ($mysqli->connect_error) { |
253 | - throw new Exception('Connect Error (' . $mysqli->connect_errno . ') ' |
|
253 | + throw new Exception('Connect Error ('.$mysqli->connect_errno.') ' |
|
254 | 254 | . $mysqli->connect_error); |
255 | 255 | } |
256 | 256 | |
257 | 257 | $mysqli->query("SET sql_mode='';"); |
258 | 258 | $mysqli->query("SET foreign_key_checks = 0;"); |
259 | - if(isset($_REQUEST['charset_of_file']) and $_REQUEST['charset_of_file']) |
|
259 | + if (isset($_REQUEST['charset_of_file']) and $_REQUEST['charset_of_file']) |
|
260 | 260 | $mysqli->query("SET NAMES ".$_REQUEST['charset_of_file'].""); |
261 | 261 | else |
262 | 262 | $mysqli->query("SET NAMES utf8;"); |
@@ -266,15 +266,15 @@ discard block |
||
266 | 266 | |
267 | 267 | public function restore_mysql_backup_action() |
268 | 268 | { |
269 | - $mysqldump_file = filter_input(INPUT_POST, 'mysqldump_file', FILTER_SANITIZE_STRING); |
|
270 | - $remote_path = filter_input(INPUT_POST, 'remote_path', FILTER_SANITIZE_STRING); |
|
269 | + $mysqldump_file = filter_input(INPUT_POST, 'mysqldump_file', FILTER_SANITIZE_STRING); |
|
270 | + $remote_path = filter_input(INPUT_POST, 'remote_path', FILTER_SANITIZE_STRING); |
|
271 | 271 | $remote_mysql_user = filter_input(INPUT_POST, 'remote_mysql_user', FILTER_SANITIZE_STRING); |
272 | 272 | $remote_mysql_pass = filter_input(INPUT_POST, 'remote_mysql_pass', FILTER_SANITIZE_STRING); |
273 | - $remote_mysql_db = filter_input(INPUT_POST, 'remote_mysql_db', FILTER_SANITIZE_STRING); |
|
273 | + $remote_mysql_db = filter_input(INPUT_POST, 'remote_mysql_db', FILTER_SANITIZE_STRING); |
|
274 | 274 | $remote_mysql_host = filter_input(INPUT_POST, 'remote_mysql_host', FILTER_SANITIZE_STRING); |
275 | - $execute_query = trim(stripslashes($_POST['query'])); |
|
276 | - $error_line = filter_input(INPUT_POST, 'error_line', FILTER_SANITIZE_NUMBER_INT); |
|
277 | - $start = filter_input(INPUT_POST, 'start', FILTER_SANITIZE_NUMBER_INT); |
|
275 | + $execute_query = trim(stripslashes($_POST['query'])); |
|
276 | + $error_line = filter_input(INPUT_POST, 'error_line', FILTER_SANITIZE_NUMBER_INT); |
|
277 | + $start = filter_input(INPUT_POST, 'start', FILTER_SANITIZE_NUMBER_INT); |
|
278 | 278 | |
279 | 279 | $wp_home_url = filter_input(INPUT_POST, 'wp_home_url', FILTER_SANITIZE_STRING); |
280 | 280 | $remote_restore_url = filter_input(INPUT_POST, 'remote_restore_url', FILTER_SANITIZE_STRING); |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | |
285 | 285 | $mysql_backup_file = $remote_path.DS.$mysqldump_file; |
286 | 286 | |
287 | - if(!file_exists($mysql_backup_file)) |
|
288 | - throw new Exception(sprintf("Mysql backup file %s does not exists",$mysql_backup_file)); |
|
287 | + if (!file_exists($mysql_backup_file)) |
|
288 | + throw new Exception(sprintf("Mysql backup file %s does not exists", $mysql_backup_file)); |
|
289 | 289 | |
290 | 290 | |
291 | 291 | /*if(defined('XCLONER_PLUGIN_ACCESS') && XCLONER_PLUGIN_ACCESS) |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | }*/ |
300 | 300 | |
301 | 301 | { |
302 | - $mysqli = $this->mysql_connect($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db ); |
|
302 | + $mysqli = $this->mysql_connect($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | $line_count = 0; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | $return['backup_size'] = filesize($mysql_backup_file); |
310 | 310 | |
311 | 311 | $fp = fopen($mysql_backup_file, "r"); |
312 | - if($fp) |
|
312 | + if ($fp) |
|
313 | 313 | { |
314 | 314 | $this->logger->info(sprintf("Opening mysql dump file %s at position %s.", $mysql_backup_file, $start)); |
315 | 315 | fseek($fp, $start); |
@@ -317,49 +317,49 @@ discard block |
||
317 | 317 | // process the line read. |
318 | 318 | |
319 | 319 | //check if line is comment |
320 | - if(substr($line, 0, 1) == "#") |
|
320 | + if (substr($line, 0, 1) == "#") |
|
321 | 321 | continue; |
322 | 322 | |
323 | 323 | //check if line is empty |
324 | - if($line == "\n" or trim($line) == "") |
|
324 | + if ($line == "\n" or trim($line) == "") |
|
325 | 325 | continue; |
326 | 326 | |
327 | - if(substr($line, strlen($line)-2, strlen($line)) == ";\n") |
|
327 | + if (substr($line, strlen($line) - 2, strlen($line)) == ";\n") |
|
328 | 328 | $query .= $line; |
329 | - else{ |
|
329 | + else { |
|
330 | 330 | $query .= $line; |
331 | 331 | continue; |
332 | 332 | } |
333 | 333 | |
334 | - if($execute_query) |
|
334 | + if ($execute_query) |
|
335 | 335 | { |
336 | - $query = (($execute_query)); |
|
336 | + $query = (($execute_query)); |
|
337 | 337 | $execute_query = ""; |
338 | 338 | } |
339 | 339 | |
340 | 340 | //Doing serialized url replace here |
341 | 341 | |
342 | - if($wp_site_url and $wp_home_url and strlen($wp_home_url) < strlen($wp_site_url)) |
|
342 | + if ($wp_site_url and $wp_home_url and strlen($wp_home_url) < strlen($wp_site_url)) |
|
343 | 343 | { |
344 | - list($wp_home_url,$wp_site_url) = array($wp_site_url,$wp_home_url); |
|
345 | - list($remote_restore_url,$restore_site_url) = array($restore_site_url,$remote_restore_url); |
|
344 | + list($wp_home_url, $wp_site_url) = array($wp_site_url, $wp_home_url); |
|
345 | + list($remote_restore_url, $restore_site_url) = array($restore_site_url, $remote_restore_url); |
|
346 | 346 | |
347 | 347 | } |
348 | 348 | |
349 | - if($wp_home_url and $remote_restore_url and strpos($query, $wp_home_url) !== false) |
|
349 | + if ($wp_home_url and $remote_restore_url and strpos($query, $wp_home_url) !== false) |
|
350 | 350 | { |
351 | 351 | $query = $this->url_replace($wp_home_url, $remote_restore_url, $query); |
352 | 352 | } |
353 | 353 | |
354 | - if($wp_site_url and $restore_site_url and strpos($query, $wp_site_url) !== false) |
|
354 | + if ($wp_site_url and $restore_site_url and strpos($query, $wp_site_url) !== false) |
|
355 | 355 | { |
356 | 356 | $query = $this->url_replace($wp_site_url, $restore_site_url, $query); |
357 | 357 | } |
358 | 358 | |
359 | - if(!$mysqli->query($query) && !stristr($mysqli->error,"Duplicate entry")) |
|
359 | + if (!$mysqli->query($query) && !stristr($mysqli->error, "Duplicate entry")) |
|
360 | 360 | { |
361 | 361 | //$return['error_line'] = $line_count; |
362 | - $return['start'] = ftell($fp)-strlen($line); |
|
362 | + $return['start'] = ftell($fp) - strlen($line); |
|
363 | 363 | $return['query_error'] = true; |
364 | 364 | $return['query'] = $query; |
365 | 365 | $return['message'] = sprintf("Mysql Error: %s\n", $mysqli->error); |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | |
381 | 381 | $return['start'] = ftell($fp); |
382 | 382 | |
383 | - $this->logger->info(sprintf("Executed %s queries of size %s bytes", $line_count, ($return['start']-$start))); |
|
383 | + $this->logger->info(sprintf("Executed %s queries of size %s bytes", $line_count, ($return['start'] - $start))); |
|
384 | 384 | |
385 | - if(!feof($fp)) |
|
385 | + if (!feof($fp)) |
|
386 | 386 | { |
387 | 387 | $return['finished'] = 0; |
388 | - }else{ |
|
388 | + } else { |
|
389 | 389 | $this->logger->info(sprintf("Mysql Import Done.")); |
390 | 390 | } |
391 | 391 | |
@@ -400,12 +400,12 @@ discard block |
||
400 | 400 | $query = str_replace($search, $replace, $query); |
401 | 401 | $original_query = $query; |
402 | 402 | |
403 | - if($this->has_serialized($query)) |
|
403 | + if ($this->has_serialized($query)) |
|
404 | 404 | { |
405 | 405 | $this->logger->info(sprintf("Query contains serialized data, doing serialized size fix"), array("QUERY_REPLACE")); |
406 | 406 | $query = $this->do_serialized_fix($query); |
407 | 407 | |
408 | - if(!$query) |
|
408 | + if (!$query) |
|
409 | 409 | { |
410 | 410 | $this->logger->info(sprintf("Serialization probably failed here..."), array("QUERY_REPLACE")); |
411 | 411 | $query = $original_query; |
@@ -421,37 +421,37 @@ discard block |
||
421 | 421 | $backup_parts = array(); |
422 | 422 | |
423 | 423 | $source_backup_file = filter_input(INPUT_POST, 'file', FILTER_SANITIZE_STRING); |
424 | - $start = (int)filter_input(INPUT_POST, 'start', FILTER_SANITIZE_STRING); |
|
425 | - $return['part'] = (int)filter_input(INPUT_POST, 'part', FILTER_SANITIZE_STRING); |
|
424 | + $start = (int)filter_input(INPUT_POST, 'start', FILTER_SANITIZE_STRING); |
|
425 | + $return['part'] = (int)filter_input(INPUT_POST, 'part', FILTER_SANITIZE_STRING); |
|
426 | 426 | |
427 | 427 | $backup_file = $source_backup_file; |
428 | 428 | |
429 | - if($this->is_multipart($backup_file)) |
|
429 | + if ($this->is_multipart($backup_file)) |
|
430 | 430 | { |
431 | 431 | $backup_parts = $this->get_multipart_files($backup_file); |
432 | 432 | $backup_file = $backup_parts[$return['part']]; |
433 | 433 | } |
434 | 434 | |
435 | - try{ |
|
435 | + try { |
|
436 | 436 | $tar = new Tar(); |
437 | 437 | $tar->open($this->backup_storage_dir.DS.$backup_file, $start); |
438 | 438 | |
439 | 439 | $data = $tar->contents($this->process_files_limit_list); |
440 | - }catch(Exception $e) |
|
440 | + }catch (Exception $e) |
|
441 | 441 | { |
442 | 442 | $return['error'] = true; |
443 | 443 | $return['message'] = $e->getMessage(); |
444 | 444 | $this->send_response(200, $return); |
445 | 445 | } |
446 | 446 | |
447 | - $return['files'] = array(); |
|
448 | - $return['finished'] = 1; |
|
449 | - $return['total_size'] = filesize($this->backup_storage_dir.DS.$backup_file); |
|
447 | + $return['files'] = array(); |
|
448 | + $return['finished'] = 1; |
|
449 | + $return['total_size'] = filesize($this->backup_storage_dir.DS.$backup_file); |
|
450 | 450 | $i = 0; |
451 | 451 | |
452 | - if(isset($data['extracted_files']) and is_array($data['extracted_files'])) |
|
452 | + if (isset($data['extracted_files']) and is_array($data['extracted_files'])) |
|
453 | 453 | { |
454 | - foreach($data['extracted_files'] as $file) |
|
454 | + foreach ($data['extracted_files'] as $file) |
|
455 | 455 | { |
456 | 456 | $return['files'][$i]['path'] = $file->getPath(); |
457 | 457 | $return['files'][$i]['size'] = $file->getSize(); |
@@ -461,18 +461,18 @@ discard block |
||
461 | 461 | } |
462 | 462 | } |
463 | 463 | |
464 | - if(isset($data['start'])) |
|
464 | + if (isset($data['start'])) |
|
465 | 465 | { |
466 | 466 | $return['start'] = $data['start']; |
467 | 467 | $return['finished'] = 0; |
468 | - }else{ |
|
469 | - if($this->is_multipart($source_backup_file)) |
|
468 | + } else { |
|
469 | + if ($this->is_multipart($source_backup_file)) |
|
470 | 470 | { |
471 | 471 | $return['start'] = 0; |
472 | 472 | |
473 | 473 | ++$return['part']; |
474 | 474 | |
475 | - if($return['part'] < sizeof($backup_parts)) |
|
475 | + if ($return['part'] < sizeof($backup_parts)) |
|
476 | 476 | $return['finished'] = 0; |
477 | 477 | |
478 | 478 | } |
@@ -490,28 +490,28 @@ discard block |
||
490 | 490 | |
491 | 491 | $remote_mysql_user = filter_input(INPUT_POST, 'remote_mysql_user', FILTER_SANITIZE_STRING); |
492 | 492 | $remote_mysql_pass = filter_input(INPUT_POST, 'remote_mysql_pass', FILTER_SANITIZE_STRING); |
493 | - $remote_mysql_db = filter_input(INPUT_POST, 'remote_mysql_db', FILTER_SANITIZE_STRING); |
|
493 | + $remote_mysql_db = filter_input(INPUT_POST, 'remote_mysql_db', FILTER_SANITIZE_STRING); |
|
494 | 494 | $remote_mysql_host = filter_input(INPUT_POST, 'remote_mysql_host', FILTER_SANITIZE_STRING); |
495 | 495 | |
496 | - $update_remote_site_url = filter_input(INPUT_POST, 'update_remote_site_url', FILTER_SANITIZE_NUMBER_INT); |
|
497 | - $delete_restore_script = filter_input(INPUT_POST, 'delete_restore_script', FILTER_SANITIZE_NUMBER_INT); |
|
498 | - $delete_backup_temporary_folder = filter_input(INPUT_POST, 'delete_backup_temporary_folder', FILTER_SANITIZE_NUMBER_INT); |
|
496 | + $update_remote_site_url = filter_input(INPUT_POST, 'update_remote_site_url', FILTER_SANITIZE_NUMBER_INT); |
|
497 | + $delete_restore_script = filter_input(INPUT_POST, 'delete_restore_script', FILTER_SANITIZE_NUMBER_INT); |
|
498 | + $delete_backup_temporary_folder = filter_input(INPUT_POST, 'delete_backup_temporary_folder', FILTER_SANITIZE_NUMBER_INT); |
|
499 | 499 | |
500 | - if($update_remote_site_url) |
|
500 | + if ($update_remote_site_url) |
|
501 | 501 | { |
502 | - $mysqli = $this->mysql_connect($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db ); |
|
502 | + $mysqli = $this->mysql_connect($remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db); |
|
503 | 503 | $this->update_wp_config($remote_path, $remote_mysql_host, $remote_mysql_user, $remote_mysql_pass, $remote_mysql_db); |
504 | 504 | $this->update_wp_url($remote_path, $remote_restore_url, $mysqli); |
505 | 505 | } |
506 | 506 | |
507 | - if($delete_backup_temporary_folder) |
|
507 | + if ($delete_backup_temporary_folder) |
|
508 | 508 | { |
509 | 509 | $this->delete_backup_temporary_folder($remote_path); |
510 | 510 | } |
511 | 511 | |
512 | - if(!defined('XCLONER_PLUGIN_ACCESS') || XCLONER_PLUGIN_ACCESS != 1) |
|
512 | + if (!defined('XCLONER_PLUGIN_ACCESS') || XCLONER_PLUGIN_ACCESS != 1) |
|
513 | 513 | { |
514 | - if($delete_restore_script) |
|
514 | + if ($delete_restore_script) |
|
515 | 515 | { |
516 | 516 | $this->delete_self(); |
517 | 517 | } |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | |
524 | 524 | private function delete_backup_temporary_folder($remote_path) |
525 | 525 | { |
526 | - $this->target_adapter = new Local($remote_path ,LOCK_EX, 'SKIP_LINKS'); |
|
526 | + $this->target_adapter = new Local($remote_path, LOCK_EX, 'SKIP_LINKS'); |
|
527 | 527 | $this->target_filesystem = new Filesystem($this->target_adapter, new Config([ |
528 | 528 | 'disable_asserts' => true, |
529 | 529 | ])); |
@@ -531,13 +531,13 @@ discard block |
||
531 | 531 | $mysqldump_list = array(); |
532 | 532 | $list = $this->target_filesystem->listContents(); |
533 | 533 | |
534 | - foreach($list as $file) |
|
534 | + foreach ($list as $file) |
|
535 | 535 | { |
536 | 536 | $matches = array(); |
537 | 537 | |
538 | - if($file['type'] == "dir") |
|
538 | + if ($file['type'] == "dir") |
|
539 | 539 | { |
540 | - if(preg_match("/xcloner-(\w*)/", $file['basename'], $matches)){ |
|
540 | + if (preg_match("/xcloner-(\w*)/", $file['basename'], $matches)) { |
|
541 | 541 | $this->logger->info(sprintf('Deleting temporary folder %s', $file['path'])); |
542 | 542 | $this->target_filesystem->deleteDir($file['path']); |
543 | 543 | } |
@@ -550,29 +550,29 @@ discard block |
||
550 | 550 | |
551 | 551 | private function delete_self() |
552 | 552 | { |
553 | - if($this->filesystem->has("vendor.phar")) |
|
553 | + if ($this->filesystem->has("vendor.phar")) |
|
554 | 554 | { |
555 | 555 | $this->logger->info(sprintf('Deleting vendor.phar')); |
556 | 556 | $this->filesystem->delete("vendor.phar"); |
557 | 557 | } |
558 | - if($this->filesystem->has("vendor")) |
|
558 | + if ($this->filesystem->has("vendor")) |
|
559 | 559 | { |
560 | 560 | $this->logger->info(sprintf('Deleting vendor folder')); |
561 | 561 | $this->filesystem->deleteDir("vendor"); |
562 | 562 | } |
563 | - if($this->filesystem->has("xcloner_restore.php")) |
|
563 | + if ($this->filesystem->has("xcloner_restore.php")) |
|
564 | 564 | { |
565 | 565 | $this->logger->info(sprintf('Deleting xcloner_restore.php')); |
566 | 566 | $this->filesystem->delete("xcloner_restore.php"); |
567 | 567 | } |
568 | 568 | |
569 | - if($this->filesystem->has("xcloner_restore.log")) |
|
569 | + if ($this->filesystem->has("xcloner_restore.log")) |
|
570 | 570 | { |
571 | 571 | $this->logger->info(sprintf('Deleting xcloner_restore.log')); |
572 | 572 | $this->filesystem->delete("xcloner_restore.log"); |
573 | 573 | } |
574 | 574 | |
575 | - if($this->filesystem->has($this->get_logger_filename())) |
|
575 | + if ($this->filesystem->has($this->get_logger_filename())) |
|
576 | 576 | { |
577 | 577 | $this->logger->info(sprintf('Deleting logger file %s', $this->get_logger_filename())); |
578 | 578 | $this->filesystem->delete($this->get_logger_filename()); |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | |
587 | 587 | $this->logger->info(sprintf('Updating site url to %s', $url)); |
588 | 588 | |
589 | - if(file_exists($wp_config)) |
|
589 | + if (file_exists($wp_config)) |
|
590 | 590 | { |
591 | 591 | $config = file_get_contents($wp_config); |
592 | 592 | preg_match("/.*table_prefix.*=.*'(.*)'/i", $config, $matches); |
593 | - if(isset($matches[1])) |
|
593 | + if (isset($matches[1])) |
|
594 | 594 | $table_prefix = $matches[1]; |
595 | 595 | else |
596 | 596 | throw new Exception("Could not load wordpress table prefix from wp-config.php file."); |
@@ -598,10 +598,10 @@ discard block |
||
598 | 598 | else |
599 | 599 | throw new Exception("Could not update the SITEURL and HOME, wp-config.php file not found"); |
600 | 600 | |
601 | - if(!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='home'")) |
|
601 | + if (!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='home'")) |
|
602 | 602 | throw new Exception(sprintf("Could not update the HOME option, error: %s\n", $mysqli->error)); |
603 | 603 | |
604 | - if(!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='siteurl'")) |
|
604 | + if (!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='siteurl'")) |
|
605 | 605 | throw new Exception(sprintf("Could not update the SITEURL option, error: %s\n", $mysqli->error)); |
606 | 606 | |
607 | 607 | return true; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | { |
612 | 612 | $wp_config = $remote_path.DS."wp-config.php"; |
613 | 613 | |
614 | - if(!file_exists($wp_config)) |
|
614 | + if (!file_exists($wp_config)) |
|
615 | 615 | { |
616 | 616 | throw new Exception("Could not find the wp-config.php in ".$remote_path); |
617 | 617 | } |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | $this->logger->info(sprintf('Updating wp-config.php file with the new mysql details')); |
631 | 631 | |
632 | - if(!file_put_contents($wp_config, $content)) |
|
632 | + if (!file_put_contents($wp_config, $content)) |
|
633 | 633 | throw new Exception("Could not write updated config data to ".$wp_config); |
634 | 634 | |
635 | 635 | chmod($wp_config, $file_perms); |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | $hash = $this->get_hash_from_backup($source_backup_file); |
647 | 647 | |
648 | - $this->target_adapter = new Local($remote_path ,LOCK_EX, 'SKIP_LINKS'); |
|
648 | + $this->target_adapter = new Local($remote_path, LOCK_EX, 'SKIP_LINKS'); |
|
649 | 649 | $this->target_filesystem = new Filesystem($this->target_adapter, new Config([ |
650 | 650 | 'disable_asserts' => true, |
651 | 651 | ])); |
@@ -653,25 +653,25 @@ discard block |
||
653 | 653 | $mysqldump_list = array(); |
654 | 654 | $list = $this->target_filesystem->listContents(); |
655 | 655 | |
656 | - foreach($list as $file) |
|
656 | + foreach ($list as $file) |
|
657 | 657 | { |
658 | 658 | $matches = array(); |
659 | 659 | |
660 | - if($file['type'] == "dir") |
|
660 | + if ($file['type'] == "dir") |
|
661 | 661 | { |
662 | - if(preg_match("/xcloner-(\w*)/", $file['basename'], $matches)) |
|
662 | + if (preg_match("/xcloner-(\w*)/", $file['basename'], $matches)) |
|
663 | 663 | { |
664 | 664 | $files = $this->target_filesystem->listContents($file['basename']); |
665 | - foreach($files as $file) |
|
665 | + foreach ($files as $file) |
|
666 | 666 | { |
667 | - if($file['extension'] == "sql") |
|
667 | + if ($file['extension'] == "sql") |
|
668 | 668 | { |
669 | 669 | $this->logger->info(sprintf('Found %s mysql backup file', $file['path'])); |
670 | 670 | $mysqldump_list[$file['path']]['path'] = $file['path']; |
671 | 671 | $mysqldump_list[$file['path']]['size'] = $file['size']; |
672 | - $mysqldump_list[$file['path']]['timestamp'] = date("d M,Y H:i",$file['timestamp']); |
|
672 | + $mysqldump_list[$file['path']]['timestamp'] = date("d M,Y H:i", $file['timestamp']); |
|
673 | 673 | |
674 | - if($hash and $hash == $matches[1]) |
|
674 | + if ($hash and $hash == $matches[1]) |
|
675 | 675 | $mysqldump_list[$file['path']]['selected'] = "selected"; |
676 | 676 | else |
677 | 677 | $mysqldump_list[$file['path']]['selected'] = ""; |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | } |
682 | 682 | } |
683 | 683 | |
684 | - $this->sort_by($mysqldump_list, 'timestamp','desc'); |
|
684 | + $this->sort_by($mysqldump_list, 'timestamp', 'desc'); |
|
685 | 685 | $return['files'] = $mysqldump_list; |
686 | 686 | |
687 | 687 | $this->send_response(200, $return); |
@@ -689,12 +689,12 @@ discard block |
||
689 | 689 | |
690 | 690 | private function get_hash_from_backup($backup_file) |
691 | 691 | { |
692 | - if(!$backup_file) |
|
692 | + if (!$backup_file) |
|
693 | 693 | return false; |
694 | 694 | |
695 | - $result = preg_match("/-(\w*)./", substr($backup_file, strlen($backup_file)-10, strlen($backup_file)), $matches) ; |
|
695 | + $result = preg_match("/-(\w*)./", substr($backup_file, strlen($backup_file) - 10, strlen($backup_file)), $matches); |
|
696 | 696 | |
697 | - if($result and isset($matches[1])) |
|
697 | + if ($result and isset($matches[1])) |
|
698 | 698 | return ($matches[1]); |
699 | 699 | |
700 | 700 | return false; |
@@ -708,18 +708,18 @@ discard block |
||
708 | 708 | $backup_files = array(); |
709 | 709 | $parents = array(); |
710 | 710 | |
711 | - foreach($list as $file_info) |
|
711 | + foreach ($list as $file_info) |
|
712 | 712 | { |
713 | 713 | $data = array(); |
714 | 714 | |
715 | - if(isset($file_info['extension']) and $file_info['extension'] == "csv") |
|
715 | + if (isset($file_info['extension']) and $file_info['extension'] == "csv") |
|
716 | 716 | { |
717 | 717 | $lines = explode(PHP_EOL, $this->filesystem->read($file_info['path'])); |
718 | - foreach($lines as $line) |
|
719 | - if($line) |
|
718 | + foreach ($lines as $line) |
|
719 | + if ($line) |
|
720 | 720 | { |
721 | 721 | $data = str_getcsv($line); |
722 | - if(is_array($data)){ |
|
722 | + if (is_array($data)) { |
|
723 | 723 | $parents[$data[0]] = $file_info['path']; |
724 | 724 | $file_info['childs'][] = $data; |
725 | 725 | $file_info['size'] += $data[2]; |
@@ -728,19 +728,19 @@ discard block |
||
728 | 728 | |
729 | 729 | } |
730 | 730 | |
731 | - if($file_info['type'] == 'file' and isset($file_info['extension']) and in_array($file_info['extension'], $this->backup_archive_extensions)) |
|
731 | + if ($file_info['type'] == 'file' and isset($file_info['extension']) and in_array($file_info['extension'], $this->backup_archive_extensions)) |
|
732 | 732 | $backup_files[$file_info['path']] = $file_info; |
733 | 733 | } |
734 | 734 | |
735 | 735 | $new_list = array(); |
736 | 736 | |
737 | - foreach($backup_files as $key=>$file_info) |
|
737 | + foreach ($backup_files as $key=>$file_info) |
|
738 | 738 | { |
739 | - if(isset($parents[$file_info['path']])) |
|
739 | + if (isset($parents[$file_info['path']])) |
|
740 | 740 | $backup_files[$key]['parent'] = $parents[$file_info['path']]; |
741 | - else{ |
|
741 | + else { |
|
742 | 742 | |
743 | - if($local_backup_file and ($file_info['basename'] == $local_backup_file)) |
|
743 | + if ($local_backup_file and ($file_info['basename'] == $local_backup_file)) |
|
744 | 744 | $file_info['selected'] = 'selected'; |
745 | 745 | |
746 | 746 | $this->logger->info(sprintf('Found %s backup file', $file_info['path'])); |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | |
751 | 751 | } |
752 | 752 | |
753 | - $this->sort_by($new_list, "timestamp","desc"); |
|
753 | + $this->sort_by($new_list, "timestamp", "desc"); |
|
754 | 754 | |
755 | 755 | $return['files'] = $new_list; |
756 | 756 | |
@@ -760,15 +760,15 @@ discard block |
||
760 | 760 | |
761 | 761 | public function restore_backup_to_path_action() |
762 | 762 | { |
763 | - $source_backup_file = filter_input(INPUT_POST, 'backup_file', FILTER_SANITIZE_STRING); |
|
764 | - $remote_path = filter_input(INPUT_POST, 'remote_path', FILTER_SANITIZE_STRING); |
|
763 | + $source_backup_file = filter_input(INPUT_POST, 'backup_file', FILTER_SANITIZE_STRING); |
|
764 | + $remote_path = filter_input(INPUT_POST, 'remote_path', FILTER_SANITIZE_STRING); |
|
765 | 765 | $include_filter_files = filter_input(INPUT_POST, 'filter_files', FILTER_SANITIZE_STRING); |
766 | 766 | $exclude_filter_files = ""; |
767 | - $start = filter_input(INPUT_POST, 'start', FILTER_SANITIZE_NUMBER_INT); |
|
768 | - $return['part'] = (int)filter_input(INPUT_POST, 'part', FILTER_SANITIZE_NUMBER_INT); |
|
767 | + $start = filter_input(INPUT_POST, 'start', FILTER_SANITIZE_NUMBER_INT); |
|
768 | + $return['part'] = (int)filter_input(INPUT_POST, 'part', FILTER_SANITIZE_NUMBER_INT); |
|
769 | 769 | $return['processed'] = (int)filter_input(INPUT_POST, 'processed', FILTER_SANITIZE_NUMBER_INT); |
770 | 770 | |
771 | - $this->target_adapter = new Local($remote_path ,LOCK_EX, 'SKIP_LINKS'); |
|
771 | + $this->target_adapter = new Local($remote_path, LOCK_EX, 'SKIP_LINKS'); |
|
772 | 772 | $this->target_filesystem = new Filesystem($this->target_adapter, new Config([ |
773 | 773 | 'disable_asserts' => true, |
774 | 774 | ])); |
@@ -780,9 +780,9 @@ discard block |
||
780 | 780 | $return['total_size'] = $this->get_backup_size($backup_file); |
781 | 781 | |
782 | 782 | $backup_archive = new Tar(); |
783 | - if($this->is_multipart($backup_file)) |
|
783 | + if ($this->is_multipart($backup_file)) |
|
784 | 784 | { |
785 | - if(!$return['part']) |
|
785 | + if (!$return['part']) |
|
786 | 786 | $return['processed'] += $this->filesystem->getSize($backup_file); |
787 | 787 | |
788 | 788 | $backup_parts = $this->get_multipart_files($backup_file); |
@@ -790,41 +790,41 @@ discard block |
||
790 | 790 | } |
791 | 791 | |
792 | 792 | $this->logger->info(sprintf('Opening backup archive %s at position %s', $backup_file, $start)); |
793 | - $backup_archive->open($this->backup_storage_dir .DS. $backup_file, $start); |
|
793 | + $backup_archive->open($this->backup_storage_dir.DS.$backup_file, $start); |
|
794 | 794 | |
795 | - $data = $backup_archive->extract($remote_path, '',$exclude_filter_files,$include_filter_files, $this->process_files_limit); |
|
795 | + $data = $backup_archive->extract($remote_path, '', $exclude_filter_files, $include_filter_files, $this->process_files_limit); |
|
796 | 796 | |
797 | - if(isset($data['extracted_files'])) |
|
797 | + if (isset($data['extracted_files'])) |
|
798 | 798 | { |
799 | - foreach($data['extracted_files'] as $spl_fileinfo) |
|
799 | + foreach ($data['extracted_files'] as $spl_fileinfo) |
|
800 | 800 | { |
801 | 801 | $this->logger->info(sprintf('Extracted %s file', $spl_fileinfo->getPath())); |
802 | 802 | $return['extracted_files'][] = $spl_fileinfo->getPath()." (".$spl_fileinfo->getSize()." bytes)"; |
803 | 803 | } |
804 | 804 | } |
805 | 805 | |
806 | - if(isset($data['start'])) |
|
806 | + if (isset($data['start'])) |
|
807 | 807 | //if(isset($data['start']) and $data['start'] <= $this->filesystem->getSize($backup_file)) |
808 | 808 | { |
809 | 809 | $return['finished'] = 0; |
810 | 810 | $return['start'] = $data['start']; |
811 | - }else{ |
|
811 | + } else { |
|
812 | 812 | |
813 | 813 | $return['processed'] += $start; |
814 | 814 | |
815 | - if($this->is_multipart($source_backup_file)) |
|
815 | + if ($this->is_multipart($source_backup_file)) |
|
816 | 816 | { |
817 | 817 | $return['start'] = 0; |
818 | 818 | |
819 | 819 | ++$return['part']; |
820 | 820 | |
821 | - if($return['part'] < sizeof($backup_parts)) |
|
821 | + if ($return['part'] < sizeof($backup_parts)) |
|
822 | 822 | $return['finished'] = 0; |
823 | 823 | |
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
827 | - if($return['finished']) |
|
827 | + if ($return['finished']) |
|
828 | 828 | $this->logger->info(sprintf('Done extracting %s', $source_backup_file)); |
829 | 829 | |
830 | 830 | $return['backup_file'] = $backup_file; |
@@ -838,24 +838,24 @@ discard block |
||
838 | 838 | |
839 | 839 | $restore_script_url = filter_input(INPUT_POST, 'restore_script_url', FILTER_SANITIZE_STRING); |
840 | 840 | |
841 | - $pathinfo = pathinfo( __FILE__); |
|
841 | + $pathinfo = pathinfo(__FILE__); |
|
842 | 842 | |
843 | 843 | $suffix = ""; |
844 | 844 | $return['remote_mysql_host'] = "localhost"; |
845 | 845 | $return['remote_mysql_user'] = ""; |
846 | 846 | $return['remote_mysql_pass'] = ""; |
847 | - $return['remote_mysql_db'] = ""; |
|
847 | + $return['remote_mysql_db'] = ""; |
|
848 | 848 | |
849 | - if(defined('XCLONER_PLUGIN_ACCESS') && XCLONER_PLUGIN_ACCESS) |
|
849 | + if (defined('XCLONER_PLUGIN_ACCESS') && XCLONER_PLUGIN_ACCESS) |
|
850 | 850 | { |
851 | 851 | $return['dir'] = realpath(get_home_path().DS.$suffix); |
852 | - $return['restore_script_url'] = get_site_url(); |
|
852 | + $return['restore_script_url'] = get_site_url(); |
|
853 | 853 | $return['remote_mysql_host'] = $wpdb->dbhost; |
854 | 854 | $return['remote_mysql_user'] = $wpdb->dbuser; |
855 | 855 | $return['remote_mysql_pass'] = $wpdb->dbpassword; |
856 | - $return['remote_mysql_db'] = $wpdb->dbname; |
|
856 | + $return['remote_mysql_db'] = $wpdb->dbname; |
|
857 | 857 | } |
858 | - else{ |
|
858 | + else { |
|
859 | 859 | $return['dir'] = ($pathinfo['dirname']).DS.$suffix; |
860 | 860 | $return['restore_script_url'] = str_replace($pathinfo['basename'], "", $restore_script_url).$suffix; |
861 | 861 | } |
@@ -869,17 +869,17 @@ discard block |
||
869 | 869 | { |
870 | 870 | //check if i can write |
871 | 871 | $tmp_file = md5(time()); |
872 | - if(!file_put_contents($tmp_file, "++")) |
|
872 | + if (!file_put_contents($tmp_file, "++")) |
|
873 | 873 | throw new Exception("Could not write to new host"); |
874 | 874 | |
875 | - if(!unlink($tmp_file)) |
|
875 | + if (!unlink($tmp_file)) |
|
876 | 876 | throw new Exception("Could not delete temporary file from new host"); |
877 | 877 | |
878 | 878 | $max_upload = $this->return_bytes((ini_get('upload_max_filesize'))); |
879 | 879 | $max_post = $this->return_bytes((ini_get('post_max_size'))); |
880 | 880 | |
881 | 881 | $return['max_upload_size'] = min($max_upload, $max_post); // bytes |
882 | - $return['status'] = true; |
|
882 | + $return['status'] = true; |
|
883 | 883 | |
884 | 884 | $this->logger->info(sprintf('Current filesystem max upload size is %s bytes', $return['max_upload_size'])); |
885 | 885 | |
@@ -888,8 +888,8 @@ discard block |
||
888 | 888 | |
889 | 889 | private function return_bytes($val) { |
890 | 890 | $val = trim($val); |
891 | - $last = strtolower($val[strlen($val)-1]); |
|
892 | - switch($last) { |
|
891 | + $last = strtolower($val[strlen($val) - 1]); |
|
892 | + switch ($last) { |
|
893 | 893 | // The 'G' modifier is available since PHP 5.1.0 |
894 | 894 | case 'g': |
895 | 895 | $val *= 1024; |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | |
905 | 905 | public function is_multipart($backup_name) |
906 | 906 | { |
907 | - if(stristr($backup_name, "-multipart")) |
|
907 | + if (stristr($backup_name, "-multipart")) |
|
908 | 908 | return true; |
909 | 909 | |
910 | 910 | return false; |
@@ -913,10 +913,10 @@ discard block |
||
913 | 913 | public function get_backup_size($backup_name) |
914 | 914 | { |
915 | 915 | $backup_size = $this->filesystem->getSize($backup_name); |
916 | - if($this->is_multipart($backup_name)) |
|
916 | + if ($this->is_multipart($backup_name)) |
|
917 | 917 | { |
918 | 918 | $backup_parts = $this->get_multipart_files($backup_name); |
919 | - foreach($backup_parts as $part_file) |
|
919 | + foreach ($backup_parts as $part_file) |
|
920 | 920 | $backup_size += $this->filesystem->getSize($part_file); |
921 | 921 | } |
922 | 922 | |
@@ -927,12 +927,12 @@ discard block |
||
927 | 927 | { |
928 | 928 | $files = array(); |
929 | 929 | |
930 | - if($this->is_multipart($backup_name)) |
|
930 | + if ($this->is_multipart($backup_name)) |
|
931 | 931 | { |
932 | 932 | $lines = explode(PHP_EOL, $this->filesystem->read($backup_name)); |
933 | - foreach($lines as $line) |
|
933 | + foreach ($lines as $line) |
|
934 | 934 | { |
935 | - if($line) |
|
935 | + if ($line) |
|
936 | 936 | { |
937 | 937 | $data = str_getcsv($line); |
938 | 938 | $files[] = $data[0]; |
@@ -943,20 +943,20 @@ discard block |
||
943 | 943 | return $files; |
944 | 944 | } |
945 | 945 | |
946 | - private function sort_by( &$array, $field, $direction = 'asc') |
|
946 | + private function sort_by(&$array, $field, $direction = 'asc') |
|
947 | 947 | { |
948 | 948 | $direction = strtolower($direction); |
949 | 949 | |
950 | 950 | usort($array, create_function('$a, $b', ' |
951 | - $a = $a["' . $field . '"]; |
|
952 | - $b = $b["' . $field . '"]; |
|
951 | + $a = $a["' . $field.'"]; |
|
952 | + $b = $b["' . $field.'"]; |
|
953 | 953 | |
954 | 954 | if ($a == $b) |
955 | 955 | { |
956 | 956 | return 0; |
957 | 957 | } |
958 | 958 | |
959 | - return ($a ' . ($direction == 'desc' ? '>' : '<') .' $b) ? -1 : 1; |
|
959 | + return ($a ' . ($direction == 'desc' ? '>' : '<').' $b) ? -1 : 1; |
|
960 | 960 | ')); |
961 | 961 | |
962 | 962 | return true; |
@@ -970,11 +970,11 @@ discard block |
||
970 | 970 | $return['status'] = $status; |
971 | 971 | $return['statusText'] = $response; |
972 | 972 | |
973 | - if(isset($response['error']) && $response['error']) |
|
973 | + if (isset($response['error']) && $response['error']) |
|
974 | 974 | { |
975 | 975 | $return['statusText'] = $response['message']; |
976 | 976 | $return['error'] = true; |
977 | - }elseif($status != 200 and $status != 418) |
|
977 | + }elseif ($status != 200 and $status != 418) |
|
978 | 978 | { |
979 | 979 | $return['error'] = true; |
980 | 980 | $return['message'] = $response; |
@@ -990,12 +990,12 @@ discard block |
||
990 | 990 | |
991 | 991 | function do_serialized_fix($query) |
992 | 992 | { |
993 | - $query = str_replace(array("\\n","\\r","\\'"), array("","","\""), ($query)); |
|
993 | + $query = str_replace(array("\\n", "\\r", "\\'"), array("", "", "\""), ($query)); |
|
994 | 994 | |
995 | - return preg_replace_callback('!s:(\d+):([\\\\]?"[\\\\]?"|[\\\\]?"((.*?)[^\\\\])[\\\\]?");!', function ($m) { |
|
995 | + return preg_replace_callback('!s:(\d+):([\\\\]?"[\\\\]?"|[\\\\]?"((.*?)[^\\\\])[\\\\]?");!', function($m) { |
|
996 | 996 | $data = ""; |
997 | 997 | |
998 | - if(!isset($m[3])) |
|
998 | + if (!isset($m[3])) |
|
999 | 999 | $m[3] = ""; |
1000 | 1000 | |
1001 | 1001 | $data = 's:'.strlen(($m[3])).':\"'.($m[3]).'\";'; |
@@ -1010,22 +1010,22 @@ discard block |
||
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | private function unescape_mysql($value) { |
1013 | - return str_replace(array("\\\\", "\\0", "\\n", "\\r", "\Z", "\'", '\"'), |
|
1014 | - array("\\", "\0", "\n", "\r", "\x1a", "'", '"'), |
|
1013 | + return str_replace(array("\\\\", "\\0", "\\n", "\\r", "\Z", "\'", '\"'), |
|
1014 | + array("\\", "\0", "\n", "\r", "\x1a", "'", '"'), |
|
1015 | 1015 | $value); |
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
1019 | 1019 | private function has_serialized($s) |
1020 | 1020 | { |
1021 | - if( |
|
1022 | - stristr($s, '{' ) != false && |
|
1023 | - stristr($s, '}' ) != false && |
|
1024 | - stristr($s, ';' ) != false && |
|
1025 | - stristr($s, ':' ) != false |
|
1026 | - ){ |
|
1021 | + if ( |
|
1022 | + stristr($s, '{') != false && |
|
1023 | + stristr($s, '}') != false && |
|
1024 | + stristr($s, ';') != false && |
|
1025 | + stristr($s, ':') != false |
|
1026 | + ) { |
|
1027 | 1027 | return true; |
1028 | - }else{ |
|
1028 | + } else { |
|
1029 | 1029 | return false; |
1030 | 1030 | } |
1031 | 1031 |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
4 | -$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
5 | -$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
6 | -$xcloner_file_transfer = $this->get_xcloner_container()->get_xcloner_file_transfer(); |
|
3 | +$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
4 | +$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
5 | +$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
6 | +$xcloner_file_transfer = $this->get_xcloner_container()->get_xcloner_file_transfer(); |
|
7 | 7 | |
8 | -$start = 0 ; |
|
8 | +$start = 0; |
|
9 | 9 | |
10 | 10 | $backup_list = $xcloner_file_system->get_latest_backups(); |
11 | 11 | |
@@ -21,24 +21,24 @@ discard block |
||
21 | 21 | <div class="col s12"> |
22 | 22 | <ul class="collapsible xcloner-restore " data-collapsible="accordion"> |
23 | 23 | <li data-step="1" class="restore-script-upload-step steps active show"> |
24 | - <div class="collapsible-header active"><i class="material-icons">settings_remote</i><?php echo __("Restore Script Upload",'xcloner-backup-and-restore')?></div> |
|
24 | + <div class="collapsible-header active"><i class="material-icons">settings_remote</i><?php echo __("Restore Script Upload", 'xcloner-backup-and-restore')?></div> |
|
25 | 25 | <div class="collapsible-body row"> |
26 | 26 | |
27 | 27 | <ul class="text-steps"> |
28 | - <li><?php echo __("If you want to do a <strong>Local Target System Restore</strong>, leave Url field below empty and click 'Check Connection', you can skip the next steps.",'xcloner-backup-and-restore')?> |
|
28 | + <li><?php echo __("If you want to do a <strong>Local Target System Restore</strong>, leave Url field below empty and click 'Check Connection', you can skip the next steps.", 'xcloner-backup-and-restore')?> |
|
29 | 29 | </li> |
30 | - <li><?php echo __("If you want to do a <strong>Remote Target System Restore</strong>, please download the restore script from",'xcloner-backup-and-restore')?> <a href='#' onclick="window.location=ajaxurl+'?action=download_restore_script&phar=true'"><strong><?php echo __("here",'xcloner-backup-and-restore')?></strong></a> |
|
30 | + <li><?php echo __("If you want to do a <strong>Remote Target System Restore</strong>, please download the restore script from", 'xcloner-backup-and-restore')?> <a href='#' onclick="window.location=ajaxurl+'?action=download_restore_script&phar=true'"><strong><?php echo __("here", 'xcloner-backup-and-restore')?></strong></a> |
|
31 | 31 | </li> |
32 | 32 | <li> |
33 | - <?php echo __("Extract the restore script archive files on your new host",'xcloner-backup-and-restore')?> |
|
33 | + <?php echo __("Extract the restore script archive files on your new host", 'xcloner-backup-and-restore')?> |
|
34 | 34 | </li> |
35 | 35 | <li> |
36 | - <?php echo __("Provide url below to the <u>xcloner_restore.php</u> restore script, like http://my_restore_site.com/xcloner_restore.php",'xcloner-backup-and-restore')?> |
|
36 | + <?php echo __("Provide url below to the <u>xcloner_restore.php</u> restore script, like http://my_restore_site.com/xcloner_restore.php", 'xcloner-backup-and-restore')?> |
|
37 | 37 | </li> |
38 | 38 | <li> |
39 | - <?php echo __("If your server is not web accessible, like a localhost computer, you can use a DynDNS service or install a blank copy of Wordpress with XCloner in the same environment and start the restore from there.",'xcloner-backup-and-restore')?> |
|
39 | + <?php echo __("If your server is not web accessible, like a localhost computer, you can use a DynDNS service or install a blank copy of Wordpress with XCloner in the same environment and start the restore from there.", 'xcloner-backup-and-restore')?> |
|
40 | 40 | </li> |
41 | - <?php if(is_ssl()):?> |
|
41 | + <?php if (is_ssl()):?> |
|
42 | 42 | <li class="warning"> |
43 | 43 | <?php echo __("We have detected your connection to the site as being secure, so your restore script address must start with https://.")?> |
44 | 44 | </li> |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | </ul> |
48 | 48 | |
49 | 49 | <div class="input-field col l9 s12"> |
50 | - <input value="<?php echo (is_ssl())?"https://":""?>" id="restore_script_url" type="text" class="validate" placeholder="Url to XCloner Restore Script, example http://myddns.com/xcloner/xcloner_restore.php" > |
|
50 | + <input value="<?php echo (is_ssl()) ? "https://" : ""?>" id="restore_script_url" type="text" class="validate" placeholder="Url to XCloner Restore Script, example http://myddns.com/xcloner/xcloner_restore.php" > |
|
51 | 51 | <label for="restore_script_url"></label> |
52 | 52 | <div id="url_validation_status" class="status"></div> |
53 | 53 | </div> |
54 | 54 | <div class="col l3 s12 right-align"> |
55 | - <button class="btn waves-effect waves-light" type="submit" id="validate_url" name="action"><?php echo __("Check Connection",'xcloner-backup-and-restore')?> |
|
55 | + <button class="btn waves-effect waves-light" type="submit" id="validate_url" name="action"><?php echo __("Check Connection", 'xcloner-backup-and-restore')?> |
|
56 | 56 | <i class="material-icons right">send</i> |
57 | 57 | </button> |
58 | 58 | </div> |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | </li> |
61 | 61 | |
62 | 62 | <li data-step="2" class="backup-upload-step steps"> |
63 | - <div class="collapsible-header active"><i class="material-icons">file_upload</i><?php echo __("Upload Local Backup Archive To Target Host",'xcloner-backup-and-restore')?> |
|
63 | + <div class="collapsible-header active"><i class="material-icons">file_upload</i><?php echo __("Upload Local Backup Archive To Target Host", 'xcloner-backup-and-restore')?> |
|
64 | 64 | </div> |
65 | 65 | <div class="collapsible-body row"> |
66 | - <p><?php echo __("You can skip this step if you want to transfer the archive in some other way, make sure you upload it in the same directory as the restore script from the previous step.",'xcloner-backup-and-restore')?></p> |
|
66 | + <p><?php echo __("You can skip this step if you want to transfer the archive in some other way, make sure you upload it in the same directory as the restore script from the previous step.", 'xcloner-backup-and-restore')?></p> |
|
67 | 67 | <div class="input-field col s12 l7"> |
68 | 68 | <select id="backup_file" name="backup_file" class="browser-default"> |
69 | - <option value="" disabled selected><?php echo __("Please select a local backup archive to upload to target host",'xcloner-backup-and-restore')?></option> |
|
70 | - <?php if(is_array($backup_list)):?> |
|
71 | - <?php foreach($backup_list as $file):?> |
|
69 | + <option value="" disabled selected><?php echo __("Please select a local backup archive to upload to target host", 'xcloner-backup-and-restore')?></option> |
|
70 | + <?php if (is_array($backup_list)):?> |
|
71 | + <?php foreach ($backup_list as $file):?> |
|
72 | 72 | <option value="<?php echo $file['basename']?>"> |
73 | 73 | <?php echo $file['basename']?> (<?php echo size_format($file['size'])?>) |
74 | 74 | </option> |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | </div> |
85 | 85 | <div class="col s12 l5 right-align"> |
86 | 86 | <div class="toggler"> |
87 | - <button class="btn waves-effect waves-light upload-backup normal" type="submit" id="" name="action"><?php echo __("Upload",'xcloner-backup-and-restore')?> |
|
87 | + <button class="btn waves-effect waves-light upload-backup normal" type="submit" id="" name="action"><?php echo __("Upload", 'xcloner-backup-and-restore')?> |
|
88 | 88 | <i class="material-icons left">navigate_before</i> |
89 | 89 | </button> |
90 | - <button class="btn waves-effect waves-light red upload-backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?> |
|
90 | + <button class="btn waves-effect waves-light red upload-backup cancel" type="submit" id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore')?> |
|
91 | 91 | <i class="material-icons right">close</i> |
92 | 92 | </button> |
93 | 93 | </div> |
94 | - <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_upload_backup" name="action"><?php echo __("Skip Next",'xcloner-backup-and-restore')?> |
|
94 | + <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next", 'xcloner-backup-and-restore')?>" id="skip_upload_backup" name="action"><?php echo __("Skip Next", 'xcloner-backup-and-restore')?> |
|
95 | 95 | <i class="material-icons right">navigate_next</i> |
96 | 96 | </button> |
97 | 97 | </div> |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | </li> |
100 | 100 | |
101 | 101 | <li data-step="3" class="restore-remote-backup-step steps active"> |
102 | - <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Restore Files Backup Available On Target Location",'xcloner-backup-and-restore')?> |
|
102 | + <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Restore Files Backup Available On Target Location", 'xcloner-backup-and-restore')?> |
|
103 | 103 | <i class="material-icons right" title="Refresh Target Backup Files List" id="refresh_remote_backup_file">cached</i> |
104 | 104 | |
105 | 105 | <div class="switch right"> |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | data-tooltip="<?php echo __("This is the directory where you would like to restore the backup archive files.<br /> |
121 | 121 | Please use this with caution when restoring to a live site.",'xcloner-backup-and-restore')?>"><i class="material-icons">help_outline</i> |
122 | 122 | </a> |
123 | - <h5><?php echo __("Restore Target Path:",'xcloner-backup-and-restore')?></h5> |
|
123 | + <h5><?php echo __("Restore Target Path:", 'xcloner-backup-and-restore')?></h5> |
|
124 | 124 | <input type="text" name="remote_restore_path" id="remote_restore_path" class="validate" placeholder="Restore Target Path"> |
125 | 125 | <label></label> |
126 | 126 | </div> |
@@ -133,40 +133,40 @@ discard block |
||
133 | 133 | class="list-backup-content btn-floating tooltipped btn-small right" data-tooltip="<?php echo __('Click To List The Selected Backup Content', 'xcloner-backup-and-restore') ?>"> |
134 | 134 | <i class="material-icons">folder_open</i> |
135 | 135 | </a> |
136 | - <h5><?php echo __("Restore Backup Archive:",'xcloner-backup-and-restore')?></h5> |
|
136 | + <h5><?php echo __("Restore Backup Archive:", 'xcloner-backup-and-restore')?></h5> |
|
137 | 137 | <select id="remote_backup_file" name="remote_backup_file" class="browser-default"> |
138 | - <option value="" disabled selected><?php echo __("Please select the target backup file to restore",'xcloner-backup-and-restore')?></option> |
|
138 | + <option value="" disabled selected><?php echo __("Please select the target backup file to restore", 'xcloner-backup-and-restore')?></option> |
|
139 | 139 | </select> |
140 | 140 | <label></label> |
141 | 141 | </div> |
142 | 142 | |
143 | 143 | <div class="col s12"> |
144 | 144 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_all" checked value="" disabled /> |
145 | - <label for="filter_files_all" class="tooltipped" data-position="right" data-tooltip="<?php echo __("Restore all backup files. Available only when doing a Remote Target System Restore", 'xcloner-backup-and-restore')?>"><?php echo __("Restore All Files","xcloner-backup-and-restore")?></label> |
|
145 | + <label for="filter_files_all" class="tooltipped" data-position="right" data-tooltip="<?php echo __("Restore all backup files. Available only when doing a Remote Target System Restore", 'xcloner-backup-and-restore')?>"><?php echo __("Restore All Files", "xcloner-backup-and-restore")?></label> |
|
146 | 146 | |
147 | 147 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_wp_content" value="/^wp-content\/(.*)/" /> |
148 | 148 | <label for="filter_files_wp_content" class="tooltipped" data-tooltip="<?php echo __('Restore the files only of the wp-content/ folder', 'xcloner-backup-and-restore')?>"> |
149 | - <?php echo __("Only wp-content","xcloner-backup-and-restore")?> |
|
149 | + <?php echo __("Only wp-content", "xcloner-backup-and-restore")?> |
|
150 | 150 | </label> |
151 | 151 | |
152 | 152 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_plugins" value="/^wp-content\/plugins(.*)/" /> |
153 | 153 | <label for="filter_files_plugins" class="tooltipped" data-tooltip="<?php echo __('Restore the files only of the wp-content/plugins/ folder', 'xcloner-backup-and-restore')?>"> |
154 | - <?php echo __("Only Plugins","xcloner-backup-and-restore")?> |
|
154 | + <?php echo __("Only Plugins", "xcloner-backup-and-restore")?> |
|
155 | 155 | </label> |
156 | 156 | |
157 | 157 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_uploads" value="/^wp-content\/uploads(.*)/" /> |
158 | 158 | <label for="filter_files_uploads" class="tooltipped" data-tooltip="<?php echo __('Restore the files only of the wp-content/uploads/ folder only', 'xcloner-backup-and-restore')?>"> |
159 | - <?php echo __("Only Uploads","xcloner-backup-and-restore")?> |
|
159 | + <?php echo __("Only Uploads", "xcloner-backup-and-restore")?> |
|
160 | 160 | </label> |
161 | 161 | |
162 | 162 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_themes" value="/^wp-content\/themes(.*)/" /> |
163 | 163 | <label for="filter_files_themes" class="tooltipped" data-tooltip="<?php echo __('Restore the files only of the wp-content/themes/ folder', 'xcloner-backup-and-restore')?>"> |
164 | - <?php echo __("Only Themes","xcloner-backup-and-restore")?> |
|
164 | + <?php echo __("Only Themes", "xcloner-backup-and-restore")?> |
|
165 | 165 | </label> |
166 | 166 | |
167 | 167 | <input class="with-gap" name="filter_files" type="radio" id="filter_files_database" value="/^xcloner-(.*)\/(.*)\.sql/"/> |
168 | 168 | <label for="filter_files_database" class="tooltipped" data-tooltip="<?php echo __('Restore the database-sql.sql mysql backup from the xcloner-xxxxx/ folder', 'xcloner-backup-and-restore')?>"> |
169 | - <?php echo __("Only Database Backup","xcloner-backup-and-restore")?> |
|
169 | + <?php echo __("Only Database Backup", "xcloner-backup-and-restore")?> |
|
170 | 170 | </label> |
171 | 171 | </div> |
172 | 172 | </div> |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | |
182 | 182 | <div class="col s12 l5 right-align"> |
183 | 183 | <div class="toggler"> |
184 | - <button class="btn waves-effect waves-light restore_remote_backup normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?> |
|
184 | + <button class="btn waves-effect waves-light restore_remote_backup normal " type="submit" id="" name="action"><?php echo __("Restore", 'xcloner-backup-and-restore')?> |
|
185 | 185 | <i class="material-icons left">navigate_before</i> |
186 | 186 | </button> |
187 | - <button class="btn waves-effect waves-light red restore_remote_backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?> |
|
187 | + <button class="btn waves-effect waves-light red restore_remote_backup cancel" type="submit" id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore')?> |
|
188 | 188 | <i class="material-icons right">close</i> |
189 | 189 | </button> |
190 | 190 | </div> |
191 | - <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_remote_backup_step" name="action"><?php echo __("Skip Next",'xcloner-backup-and-restore')?> |
|
191 | + <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next", 'xcloner-backup-and-restore')?>" id="skip_remote_backup_step" name="action"><?php echo __("Skip Next", 'xcloner-backup-and-restore')?> |
|
192 | 192 | <i class="material-icons right">navigate_next</i> |
193 | 193 | </button> |
194 | 194 | </div> |
@@ -196,66 +196,66 @@ discard block |
||
196 | 196 | </li> |
197 | 197 | |
198 | 198 | <li data-step="4" class="restore-remote-database-step steps active"> |
199 | - <div class="collapsible-header"><i class="material-icons">list</i><?php echo __("Restore Target Database - Search and Replace",'xcloner-backup-and-restore')?> |
|
199 | + <div class="collapsible-header"><i class="material-icons">list</i><?php echo __("Restore Target Database - Search and Replace", 'xcloner-backup-and-restore')?> |
|
200 | 200 | <i class="material-icons right" title="Refresh Database Backup Files List" id="refresh_database_file">cached</i> |
201 | 201 | </div> |
202 | 202 | <div class="collapsible-body row"> |
203 | 203 | |
204 | 204 | <div id="remote-restore-options"> |
205 | 205 | <div class="col s12"> |
206 | - <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-html="true" data-tooltip="<?php echo __('Please provide below the mysql connection details for the target host database.<br />For live sites we recommend using a new separate database.','xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
207 | - <h5><?php echo __('Target Mysql Details','xcloner-backup-and-restore')?></h5> |
|
206 | + <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-html="true" data-tooltip="<?php echo __('Please provide below the mysql connection details for the target host database.<br />For live sites we recommend using a new separate database.', 'xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
207 | + <h5><?php echo __('Target Mysql Details', 'xcloner-backup-and-restore')?></h5> |
|
208 | 208 | </div> |
209 | 209 | <div class=" col s12"> |
210 | 210 | <div class="input-field col s12 m6"> |
211 | 211 | <input type="text" name="remote_mysql_host" id="remote_mysql_host" class="validate" placeholder="Target Mysql Hostname"> |
212 | - <label><?php echo __("Target Mysql Hostname",'xcloner-backup-and-restore')?></label> |
|
212 | + <label><?php echo __("Target Mysql Hostname", 'xcloner-backup-and-restore')?></label> |
|
213 | 213 | </div> |
214 | 214 | |
215 | 215 | <div class="input-field col s12 m6"> |
216 | 216 | <input type="text" name="remote_mysql_db" id="remote_mysql_db" class="validate" placeholder="Target Mysql Database"> |
217 | - <label><?php echo __("Target Mysql Database",'xcloner-backup-and-restore')?></label> |
|
217 | + <label><?php echo __("Target Mysql Database", 'xcloner-backup-and-restore')?></label> |
|
218 | 218 | </div> |
219 | 219 | |
220 | 220 | <div class="input-field col s12 m6"> |
221 | 221 | <input type="text" name="remote_mysql_user" id="remote_mysql_user" class="validate" placeholder="Target Mysql Username"> |
222 | - <label><?php echo __("Target Mysql Username",'xcloner-backup-and-restore')?></label> |
|
222 | + <label><?php echo __("Target Mysql Username", 'xcloner-backup-and-restore')?></label> |
|
223 | 223 | </div> |
224 | 224 | |
225 | 225 | |
226 | 226 | <div class="input-field col s12 m6"> |
227 | 227 | <input type="text" name="remote_mysql_pass" id="remote_mysql_pass" class="validate" placeholder="Target Mysql Password"> |
228 | - <label><?php echo __("Target Mysql Password",'xcloner-backup-and-restore')?></label> |
|
228 | + <label><?php echo __("Target Mysql Password", 'xcloner-backup-and-restore')?></label> |
|
229 | 229 | </div> |
230 | 230 | |
231 | 231 | </div> |
232 | 232 | <div class="col s12"> |
233 | - <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-html="true" data-tooltip="<?php echo __('I will attempt to replace all mysql backup records matching the provided Source Url with the provided Target Url. <br />Leave blank the Target Url if you would like to skip this option. <br />As a bonus, I will also replace all matching serialized data and fix it\'s parsing.','xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
234 | - <h5><?php echo __('Target Mysql Search and Replace','xcloner-backup-and-restore')?></h5> |
|
233 | + <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-html="true" data-tooltip="<?php echo __('I will attempt to replace all mysql backup records matching the provided Source Url with the provided Target Url. <br />Leave blank the Target Url if you would like to skip this option. <br />As a bonus, I will also replace all matching serialized data and fix it\'s parsing.', 'xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
234 | + <h5><?php echo __('Target Mysql Search and Replace', 'xcloner-backup-and-restore')?></h5> |
|
235 | 235 | </div> |
236 | 236 | <div class="col s12"> |
237 | 237 | <div class="input-field col s12 m6 "> |
238 | - <input type="text" name="wp_home_url" id="wp_home_url" class="validate" placeholder="WP Home Url" value="<?php echo home_url();?>"> |
|
239 | - <label><?php echo __("Source Home Url",'xcloner-backup-and-restore')?></label> |
|
238 | + <input type="text" name="wp_home_url" id="wp_home_url" class="validate" placeholder="WP Home Url" value="<?php echo home_url(); ?>"> |
|
239 | + <label><?php echo __("Source Home Url", 'xcloner-backup-and-restore')?></label> |
|
240 | 240 | </div> |
241 | 241 | |
242 | 242 | <div class="input-field col s12 m6 "> |
243 | 243 | <input type="text" name="remote_restore_url" id="remote_restore_url" class="validate" placeholder="Restore Target Url"> |
244 | - <label><?php echo __("With Target Home Url",'xcloner-backup-and-restore')?></label> |
|
244 | + <label><?php echo __("With Target Home Url", 'xcloner-backup-and-restore')?></label> |
|
245 | 245 | </div> |
246 | 246 | |
247 | - <?php if( site_url() != home_url()) : ?> |
|
247 | + <?php if (site_url() != home_url()) : ?> |
|
248 | 248 | <div class="input-field col s12 m6 "> |
249 | - <input type="text" name="wp_site_url" id="wp_site_url" class="validate" placeholder="WP Site Url" value="<?php echo site_url();?>"> |
|
250 | - <label><?php echo __("Source Site Url",'xcloner-backup-and-restore')?></label> |
|
249 | + <input type="text" name="wp_site_url" id="wp_site_url" class="validate" placeholder="WP Site Url" value="<?php echo site_url(); ?>"> |
|
250 | + <label><?php echo __("Source Site Url", 'xcloner-backup-and-restore')?></label> |
|
251 | 251 | </div> |
252 | 252 | |
253 | 253 | <div class="input-field col s12 m6 "> |
254 | 254 | <input type="text" name="remote_restore_site_url" id="remote_restore_site_url" class="validate" placeholder="Restore Target Url"> |
255 | - <label><?php echo __("With Target Site Url",'xcloner-backup-and-restore')?></label> |
|
255 | + <label><?php echo __("With Target Site Url", 'xcloner-backup-and-restore')?></label> |
|
256 | 256 | </div> |
257 | 257 | |
258 | - <?php endif;?> |
|
258 | + <?php endif; ?> |
|
259 | 259 | </div> |
260 | 260 | |
261 | 261 | </div> |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | <div class=" col s12 l7"> |
264 | 264 | <div class="input-field row"> |
265 | 265 | <select id="remote_database_file" name="remote_database_file" class="browser-default"> |
266 | - <option value="" disabled selected><?php echo __("Please select the target database backup file to restore",'xcloner-backup-and-restore')?></option> |
|
266 | + <option value="" disabled selected><?php echo __("Please select the target database backup file to restore", 'xcloner-backup-and-restore')?></option> |
|
267 | 267 | </select> |
268 | 268 | |
269 | 269 | <label></label> |
@@ -282,15 +282,15 @@ discard block |
||
282 | 282 | |
283 | 283 | <div class="col s12 l5 right-align"> |
284 | 284 | <div class="toggler"> |
285 | - <button class="btn waves-effect waves-light restore_remote_mysqldump normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?> |
|
285 | + <button class="btn waves-effect waves-light restore_remote_mysqldump normal " type="submit" id="" name="action"><?php echo __("Restore", 'xcloner-backup-and-restore')?> |
|
286 | 286 | <i class="material-icons left">navigate_before</i> |
287 | 287 | </button> |
288 | - <button class="btn waves-effect waves-light red restore_remote_mysqldump cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?> |
|
288 | + <button class="btn waves-effect waves-light red restore_remote_mysqldump cancel" type="submit" id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore')?> |
|
289 | 289 | <i class="material-icons right">close</i> |
290 | 290 | </button> |
291 | 291 | </div> |
292 | 292 | |
293 | - <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_restore_remote_database_step" name="action"><?php echo __("Skip Next",'xcloner-backup-and-restore')?> |
|
293 | + <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next", 'xcloner-backup-and-restore')?>" id="skip_restore_remote_database_step" name="action"><?php echo __("Skip Next", 'xcloner-backup-and-restore')?> |
|
294 | 294 | <i class="material-icons right">navigate_next</i> |
295 | 295 | </button> |
296 | 296 | |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | </li> |
301 | 301 | |
302 | 302 | <li data-step="5" class="restore-finish-step steps active"> |
303 | - <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Finishing up...",'xcloner-backup-and-restore')?> |
|
303 | + <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Finishing up...", 'xcloner-backup-and-restore')?> |
|
304 | 304 | </div> |
305 | 305 | <div class="collapsible-body row"> |
306 | 306 | |
307 | 307 | <div class="row"> |
308 | 308 | <div class="col s4"> |
309 | - <label><?php echo __("Update wp-config.php mysql details and update the Target Site Url",'xcloner-backup-and-restore')?></label> |
|
309 | + <label><?php echo __("Update wp-config.php mysql details and update the Target Site Url", 'xcloner-backup-and-restore')?></label> |
|
310 | 310 | </div> |
311 | 311 | |
312 | 312 | <div class="col s8"> |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | |
324 | 324 | <div class="row"> |
325 | 325 | <div class="col s4"> |
326 | - <label><?php echo __("Delete Restored Backup Temporary Folder",'xcloner-backup-and-restore')?></label> |
|
326 | + <label><?php echo __("Delete Restored Backup Temporary Folder", 'xcloner-backup-and-restore')?></label> |
|
327 | 327 | </div> |
328 | 328 | <div class="col s8"> |
329 | 329 | <div class="switch"> |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | |
340 | 340 | <div class="row"> |
341 | 341 | <div class="col s4"> |
342 | - <label><?php echo __("Delete Restore Script",'xcloner-backup-and-restore')?></label> |
|
342 | + <label><?php echo __("Delete Restore Script", 'xcloner-backup-and-restore')?></label> |
|
343 | 343 | </div> |
344 | 344 | <div class="col s8"> |
345 | 345 | <div class="switch"> |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | </div> |
359 | 359 | |
360 | 360 | <div class=" row col s12 center-align" id="xcloner_restore_finish"> |
361 | - <h5><?php echo __("Thank you for using XCloner.",'xcloner-backup-and-restore')?></h5> |
|
362 | - <h6><?php echo sprintf(__("We would love to hear about your experience in the %s.", 'xcloner-backup-and-restore'),'<a href="https://wordpress.org/support/plugin/xcloner-backup-and-restore" target="_blank">Wordpress XCloner forums</a>') ?></h6> |
|
361 | + <h5><?php echo __("Thank you for using XCloner.", 'xcloner-backup-and-restore')?></h5> |
|
362 | + <h6><?php echo sprintf(__("We would love to hear about your experience in the %s.", 'xcloner-backup-and-restore'), '<a href="https://wordpress.org/support/plugin/xcloner-backup-and-restore" target="_blank">Wordpress XCloner forums</a>') ?></h6> |
|
363 | 363 | <a class="twitter-follow-button" href="https://twitter.com/thinkovi" data-show-count="false">Follow @thinkovi</a> |
364 | 364 | <script src="//platform.twitter.com/widgets.js" async="" charset="utf-8"></script> |
365 | 365 | </div> |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | <div class="col s12 center-align"> |
368 | 368 | <div class="row"> |
369 | 369 | <div class="col s6 right-align"> |
370 | - <button class="btn waves-effect waves-light teal" type="submit" id="restore_finish" name="action"><?php echo __("Finish",'xcloner-backup-and-restore')?> |
|
370 | + <button class="btn waves-effect waves-light teal" type="submit" id="restore_finish" name="action"><?php echo __("Finish", 'xcloner-backup-and-restore')?> |
|
371 | 371 | <i class="material-icons right">navigate_next</i> |
372 | 372 | </button> |
373 | 373 | </div> |
374 | 374 | |
375 | 375 | <div id="open_target_site" class="col s6 left-align"> |
376 | - <a disabled="disabled" href="#" class="btn waves-effect waves-light teal" type="button" target="_blank"><?php echo __("Open Target Site",'xcloner-backup-and-restore')?> |
|
376 | + <a disabled="disabled" href="#" class="btn waves-effect waves-light teal" type="button" target="_blank"><?php echo __("Open Target Site", 'xcloner-backup-and-restore')?> |
|
377 | 377 | <i class="material-icons right">navigate_next</i> |
378 | 378 | </a> |
379 | 379 | </div> |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | <!-- List Backup Content Modal--> |
392 | 392 | <div id="backup_cotent_modal" class="modal"> |
393 | 393 | <div class="modal-content"> |
394 | - <h4><?php echo sprintf(__("Listing Backup Content ",'xcloner-backup-and-restore'), "")?></h4> |
|
394 | + <h4><?php echo sprintf(__("Listing Backup Content ", 'xcloner-backup-and-restore'), "")?></h4> |
|
395 | 395 | <h5 class="backup-name"></h5> |
396 | 396 | |
397 | 397 | <div class="progress"> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | $gdrive_auth_url = ""; |
5 | 5 | |
6 | -if(method_exists($remote_storage, "get_gdrive_auth_url")) |
|
6 | +if (method_exists($remote_storage, "get_gdrive_auth_url")) |
|
7 | 7 | $gdrive_auth_url = $remote_storage->get_gdrive_auth_url(); |
8 | 8 | |
9 | 9 | $gdrive_construct = $remote_storage->gdrive_construct(); |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | <!-- FTP STORAGE--> |
21 | 21 | <li id="ftp"> |
22 | 22 | <div class="collapsible-header"> |
23 | - <i class="material-icons">computer</i><?php echo __("FTP Storage",'xcloner-backup-and-restore')?> |
|
23 | + <i class="material-icons">computer</i><?php echo __("FTP Storage", 'xcloner-backup-and-restore')?> |
|
24 | 24 | <div class="switch right"> |
25 | 25 | <label> |
26 | 26 | Off |
27 | - <input type="checkbox" name="xcloner_ftp_enable" class="status" value="1" <?php if(get_option("xcloner_ftp_enable")) echo "checked"?> \> |
|
27 | + <input type="checkbox" name="xcloner_ftp_enable" class="status" value="1" <?php if (get_option("xcloner_ftp_enable")) echo "checked"?> \> |
|
28 | 28 | <span class="lever"></span> |
29 | 29 | On |
30 | 30 | </label> |
@@ -33,96 +33,96 @@ discard block |
||
33 | 33 | <div class="collapsible-body"> |
34 | 34 | <div class="row"> |
35 | 35 | <div class="col s12 m3 label"> |
36 | - <label for="ftp_host"><?php echo __("Ftp Hostname",'xcloner-backup-and-restore')?></label> |
|
36 | + <label for="ftp_host"><?php echo __("Ftp Hostname", 'xcloner-backup-and-restore')?></label> |
|
37 | 37 | </div> |
38 | 38 | <div class="col s12 m6"> |
39 | - <input placeholder="<?php echo __("Ftp Hostname",'xcloner-backup-and-restore')?>" id="ftp_host" type="text" name="xcloner_ftp_hostname" class="validate" value="<?php echo get_option("xcloner_ftp_hostname")?>"> |
|
39 | + <input placeholder="<?php echo __("Ftp Hostname", 'xcloner-backup-and-restore')?>" id="ftp_host" type="text" name="xcloner_ftp_hostname" class="validate" value="<?php echo get_option("xcloner_ftp_hostname")?>"> |
|
40 | 40 | </div> |
41 | 41 | <div class=" col s12 m2"> |
42 | - <input placeholder="<?php echo __("Ftp Port",'xcloner-backup-and-restore')?>" id="ftp_port" type="text" name="xcloner_ftp_port" class="validate" value="<?php echo get_option("xcloner_ftp_port", 21)?>"> |
|
42 | + <input placeholder="<?php echo __("Ftp Port", 'xcloner-backup-and-restore')?>" id="ftp_port" type="text" name="xcloner_ftp_port" class="validate" value="<?php echo get_option("xcloner_ftp_port", 21)?>"> |
|
43 | 43 | </div> |
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <div class="row"> |
47 | 47 | <div class="col s12 m3 label"> |
48 | - <label for="ftp_username"><?php echo __("Ftp Username",'xcloner-backup-and-restore')?></label> |
|
48 | + <label for="ftp_username"><?php echo __("Ftp Username", 'xcloner-backup-and-restore')?></label> |
|
49 | 49 | </div> |
50 | 50 | <div class=" col s12 m6"> |
51 | - <input placeholder="<?php echo __("Ftp Username",'xcloner-backup-and-restore')?>" id="ftp_username" type="text" name="xcloner_ftp_username" class="validate" value="<?php echo get_option("xcloner_ftp_username")?>" autocomplete="off" > |
|
51 | + <input placeholder="<?php echo __("Ftp Username", 'xcloner-backup-and-restore')?>" id="ftp_username" type="text" name="xcloner_ftp_username" class="validate" value="<?php echo get_option("xcloner_ftp_username")?>" autocomplete="off" > |
|
52 | 52 | </div> |
53 | 53 | </div> |
54 | 54 | |
55 | 55 | |
56 | 56 | <div class="row"> |
57 | 57 | <div class="col s12 m3 label"> |
58 | - <label for="ftp_password"><?php echo __("Ftp Password",'xcloner-backup-and-restore')?></label> |
|
58 | + <label for="ftp_password"><?php echo __("Ftp Password", 'xcloner-backup-and-restore')?></label> |
|
59 | 59 | </div> |
60 | 60 | <div class=" col s12 m6"> |
61 | - <input placeholder="<?php echo __("Ftp Password",'xcloner-backup-and-restore')?>" id="ftp_password" type="password" name="xcloner_ftp_password" class="validate" value="<?php echo get_option("xcloner_ftp_password")?>" autocomplete="off" > |
|
61 | + <input placeholder="<?php echo __("Ftp Password", 'xcloner-backup-and-restore')?>" id="ftp_password" type="password" name="xcloner_ftp_password" class="validate" value="<?php echo get_option("xcloner_ftp_password")?>" autocomplete="off" > |
|
62 | 62 | </div> |
63 | 63 | </div> |
64 | 64 | |
65 | 65 | <div class="row"> |
66 | 66 | <div class="col s12 m3 label"> |
67 | - <label for="ftp_root"><?php echo __("Ftp Storage Folder",'xcloner-backup-and-restore')?></label> |
|
67 | + <label for="ftp_root"><?php echo __("Ftp Storage Folder", 'xcloner-backup-and-restore')?></label> |
|
68 | 68 | </div> |
69 | 69 | <div class=" col s12 m6"> |
70 | - <input placeholder="<?php echo __("Ftp Storage Folder",'xcloner-backup-and-restore')?>" id="ftp_root" type="text" name="xcloner_ftp_path" class="validate" value="<?php echo get_option("xcloner_ftp_path")?>"> |
|
70 | + <input placeholder="<?php echo __("Ftp Storage Folder", 'xcloner-backup-and-restore')?>" id="ftp_root" type="text" name="xcloner_ftp_path" class="validate" value="<?php echo get_option("xcloner_ftp_path")?>"> |
|
71 | 71 | </div> |
72 | 72 | </div> |
73 | 73 | |
74 | 74 | <div class="row"> |
75 | 75 | <div class="col s12 m3 label"> |
76 | - <label for="ftp_root"><?php echo __("Ftp Transfer Mode",'xcloner-backup-and-restore')?></label> |
|
76 | + <label for="ftp_root"><?php echo __("Ftp Transfer Mode", 'xcloner-backup-and-restore')?></label> |
|
77 | 77 | </div> |
78 | 78 | <div class=" col s12 m6 input-field inline"> |
79 | - <input name="xcloner_ftp_transfer_mode" type="radio" id="passive" value="1" <?php if(get_option("xcloner_ftp_transfer_mode", 1)) echo "checked"?> /> |
|
80 | - <label for="passive"><?php echo __("Passive",'xcloner-backup-and-restore')?></label> |
|
79 | + <input name="xcloner_ftp_transfer_mode" type="radio" id="passive" value="1" <?php if (get_option("xcloner_ftp_transfer_mode", 1)) echo "checked"?> /> |
|
80 | + <label for="passive"><?php echo __("Passive", 'xcloner-backup-and-restore')?></label> |
|
81 | 81 | |
82 | - <input name="xcloner_ftp_transfer_mode" type="radio" id="active" value="0" <?php if(!get_option("xcloner_ftp_transfer_mode", 1)) echo "checked"?> /> |
|
83 | - <label for="active"><?php echo __("Active",'xcloner-backup-and-restore')?></label> |
|
82 | + <input name="xcloner_ftp_transfer_mode" type="radio" id="active" value="0" <?php if (!get_option("xcloner_ftp_transfer_mode", 1)) echo "checked"?> /> |
|
83 | + <label for="active"><?php echo __("Active", 'xcloner-backup-and-restore')?></label> |
|
84 | 84 | </div> |
85 | 85 | </div> |
86 | 86 | |
87 | 87 | <div class="row"> |
88 | 88 | <div class="col s12 m3 label"> |
89 | - <label for="ftp_ssl_mode"><?php echo __("Ftp Secure Connection",'xcloner-backup-and-restore')?></label> |
|
89 | + <label for="ftp_ssl_mode"><?php echo __("Ftp Secure Connection", 'xcloner-backup-and-restore')?></label> |
|
90 | 90 | </div> |
91 | 91 | <div class=" col s12 m6 input-field inline"> |
92 | - <input name="xcloner_ftp_ssl_mode" type="radio" id="ftp_ssl_mode_inactive" value="0" <?php if(!get_option("xcloner_ftp_ssl_mode")) echo "checked"?> /> |
|
93 | - <label for="ftp_ssl_mode_inactive"><?php echo __("Disable",'xcloner-backup-and-restore')?></label> |
|
92 | + <input name="xcloner_ftp_ssl_mode" type="radio" id="ftp_ssl_mode_inactive" value="0" <?php if (!get_option("xcloner_ftp_ssl_mode")) echo "checked"?> /> |
|
93 | + <label for="ftp_ssl_mode_inactive"><?php echo __("Disable", 'xcloner-backup-and-restore')?></label> |
|
94 | 94 | |
95 | - <input name="xcloner_ftp_ssl_mode" type="radio" id="ftp_ssl_mode_active" value="1" <?php if(get_option("xcloner_ftp_ssl_mode")) echo "checked"?> /> |
|
96 | - <label for="ftp_ssl_mode_active"><?php echo __("Enable",'xcloner-backup-and-restore')?></label> |
|
95 | + <input name="xcloner_ftp_ssl_mode" type="radio" id="ftp_ssl_mode_active" value="1" <?php if (get_option("xcloner_ftp_ssl_mode")) echo "checked"?> /> |
|
96 | + <label for="ftp_ssl_mode_active"><?php echo __("Enable", 'xcloner-backup-and-restore')?></label> |
|
97 | 97 | </div> |
98 | 98 | </div> |
99 | 99 | |
100 | 100 | <div class="row"> |
101 | 101 | <div class="col s12 m3 label"> |
102 | - <label for="ftp_timeout"><?php echo __("Ftp Timeout",'xcloner-backup-and-restore')?></label> |
|
102 | + <label for="ftp_timeout"><?php echo __("Ftp Timeout", 'xcloner-backup-and-restore')?></label> |
|
103 | 103 | </div> |
104 | 104 | <div class=" col s12 m2"> |
105 | - <input placeholder="<?php echo __("Ftp Timeout",'xcloner-backup-and-restore')?>" id="ftp_timeout" type="text" name="xcloner_ftp_timeout" class="validate" value="<?php echo get_option("xcloner_ftp_timeout", 30)?>"> |
|
105 | + <input placeholder="<?php echo __("Ftp Timeout", 'xcloner-backup-and-restore')?>" id="ftp_timeout" type="text" name="xcloner_ftp_timeout" class="validate" value="<?php echo get_option("xcloner_ftp_timeout", 30)?>"> |
|
106 | 106 | </div> |
107 | 107 | </div> |
108 | 108 | |
109 | 109 | <div class="row"> |
110 | 110 | <div class="col s12 m3 label"> |
111 | - <label for="ftp_cleanup_days"><?php echo __("Ftp Cleanup (days)",'xcloner-backup-and-restore')?></label> |
|
111 | + <label for="ftp_cleanup_days"><?php echo __("Ftp Cleanup (days)", 'xcloner-backup-and-restore')?></label> |
|
112 | 112 | </div> |
113 | 113 | <div class=" col s12 m6"> |
114 | - <input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="ftp_cleanup_days" type="text" name="xcloner_ftp_cleanup_days" class="validate" value="<?php echo get_option("xcloner_ftp_cleanup_days")?>"> |
|
114 | + <input placeholder="<?php echo __("how many days to keep the backups for", 'xcloner-backup-and-restore')?>" id="ftp_cleanup_days" type="text" name="xcloner_ftp_cleanup_days" class="validate" value="<?php echo get_option("xcloner_ftp_cleanup_days")?>"> |
|
115 | 115 | </div> |
116 | 116 | </div> |
117 | 117 | |
118 | 118 | <div class="row"> |
119 | 119 | <div class="col s6 m4"> |
120 | - <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="ftp"><?php echo __("Save Settings",'xcloner-backup-and-restore')?> |
|
120 | + <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="ftp"><?php echo __("Save Settings", 'xcloner-backup-and-restore')?> |
|
121 | 121 | <i class="material-icons right">save</i> |
122 | 122 | </button> |
123 | 123 | </div> |
124 | 124 | <div class="col s6 m4"> |
125 | - <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="ftp" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify",'xcloner-backup-and-restore')?> |
|
125 | + <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="ftp" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify", 'xcloner-backup-and-restore')?> |
|
126 | 126 | <i class="material-icons right">import_export</i> |
127 | 127 | </button> |
128 | 128 | </div> |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | <!-- SFTP STORAGE--> |
134 | 134 | <li id="sftp"> |
135 | 135 | <div class="collapsible-header"> |
136 | - <i class="material-icons">computer</i><?php echo __("SFTP Storage",'xcloner-backup-and-restore')?> |
|
136 | + <i class="material-icons">computer</i><?php echo __("SFTP Storage", 'xcloner-backup-and-restore')?> |
|
137 | 137 | <div class="switch right"> |
138 | 138 | <label> |
139 | 139 | Off |
140 | - <input type="checkbox" name="xcloner_sftp_enable" class="status" value="1" <?php if(get_option("xcloner_sftp_enable")) echo "checked"?> \> |
|
140 | + <input type="checkbox" name="xcloner_sftp_enable" class="status" value="1" <?php if (get_option("xcloner_sftp_enable")) echo "checked"?> \> |
|
141 | 141 | <span class="lever"></span> |
142 | 142 | On |
143 | 143 | </label> |
@@ -146,79 +146,79 @@ discard block |
||
146 | 146 | <div class="collapsible-body"> |
147 | 147 | <div class="row"> |
148 | 148 | <div class="col s12 m3 label"> |
149 | - <label for="sftp_host"><?php echo __("SFTP Hostname",'xcloner-backup-and-restore')?></label> |
|
149 | + <label for="sftp_host"><?php echo __("SFTP Hostname", 'xcloner-backup-and-restore')?></label> |
|
150 | 150 | </div> |
151 | 151 | <div class="col s12 m6"> |
152 | - <input placeholder="<?php echo __("SFTP Hostname",'xcloner-backup-and-restore')?>" id="sftp_host" type="text" name="xcloner_sftp_hostname" class="validate" value="<?php echo get_option("xcloner_sftp_hostname")?>"> |
|
152 | + <input placeholder="<?php echo __("SFTP Hostname", 'xcloner-backup-and-restore')?>" id="sftp_host" type="text" name="xcloner_sftp_hostname" class="validate" value="<?php echo get_option("xcloner_sftp_hostname")?>"> |
|
153 | 153 | </div> |
154 | 154 | <div class=" col s12 m2"> |
155 | - <input placeholder="<?php echo __("SFTP Port",'xcloner-backup-and-restore')?>" id="sftp_port" type="text" name="xcloner_sftp_port" class="validate" value="<?php echo get_option("xcloner_sftp_port", 22)?>"> |
|
155 | + <input placeholder="<?php echo __("SFTP Port", 'xcloner-backup-and-restore')?>" id="sftp_port" type="text" name="xcloner_sftp_port" class="validate" value="<?php echo get_option("xcloner_sftp_port", 22)?>"> |
|
156 | 156 | </div> |
157 | 157 | </div> |
158 | 158 | |
159 | 159 | <div class="row"> |
160 | 160 | <div class="col s12 m3 label"> |
161 | - <label for="sftp_username"><?php echo __("SFTP Username",'xcloner-backup-and-restore')?></label> |
|
161 | + <label for="sftp_username"><?php echo __("SFTP Username", 'xcloner-backup-and-restore')?></label> |
|
162 | 162 | </div> |
163 | 163 | <div class=" col s12 m6"> |
164 | - <input placeholder="<?php echo __("SFTP Username",'xcloner-backup-and-restore')?>" id="sftp_username" type="text" name="xcloner_sftp_username" class="validate" value="<?php echo get_option("xcloner_sftp_username")?>" autocomplete="off" > |
|
164 | + <input placeholder="<?php echo __("SFTP Username", 'xcloner-backup-and-restore')?>" id="sftp_username" type="text" name="xcloner_sftp_username" class="validate" value="<?php echo get_option("xcloner_sftp_username")?>" autocomplete="off" > |
|
165 | 165 | </div> |
166 | 166 | </div> |
167 | 167 | |
168 | 168 | |
169 | 169 | <div class="row"> |
170 | 170 | <div class="col s12 m3 label"> |
171 | - <label for="sftp_password"><?php echo __("SFTP or Private Key Password",'xcloner-backup-and-restore')?></label> |
|
171 | + <label for="sftp_password"><?php echo __("SFTP or Private Key Password", 'xcloner-backup-and-restore')?></label> |
|
172 | 172 | </div> |
173 | 173 | <div class=" col s12 m6"> |
174 | - <input placeholder="<?php echo __("SFTP or Private Key Password",'xcloner-backup-and-restore')?>" id="ftp_spassword" type="password" name="xcloner_sftp_password" class="validate" value="<?php echo get_option("xcloner_sftp_password")?>" autocomplete="off" > |
|
174 | + <input placeholder="<?php echo __("SFTP or Private Key Password", 'xcloner-backup-and-restore')?>" id="ftp_spassword" type="password" name="xcloner_sftp_password" class="validate" value="<?php echo get_option("xcloner_sftp_password")?>" autocomplete="off" > |
|
175 | 175 | </div> |
176 | 176 | </div> |
177 | 177 | |
178 | 178 | <div class="row"> |
179 | 179 | <div class="col s12 m3 label"> |
180 | - <label for="sftp_private_key"><?php echo __("SFTP Private Key(RSA)",'xcloner-backup-and-restore')?></label> |
|
180 | + <label for="sftp_private_key"><?php echo __("SFTP Private Key(RSA)", 'xcloner-backup-and-restore')?></label> |
|
181 | 181 | </div> |
182 | 182 | <div class=" col s12 m6"> |
183 | - <textarea rows="5" placeholder="<?php echo __("Local Server Path or Contents of the SFTP Private Key RSA File",'xcloner-backup-and-restore')?>" id="sftp_private_key" type="text" name="xcloner_sftp_private_key" class="validate" value=""><?php echo get_option("xcloner_sftp_private_key")?></textarea> |
|
183 | + <textarea rows="5" placeholder="<?php echo __("Local Server Path or Contents of the SFTP Private Key RSA File", 'xcloner-backup-and-restore')?>" id="sftp_private_key" type="text" name="xcloner_sftp_private_key" class="validate" value=""><?php echo get_option("xcloner_sftp_private_key")?></textarea> |
|
184 | 184 | </div> |
185 | 185 | </div> |
186 | 186 | |
187 | 187 | <div class="row"> |
188 | 188 | <div class="col s12 m3 label"> |
189 | - <label for="sftp_root"><?php echo __("SFTP Storage Folder",'xcloner-backup-and-restore')?></label> |
|
189 | + <label for="sftp_root"><?php echo __("SFTP Storage Folder", 'xcloner-backup-and-restore')?></label> |
|
190 | 190 | </div> |
191 | 191 | <div class=" col s12 m6"> |
192 | - <input placeholder="<?php echo __("SFTP Storage Folder",'xcloner-backup-and-restore')?>" id="sftp_root" type="text" name="xcloner_sftp_path" class="validate" value="<?php echo get_option("xcloner_sftp_path")?>"> |
|
192 | + <input placeholder="<?php echo __("SFTP Storage Folder", 'xcloner-backup-and-restore')?>" id="sftp_root" type="text" name="xcloner_sftp_path" class="validate" value="<?php echo get_option("xcloner_sftp_path")?>"> |
|
193 | 193 | </div> |
194 | 194 | </div> |
195 | 195 | |
196 | 196 | <div class="row"> |
197 | 197 | <div class="col s12 m3 label"> |
198 | - <label for="sftp_timeout"><?php echo __("SFTP Timeout",'xcloner-backup-and-restore')?></label> |
|
198 | + <label for="sftp_timeout"><?php echo __("SFTP Timeout", 'xcloner-backup-and-restore')?></label> |
|
199 | 199 | </div> |
200 | 200 | <div class=" col s12 m2"> |
201 | - <input placeholder="<?php echo __("SFTP Timeout",'xcloner-backup-and-restore')?>" id="sftp_timeout" type="text" name="xcloner_sftp_timeout" class="validate" value="<?php echo get_option("xcloner_sftp_timeout", 30)?>"> |
|
201 | + <input placeholder="<?php echo __("SFTP Timeout", 'xcloner-backup-and-restore')?>" id="sftp_timeout" type="text" name="xcloner_sftp_timeout" class="validate" value="<?php echo get_option("xcloner_sftp_timeout", 30)?>"> |
|
202 | 202 | </div> |
203 | 203 | </div> |
204 | 204 | |
205 | 205 | <div class="row"> |
206 | 206 | <div class="col s12 m3 label"> |
207 | - <label for="sftp_cleanup_days"><?php echo __("SFTP Cleanup (days)",'xcloner-backup-and-restore')?></label> |
|
207 | + <label for="sftp_cleanup_days"><?php echo __("SFTP Cleanup (days)", 'xcloner-backup-and-restore')?></label> |
|
208 | 208 | </div> |
209 | 209 | <div class=" col s12 m6"> |
210 | - <input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="sftp_cleanup_days" type="text" name="xcloner_sftp_cleanup_days" class="validate" value="<?php echo get_option("xcloner_sftp_cleanup_days")?>"> |
|
210 | + <input placeholder="<?php echo __("how many days to keep the backups for", 'xcloner-backup-and-restore')?>" id="sftp_cleanup_days" type="text" name="xcloner_sftp_cleanup_days" class="validate" value="<?php echo get_option("xcloner_sftp_cleanup_days")?>"> |
|
211 | 211 | </div> |
212 | 212 | </div> |
213 | 213 | |
214 | 214 | <div class="row"> |
215 | 215 | <div class="col s6 m4"> |
216 | - <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="sftp"><?php echo __("Save Settings",'xcloner-backup-and-restore')?> |
|
216 | + <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="sftp"><?php echo __("Save Settings", 'xcloner-backup-and-restore')?> |
|
217 | 217 | <i class="material-icons right">save</i> |
218 | 218 | </button> |
219 | 219 | </div> |
220 | 220 | <div class="col s6 m4"> |
221 | - <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="sftp" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify",'xcloner-backup-and-restore')?> |
|
221 | + <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="sftp" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify", 'xcloner-backup-and-restore')?> |
|
222 | 222 | <i class="material-icons right">import_export</i> |
223 | 223 | </button> |
224 | 224 | </div> |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | <!-- AWS STORAGE--> |
231 | 231 | <li id="aws"> |
232 | 232 | <div class="collapsible-header"> |
233 | - <i class="material-icons">computer</i><?php echo __("AWS Storage",'xcloner-backup-and-restore')?> |
|
233 | + <i class="material-icons">computer</i><?php echo __("AWS Storage", 'xcloner-backup-and-restore')?> |
|
234 | 234 | <div class="switch right"> |
235 | 235 | <label> |
236 | 236 | Off |
237 | - <input type="checkbox" name="xcloner_aws_enable" class="status" value="1" <?php if(get_option("xcloner_aws_enable")) echo "checked"?> \> |
|
237 | + <input type="checkbox" name="xcloner_aws_enable" class="status" value="1" <?php if (get_option("xcloner_aws_enable")) echo "checked"?> \> |
|
238 | 238 | <span class="lever"></span> |
239 | 239 | On |
240 | 240 | </label> |
@@ -255,35 +255,35 @@ discard block |
||
255 | 255 | |
256 | 256 | <div class="row"> |
257 | 257 | <div class="col s12 m3 label"> |
258 | - <label for="aws_key"><?php echo __("AWS Key",'xcloner-backup-and-restore')?></label> |
|
258 | + <label for="aws_key"><?php echo __("AWS Key", 'xcloner-backup-and-restore')?></label> |
|
259 | 259 | </div> |
260 | 260 | <div class=" col s12 m6"> |
261 | - <input placeholder="<?php echo __("AWS Key",'xcloner-backup-and-restore')?>" id="aws_key" type="text" name="xcloner_aws_key" class="validate" value="<?php echo get_option("xcloner_aws_key")?>" autocomplete="off" > |
|
261 | + <input placeholder="<?php echo __("AWS Key", 'xcloner-backup-and-restore')?>" id="aws_key" type="text" name="xcloner_aws_key" class="validate" value="<?php echo get_option("xcloner_aws_key")?>" autocomplete="off" > |
|
262 | 262 | </div> |
263 | 263 | </div> |
264 | 264 | |
265 | 265 | <div class="row"> |
266 | 266 | <div class="col s12 m3 label"> |
267 | - <label for="aws_secret"><?php echo __("AWS Secret",'xcloner-backup-and-restore')?></label> |
|
267 | + <label for="aws_secret"><?php echo __("AWS Secret", 'xcloner-backup-and-restore')?></label> |
|
268 | 268 | </div> |
269 | 269 | <div class=" col s12 m6"> |
270 | - <input placeholder="<?php echo __("AWS Secret",'xcloner-backup-and-restore')?>" id="aws_secret" type="text" name="xcloner_aws_secret" class="validate" value="<?php echo get_option("xcloner_aws_secret")?>" autocomplete="off" > |
|
270 | + <input placeholder="<?php echo __("AWS Secret", 'xcloner-backup-and-restore')?>" id="aws_secret" type="text" name="xcloner_aws_secret" class="validate" value="<?php echo get_option("xcloner_aws_secret")?>" autocomplete="off" > |
|
271 | 271 | </div> |
272 | 272 | </div> |
273 | 273 | |
274 | 274 | <div class="row"> |
275 | 275 | <div class="col s12 m3 label"> |
276 | - <label for="aws_region"><?php echo __("AWS Region",'xcloner-backup-and-restore')?></label> |
|
276 | + <label for="aws_region"><?php echo __("AWS Region", 'xcloner-backup-and-restore')?></label> |
|
277 | 277 | </div> |
278 | 278 | <div class=" col s12 m6"> |
279 | - <select placeholder="<?php echo __("example: us-east-1",'xcloner-backup-and-restore')?>" id="aws_region" type="text" name="xcloner_aws_region" class="validate" value="<?php echo get_option("xcloner_aws_region")?>" autocomplete="off" > |
|
279 | + <select placeholder="<?php echo __("example: us-east-1", 'xcloner-backup-and-restore')?>" id="aws_region" type="text" name="xcloner_aws_region" class="validate" value="<?php echo get_option("xcloner_aws_region")?>" autocomplete="off" > |
|
280 | 280 | <option readonly value=""><?php echo __("Please Select AWS Region")?></option> |
281 | 281 | <?php |
282 | 282 | $aws_regions = $remote_storage->get_aws_regions(); |
283 | 283 | |
284 | - foreach($aws_regions as $key=>$region){ |
|
284 | + foreach ($aws_regions as $key=>$region) { |
|
285 | 285 | ?> |
286 | - <option value="<?php echo $key?>" <?php echo ($key == get_option('xcloner_aws_region')?"selected":"")?>><?php echo $region?> = <?php echo $key?></option> |
|
286 | + <option value="<?php echo $key?>" <?php echo ($key == get_option('xcloner_aws_region') ? "selected" : "")?>><?php echo $region?> = <?php echo $key?></option> |
|
287 | 287 | <?php |
288 | 288 | } |
289 | 289 | ?> |
@@ -293,30 +293,30 @@ discard block |
||
293 | 293 | |
294 | 294 | <div class="row"> |
295 | 295 | <div class="col s12 m3 label"> |
296 | - <label for="aws_bucket_name"><?php echo __("AWS Bucket Name",'xcloner-backup-and-restore')?></label> |
|
296 | + <label for="aws_bucket_name"><?php echo __("AWS Bucket Name", 'xcloner-backup-and-restore')?></label> |
|
297 | 297 | </div> |
298 | 298 | <div class=" col s12 m6"> |
299 | - <input placeholder="<?php echo __("AWS Bucket Name",'xcloner-backup-and-restore')?>" id="aws_bucket_name" type="text" name="xcloner_aws_bucket_name" class="validate" value="<?php echo get_option("xcloner_aws_bucket_name")?>" autocomplete="off" > |
|
299 | + <input placeholder="<?php echo __("AWS Bucket Name", 'xcloner-backup-and-restore')?>" id="aws_bucket_name" type="text" name="xcloner_aws_bucket_name" class="validate" value="<?php echo get_option("xcloner_aws_bucket_name")?>" autocomplete="off" > |
|
300 | 300 | </div> |
301 | 301 | </div> |
302 | 302 | |
303 | 303 | <div class="row"> |
304 | 304 | <div class="col s12 m3 label"> |
305 | - <label for="aws_cleanup_days"><?php echo __("AWS Cleanup (days)",'xcloner-backup-and-restore')?></label> |
|
305 | + <label for="aws_cleanup_days"><?php echo __("AWS Cleanup (days)", 'xcloner-backup-and-restore')?></label> |
|
306 | 306 | </div> |
307 | 307 | <div class=" col s12 m6"> |
308 | - <input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="aws_cleanup_days" type="text" name="xcloner_aws_cleanup_days" class="validate" value="<?php echo get_option("xcloner_aws_cleanup_days")?>"> |
|
308 | + <input placeholder="<?php echo __("how many days to keep the backups for", 'xcloner-backup-and-restore')?>" id="aws_cleanup_days" type="text" name="xcloner_aws_cleanup_days" class="validate" value="<?php echo get_option("xcloner_aws_cleanup_days")?>"> |
|
309 | 309 | </div> |
310 | 310 | </div> |
311 | 311 | |
312 | 312 | <div class="row"> |
313 | 313 | <div class="col s6 m4"> |
314 | - <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="aws"><?php echo __("Save Settings",'xcloner-backup-and-restore')?> |
|
314 | + <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="aws"><?php echo __("Save Settings", 'xcloner-backup-and-restore')?> |
|
315 | 315 | <i class="material-icons right">save</i> |
316 | 316 | </button> |
317 | 317 | </div> |
318 | 318 | <div class="col s6 m4"> |
319 | - <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="aws" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify",'xcloner-backup-and-restore')?> |
|
319 | + <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="aws" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify", 'xcloner-backup-and-restore')?> |
|
320 | 320 | <i class="material-icons right">import_export</i> |
321 | 321 | </button> |
322 | 322 | </div> |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | <!-- DROPBOX STORAGE--> |
329 | 329 | <li id="dropbox"> |
330 | 330 | <div class="collapsible-header"> |
331 | - <i class="material-icons">computer</i><?php echo __("Dropbox Storage",'xcloner-backup-and-restore')?> |
|
331 | + <i class="material-icons">computer</i><?php echo __("Dropbox Storage", 'xcloner-backup-and-restore')?> |
|
332 | 332 | <div class="switch right"> |
333 | 333 | <label> |
334 | 334 | Off |
335 | - <input type="checkbox" name="xcloner_dropbox_enable" class="status" value="1" <?php if(get_option("xcloner_dropbox_enable")) echo "checked"?> \> |
|
335 | + <input type="checkbox" name="xcloner_dropbox_enable" class="status" value="1" <?php if (get_option("xcloner_dropbox_enable")) echo "checked"?> \> |
|
336 | 336 | <span class="lever"></span> |
337 | 337 | On |
338 | 338 | </label> |
@@ -353,49 +353,49 @@ discard block |
||
353 | 353 | |
354 | 354 | <div class="row"> |
355 | 355 | <div class="col s12 m3 label"> |
356 | - <label for="dropbox_access_token"><?php echo __("Dropbox Access Token",'xcloner-backup-and-restore')?></label> |
|
356 | + <label for="dropbox_access_token"><?php echo __("Dropbox Access Token", 'xcloner-backup-and-restore')?></label> |
|
357 | 357 | </div> |
358 | 358 | <div class=" col s12 m6"> |
359 | - <input placeholder="<?php echo __("Dropbox Access Token",'xcloner-backup-and-restore')?>" id="dropbox_access_token" type="text" name="xcloner_dropbox_access_token" class="validate" value="<?php echo get_option("xcloner_dropbox_access_token")?>" autocomplete="off" > |
|
359 | + <input placeholder="<?php echo __("Dropbox Access Token", 'xcloner-backup-and-restore')?>" id="dropbox_access_token" type="text" name="xcloner_dropbox_access_token" class="validate" value="<?php echo get_option("xcloner_dropbox_access_token")?>" autocomplete="off" > |
|
360 | 360 | </div> |
361 | 361 | </div> |
362 | 362 | |
363 | 363 | |
364 | 364 | <div class="row"> |
365 | 365 | <div class="col s12 m3 label"> |
366 | - <label for="dropbox_app_secret"><?php echo __("Dropbox App Secret",'xcloner-backup-and-restore')?></label> |
|
366 | + <label for="dropbox_app_secret"><?php echo __("Dropbox App Secret", 'xcloner-backup-and-restore')?></label> |
|
367 | 367 | </div> |
368 | 368 | <div class=" col s12 m6"> |
369 | - <input placeholder="<?php echo __("Dropbox App Secret",'xcloner-backup-and-restore')?>" id="dropbox_app_secret" type="text" name="xcloner_dropbox_app_secret" class="validate" value="<?php echo get_option("xcloner_dropbox_app_secret")?>" autocomplete="off" > |
|
369 | + <input placeholder="<?php echo __("Dropbox App Secret", 'xcloner-backup-and-restore')?>" id="dropbox_app_secret" type="text" name="xcloner_dropbox_app_secret" class="validate" value="<?php echo get_option("xcloner_dropbox_app_secret")?>" autocomplete="off" > |
|
370 | 370 | </div> |
371 | 371 | </div> |
372 | 372 | |
373 | 373 | <div class="row"> |
374 | 374 | <div class="col s12 m3 label"> |
375 | - <label for="dropbox_prefix"><?php echo __("Dropbox Prefix",'xcloner-backup-and-restore')?></label> |
|
375 | + <label for="dropbox_prefix"><?php echo __("Dropbox Prefix", 'xcloner-backup-and-restore')?></label> |
|
376 | 376 | </div> |
377 | 377 | <div class=" col s12 m6"> |
378 | - <input placeholder="<?php echo __("Dropbox Prefix",'xcloner-backup-and-restore')?>" id="dropbox_prefix" type="text" name="xcloner_dropbox_prefix" class="validate" value="<?php echo get_option("xcloner_dropbox_prefix")?>"> |
|
378 | + <input placeholder="<?php echo __("Dropbox Prefix", 'xcloner-backup-and-restore')?>" id="dropbox_prefix" type="text" name="xcloner_dropbox_prefix" class="validate" value="<?php echo get_option("xcloner_dropbox_prefix")?>"> |
|
379 | 379 | </div> |
380 | 380 | </div> |
381 | 381 | |
382 | 382 | <div class="row"> |
383 | 383 | <div class="col s12 m3 label"> |
384 | - <label for="dropbox_cleanup_days"><?php echo __("Dropbox Cleanup (days)",'xcloner-backup-and-restore')?></label> |
|
384 | + <label for="dropbox_cleanup_days"><?php echo __("Dropbox Cleanup (days)", 'xcloner-backup-and-restore')?></label> |
|
385 | 385 | </div> |
386 | 386 | <div class=" col s12 m6"> |
387 | - <input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="dropbox_cleanup_days" type="text" name="xcloner_dropbox_cleanup_days" class="validate" value="<?php echo get_option("xcloner_dropbox_cleanup_days")?>"> |
|
387 | + <input placeholder="<?php echo __("how many days to keep the backups for", 'xcloner-backup-and-restore')?>" id="dropbox_cleanup_days" type="text" name="xcloner_dropbox_cleanup_days" class="validate" value="<?php echo get_option("xcloner_dropbox_cleanup_days")?>"> |
|
388 | 388 | </div> |
389 | 389 | </div> |
390 | 390 | |
391 | 391 | <div class="row"> |
392 | 392 | <div class="col s6 m4"> |
393 | - <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="dropbox"><?php echo __("Save Settings",'xcloner-backup-and-restore')?> |
|
393 | + <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="dropbox"><?php echo __("Save Settings", 'xcloner-backup-and-restore')?> |
|
394 | 394 | <i class="material-icons right">save</i> |
395 | 395 | </button> |
396 | 396 | </div> |
397 | 397 | <div class="col s6 m4"> |
398 | - <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="dropbox" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify",'xcloner-backup-and-restore')?> |
|
398 | + <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="dropbox" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify", 'xcloner-backup-and-restore')?> |
|
399 | 399 | <i class="material-icons right">import_export</i> |
400 | 400 | </button> |
401 | 401 | </div> |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | <!-- AZURE STORAGE--> |
408 | 408 | <li id="azure"> |
409 | 409 | <div class="collapsible-header"> |
410 | - <i class="material-icons">computer</i><?php echo __("Azure Blog Storage",'xcloner-backup-and-restore')?> |
|
410 | + <i class="material-icons">computer</i><?php echo __("Azure Blog Storage", 'xcloner-backup-and-restore')?> |
|
411 | 411 | <div class="switch right"> |
412 | 412 | <label> |
413 | 413 | Off |
414 | - <input type="checkbox" name="xcloner_azure_enable" class="status" value="1" <?php if(get_option("xcloner_azure_enable")) echo "checked"?> \> |
|
414 | + <input type="checkbox" name="xcloner_azure_enable" class="status" value="1" <?php if (get_option("xcloner_azure_enable")) echo "checked"?> \> |
|
415 | 415 | <span class="lever"></span> |
416 | 416 | On |
417 | 417 | </label> |
@@ -425,56 +425,56 @@ discard block |
||
425 | 425 | </div> |
426 | 426 | <div class=" col s12 m6"> |
427 | 427 | <p> |
428 | - <?php echo sprintf(__('Visit %s and get your "Api Key".','xcloner-backup-and-restore'), '<a href="https://azure.microsoft.com/en-us/services/storage/blobs/" target="_blank">https://azure.microsoft.com/en-us/services/storage/blobs/</a>')?> |
|
428 | + <?php echo sprintf(__('Visit %s and get your "Api Key".', 'xcloner-backup-and-restore'), '<a href="https://azure.microsoft.com/en-us/services/storage/blobs/" target="_blank">https://azure.microsoft.com/en-us/services/storage/blobs/</a>')?> |
|
429 | 429 | </p> |
430 | 430 | </div> |
431 | 431 | </div> |
432 | 432 | |
433 | 433 | <div class="row"> |
434 | 434 | <div class="col s12 m3 label"> |
435 | - <label for="azure_account_name"><?php echo __("Azure Account Name",'xcloner-backup-and-restore')?></label> |
|
435 | + <label for="azure_account_name"><?php echo __("Azure Account Name", 'xcloner-backup-and-restore')?></label> |
|
436 | 436 | </div> |
437 | 437 | <div class=" col s12 m6"> |
438 | - <input placeholder="<?php echo __("Azure Account Name",'xcloner-backup-and-restore')?>" id="azure_account_name" type="text" name="xcloner_azure_account_name" class="validate" value="<?php echo get_option("xcloner_azure_account_name")?>" autocomplete="off" > |
|
438 | + <input placeholder="<?php echo __("Azure Account Name", 'xcloner-backup-and-restore')?>" id="azure_account_name" type="text" name="xcloner_azure_account_name" class="validate" value="<?php echo get_option("xcloner_azure_account_name")?>" autocomplete="off" > |
|
439 | 439 | </div> |
440 | 440 | </div> |
441 | 441 | |
442 | 442 | |
443 | 443 | <div class="row"> |
444 | 444 | <div class="col s12 m3 label"> |
445 | - <label for="azure_api_key"><?php echo __("Azure Api Key",'xcloner-backup-and-restore')?></label> |
|
445 | + <label for="azure_api_key"><?php echo __("Azure Api Key", 'xcloner-backup-and-restore')?></label> |
|
446 | 446 | </div> |
447 | 447 | <div class=" col s12 m6"> |
448 | - <input placeholder="<?php echo __("Azure Api Key",'xcloner-backup-and-restore')?>" id="azure_api_key" type="text" name="xcloner_azure_api_key" class="validate" value="<?php echo get_option("xcloner_azure_api_key")?>" autocomplete="off" > |
|
448 | + <input placeholder="<?php echo __("Azure Api Key", 'xcloner-backup-and-restore')?>" id="azure_api_key" type="text" name="xcloner_azure_api_key" class="validate" value="<?php echo get_option("xcloner_azure_api_key")?>" autocomplete="off" > |
|
449 | 449 | </div> |
450 | 450 | </div> |
451 | 451 | |
452 | 452 | <div class="row"> |
453 | 453 | <div class="col s12 m3 label"> |
454 | - <label for="azure_container"><?php echo __("Azure Container",'xcloner-backup-and-restore')?></label> |
|
454 | + <label for="azure_container"><?php echo __("Azure Container", 'xcloner-backup-and-restore')?></label> |
|
455 | 455 | </div> |
456 | 456 | <div class=" col s12 m6"> |
457 | - <input placeholder="<?php echo __("Azure Container",'xcloner-backup-and-restore')?>" id="azure_container" type="text" name="xcloner_azure_container" class="validate" value="<?php echo get_option("xcloner_azure_container")?>"> |
|
457 | + <input placeholder="<?php echo __("Azure Container", 'xcloner-backup-and-restore')?>" id="azure_container" type="text" name="xcloner_azure_container" class="validate" value="<?php echo get_option("xcloner_azure_container")?>"> |
|
458 | 458 | </div> |
459 | 459 | </div> |
460 | 460 | |
461 | 461 | <div class="row"> |
462 | 462 | <div class="col s12 m3 label"> |
463 | - <label for="azure_cleanup_days"><?php echo __("Azure Cleanup (days)",'xcloner-backup-and-restore')?></label> |
|
463 | + <label for="azure_cleanup_days"><?php echo __("Azure Cleanup (days)", 'xcloner-backup-and-restore')?></label> |
|
464 | 464 | </div> |
465 | 465 | <div class=" col s12 m6"> |
466 | - <input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="azure_cleanup_days" type="text" name="xcloner_azure_cleanup_days" class="validate" value="<?php echo get_option("xcloner_azure_cleanup_days")?>"> |
|
466 | + <input placeholder="<?php echo __("how many days to keep the backups for", 'xcloner-backup-and-restore')?>" id="azure_cleanup_days" type="text" name="xcloner_azure_cleanup_days" class="validate" value="<?php echo get_option("xcloner_azure_cleanup_days")?>"> |
|
467 | 467 | </div> |
468 | 468 | </div> |
469 | 469 | |
470 | 470 | <div class="row"> |
471 | 471 | <div class="col s6 m4"> |
472 | - <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="azure"><?php echo __("Save Settings",'xcloner-backup-and-restore')?> |
|
472 | + <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="azure"><?php echo __("Save Settings", 'xcloner-backup-and-restore')?> |
|
473 | 473 | <i class="material-icons right">save</i> |
474 | 474 | </button> |
475 | 475 | </div> |
476 | 476 | <div class="col s6 m4"> |
477 | - <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="azure" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify",'xcloner-backup-and-restore')?> |
|
477 | + <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="azure" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify", 'xcloner-backup-and-restore')?> |
|
478 | 478 | <i class="material-icons right">import_export</i> |
479 | 479 | </button> |
480 | 480 | </div> |
@@ -486,11 +486,11 @@ discard block |
||
486 | 486 | <!-- BACKBLAZE STORAGE--> |
487 | 487 | <li id="backblaze"> |
488 | 488 | <div class="collapsible-header"> |
489 | - <i class="material-icons">computer</i><?php echo __("BackBlaze Storage",'xcloner-backup-and-restore')?> |
|
489 | + <i class="material-icons">computer</i><?php echo __("BackBlaze Storage", 'xcloner-backup-and-restore')?> |
|
490 | 490 | <div class="switch right"> |
491 | 491 | <label> |
492 | 492 | Off |
493 | - <input type="checkbox" name="xcloner_backblaze_enable" class="status" value="1" <?php if(get_option("xcloner_backblaze_enable")) echo "checked"?> \> |
|
493 | + <input type="checkbox" name="xcloner_backblaze_enable" class="status" value="1" <?php if (get_option("xcloner_backblaze_enable")) echo "checked"?> \> |
|
494 | 494 | <span class="lever"></span> |
495 | 495 | On |
496 | 496 | </label> |
@@ -504,56 +504,56 @@ discard block |
||
504 | 504 | </div> |
505 | 505 | <div class=" col s12 m6"> |
506 | 506 | <p> |
507 | - <?php echo sprintf(__('Visit %s and get your Account Id and Application Key.','xcloner-backup-and-restore'), '<a href="https://secure.backblaze.com/b2_buckets.htm" target="_blank">https://secure.backblaze.com/b2_buckets.htm</a>')?> |
|
507 | + <?php echo sprintf(__('Visit %s and get your Account Id and Application Key.', 'xcloner-backup-and-restore'), '<a href="https://secure.backblaze.com/b2_buckets.htm" target="_blank">https://secure.backblaze.com/b2_buckets.htm</a>')?> |
|
508 | 508 | </p> |
509 | 509 | </div> |
510 | 510 | </div> |
511 | 511 | |
512 | 512 | <div class="row"> |
513 | 513 | <div class="col s12 m3 label"> |
514 | - <label for="backblaze_account_id"><?php echo __("BackBlaze Account Id",'xcloner-backup-and-restore')?></label> |
|
514 | + <label for="backblaze_account_id"><?php echo __("BackBlaze Account Id", 'xcloner-backup-and-restore')?></label> |
|
515 | 515 | </div> |
516 | 516 | <div class=" col s12 m6"> |
517 | - <input placeholder="<?php echo __("BackBlaze Account Id",'xcloner-backup-and-restore')?>" id="backblaze_account_id" type="text" name="xcloner_backblaze_account_id" class="validate" value="<?php echo get_option("xcloner_backblaze_account_id")?>" autocomplete="off" > |
|
517 | + <input placeholder="<?php echo __("BackBlaze Account Id", 'xcloner-backup-and-restore')?>" id="backblaze_account_id" type="text" name="xcloner_backblaze_account_id" class="validate" value="<?php echo get_option("xcloner_backblaze_account_id")?>" autocomplete="off" > |
|
518 | 518 | </div> |
519 | 519 | </div> |
520 | 520 | |
521 | 521 | |
522 | 522 | <div class="row"> |
523 | 523 | <div class="col s12 m3 label"> |
524 | - <label for="backblaze_application_key"><?php echo __("BackBlaze Application Key",'xcloner-backup-and-restore')?></label> |
|
524 | + <label for="backblaze_application_key"><?php echo __("BackBlaze Application Key", 'xcloner-backup-and-restore')?></label> |
|
525 | 525 | </div> |
526 | 526 | <div class=" col s12 m6"> |
527 | - <input placeholder="<?php echo __("BackBlaze Application Key",'xcloner-backup-and-restore')?>" id="backblaze_application_key" type="text" name="xcloner_backblaze_application_key" class="validate" value="<?php echo get_option("xcloner_backblaze_application_key")?>" autocomplete="off" > |
|
527 | + <input placeholder="<?php echo __("BackBlaze Application Key", 'xcloner-backup-and-restore')?>" id="backblaze_application_key" type="text" name="xcloner_backblaze_application_key" class="validate" value="<?php echo get_option("xcloner_backblaze_application_key")?>" autocomplete="off" > |
|
528 | 528 | </div> |
529 | 529 | </div> |
530 | 530 | |
531 | 531 | <div class="row"> |
532 | 532 | <div class="col s12 m3 label"> |
533 | - <label for="backblaze_bucket_name"><?php echo __("BackBlaze Bucket Name",'xcloner-backup-and-restore')?></label> |
|
533 | + <label for="backblaze_bucket_name"><?php echo __("BackBlaze Bucket Name", 'xcloner-backup-and-restore')?></label> |
|
534 | 534 | </div> |
535 | 535 | <div class=" col s12 m6"> |
536 | - <input placeholder="<?php echo __("BackBlaze Bucket Name",'xcloner-backup-and-restore')?>" id="backblaze_bucket_name" type="text" name="xcloner_backblaze_bucket_name" class="validate" value="<?php echo get_option("xcloner_backblaze_bucket_name")?>" autocomplete="off" > |
|
536 | + <input placeholder="<?php echo __("BackBlaze Bucket Name", 'xcloner-backup-and-restore')?>" id="backblaze_bucket_name" type="text" name="xcloner_backblaze_bucket_name" class="validate" value="<?php echo get_option("xcloner_backblaze_bucket_name")?>" autocomplete="off" > |
|
537 | 537 | </div> |
538 | 538 | </div> |
539 | 539 | |
540 | 540 | <div class="row"> |
541 | 541 | <div class="col s12 m3 label"> |
542 | - <label for="backblaze_cleanup_days"><?php echo __("BackBlaze Cleanup (days)",'xcloner-backup-and-restore')?></label> |
|
542 | + <label for="backblaze_cleanup_days"><?php echo __("BackBlaze Cleanup (days)", 'xcloner-backup-and-restore')?></label> |
|
543 | 543 | </div> |
544 | 544 | <div class=" col s12 m6"> |
545 | - <input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="backblaze_cleanup_days" type="text" name="xcloner_backblaze_cleanup_days" class="validate" value="<?php echo get_option("xcloner_backblaze_cleanup_days")?>"> |
|
545 | + <input placeholder="<?php echo __("how many days to keep the backups for", 'xcloner-backup-and-restore')?>" id="backblaze_cleanup_days" type="text" name="xcloner_backblaze_cleanup_days" class="validate" value="<?php echo get_option("xcloner_backblaze_cleanup_days")?>"> |
|
546 | 546 | </div> |
547 | 547 | </div> |
548 | 548 | |
549 | 549 | <div class="row"> |
550 | 550 | <div class="col s6 m4"> |
551 | - <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="backblaze"><?php echo __("Save Settings",'xcloner-backup-and-restore')?> |
|
551 | + <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="backblaze"><?php echo __("Save Settings", 'xcloner-backup-and-restore')?> |
|
552 | 552 | <i class="material-icons right">save</i> |
553 | 553 | </button> |
554 | 554 | </div> |
555 | 555 | <div class="col s6 m4"> |
556 | - <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="backblaze" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify",'xcloner-backup-and-restore')?> |
|
556 | + <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="backblaze" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify", 'xcloner-backup-and-restore')?> |
|
557 | 557 | <i class="material-icons right">import_export</i> |
558 | 558 | </button> |
559 | 559 | </div> |
@@ -565,11 +565,11 @@ discard block |
||
565 | 565 | <!-- WEBDAV STORAGE--> |
566 | 566 | <li id="webdav"> |
567 | 567 | <div class="collapsible-header"> |
568 | - <i class="material-icons">computer</i><?php echo __("WebDAV Storage",'xcloner-backup-and-restore')?> |
|
568 | + <i class="material-icons">computer</i><?php echo __("WebDAV Storage", 'xcloner-backup-and-restore')?> |
|
569 | 569 | <div class="switch right"> |
570 | 570 | <label> |
571 | 571 | Off |
572 | - <input type="checkbox" name="xcloner_webdav_enable" class="status" value="1" <?php if(get_option("xcloner_webdav_enable")) echo "checked"?> \> |
|
572 | + <input type="checkbox" name="xcloner_webdav_enable" class="status" value="1" <?php if (get_option("xcloner_webdav_enable")) echo "checked"?> \> |
|
573 | 573 | <span class="lever"></span> |
574 | 574 | On |
575 | 575 | </label> |
@@ -590,57 +590,57 @@ discard block |
||
590 | 590 | |
591 | 591 | <div class="row"> |
592 | 592 | <div class="col s12 m3 label"> |
593 | - <label for="webdav_url"><?php echo __("WebDAV Base Url",'xcloner-backup-and-restore')?></label> |
|
593 | + <label for="webdav_url"><?php echo __("WebDAV Base Url", 'xcloner-backup-and-restore')?></label> |
|
594 | 594 | </div> |
595 | 595 | <div class=" col s12 m6"> |
596 | - <input placeholder="<?php echo __("WebDAV Base Url",'xcloner-backup-and-restore')?>" id="webdav_url" type="text" name="xcloner_webdav_url" class="validate" value="<?php echo get_option("xcloner_webdav_url")?>" autocomplete="off" > |
|
596 | + <input placeholder="<?php echo __("WebDAV Base Url", 'xcloner-backup-and-restore')?>" id="webdav_url" type="text" name="xcloner_webdav_url" class="validate" value="<?php echo get_option("xcloner_webdav_url")?>" autocomplete="off" > |
|
597 | 597 | </div> |
598 | 598 | </div> |
599 | 599 | |
600 | 600 | <div class="row"> |
601 | 601 | <div class="col s12 m3 label"> |
602 | - <label for="webdav_username"><?php echo __("WebDAV Username",'xcloner-backup-and-restore')?></label> |
|
602 | + <label for="webdav_username"><?php echo __("WebDAV Username", 'xcloner-backup-and-restore')?></label> |
|
603 | 603 | </div> |
604 | 604 | <div class=" col s12 m6"> |
605 | - <input placeholder="<?php echo __("WebDAV Username",'xcloner-backup-and-restore')?>" id="webdav_username" type="text" name="xcloner_webdav_username" class="validate" value="<?php echo get_option("xcloner_webdav_username")?>" autocomplete="off" > |
|
605 | + <input placeholder="<?php echo __("WebDAV Username", 'xcloner-backup-and-restore')?>" id="webdav_username" type="text" name="xcloner_webdav_username" class="validate" value="<?php echo get_option("xcloner_webdav_username")?>" autocomplete="off" > |
|
606 | 606 | </div> |
607 | 607 | </div> |
608 | 608 | |
609 | 609 | <div class="row"> |
610 | 610 | <div class="col s12 m3 label"> |
611 | - <label for="webdav_password"><?php echo __("WebDAV Password",'xcloner-backup-and-restore')?></label> |
|
611 | + <label for="webdav_password"><?php echo __("WebDAV Password", 'xcloner-backup-and-restore')?></label> |
|
612 | 612 | </div> |
613 | 613 | <div class=" col s12 m6"> |
614 | - <input placeholder="<?php echo __("WebDAV Password",'xcloner-backup-and-restore')?>" id="webdav_password" type="password" name="xcloner_webdav_password" class="validate" value="<?php echo get_option("xcloner_webdav_password")?>" autocomplete="off" > |
|
614 | + <input placeholder="<?php echo __("WebDAV Password", 'xcloner-backup-and-restore')?>" id="webdav_password" type="password" name="xcloner_webdav_password" class="validate" value="<?php echo get_option("xcloner_webdav_password")?>" autocomplete="off" > |
|
615 | 615 | </div> |
616 | 616 | </div> |
617 | 617 | |
618 | 618 | <div class="row"> |
619 | 619 | <div class="col s12 m3 label"> |
620 | - <label for="webdav_target_folder"><?php echo __("WebDAV Target Folder",'xcloner-backup-and-restore')?></label> |
|
620 | + <label for="webdav_target_folder"><?php echo __("WebDAV Target Folder", 'xcloner-backup-and-restore')?></label> |
|
621 | 621 | </div> |
622 | 622 | <div class=" col s12 m6"> |
623 | - <input placeholder="<?php echo __("WebDAV Target Folder",'xcloner-backup-and-restore')?>" id="webdav_target_folder" type="text" name="xcloner_webdav_target_folder" class="validate" value="<?php echo get_option("xcloner_webdav_target_folder")?>" autocomplete="off" > |
|
623 | + <input placeholder="<?php echo __("WebDAV Target Folder", 'xcloner-backup-and-restore')?>" id="webdav_target_folder" type="text" name="xcloner_webdav_target_folder" class="validate" value="<?php echo get_option("xcloner_webdav_target_folder")?>" autocomplete="off" > |
|
624 | 624 | </div> |
625 | 625 | </div> |
626 | 626 | |
627 | 627 | <div class="row"> |
628 | 628 | <div class="col s12 m3 label"> |
629 | - <label for="webdav_cleanup_days"><?php echo __("WebDAV Cleanup (days)",'xcloner-backup-and-restore')?></label> |
|
629 | + <label for="webdav_cleanup_days"><?php echo __("WebDAV Cleanup (days)", 'xcloner-backup-and-restore')?></label> |
|
630 | 630 | </div> |
631 | 631 | <div class=" col s12 m6"> |
632 | - <input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="webdav_cleanup_days" type="text" name="xcloner_webdav_cleanup_days" class="validate" value="<?php echo get_option("xcloner_webdav_cleanup_days")?>"> |
|
632 | + <input placeholder="<?php echo __("how many days to keep the backups for", 'xcloner-backup-and-restore')?>" id="webdav_cleanup_days" type="text" name="xcloner_webdav_cleanup_days" class="validate" value="<?php echo get_option("xcloner_webdav_cleanup_days")?>"> |
|
633 | 633 | </div> |
634 | 634 | </div> |
635 | 635 | |
636 | 636 | <div class="row"> |
637 | 637 | <div class="col s6 m4"> |
638 | - <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="webdav"><?php echo __("Save Settings",'xcloner-backup-and-restore')?> |
|
638 | + <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="webdav"><?php echo __("Save Settings", 'xcloner-backup-and-restore')?> |
|
639 | 639 | <i class="material-icons right">save</i> |
640 | 640 | </button> |
641 | 641 | </div> |
642 | 642 | <div class="col s6 m4"> |
643 | - <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="webdav" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify",'xcloner-backup-and-restore')?> |
|
643 | + <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="webdav" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify", 'xcloner-backup-and-restore')?> |
|
644 | 644 | <i class="material-icons right">import_export</i> |
645 | 645 | </button> |
646 | 646 | </div> |
@@ -652,12 +652,12 @@ discard block |
||
652 | 652 | <!-- Google DRIVE STORAGE--> |
653 | 653 | <li id="gdrive"> |
654 | 654 | <div class="collapsible-header"> |
655 | - <i class="material-icons">computer</i><?php echo __("Google Drive Storage",'xcloner-backup-and-restore')?> |
|
656 | - <?php if($gdrive_construct):?> |
|
655 | + <i class="material-icons">computer</i><?php echo __("Google Drive Storage", 'xcloner-backup-and-restore')?> |
|
656 | + <?php if ($gdrive_construct):?> |
|
657 | 657 | <div class="switch right"> |
658 | 658 | <label> |
659 | 659 | Off |
660 | - <input type="checkbox" name="xcloner_gdrive_enable" class="status" value="1" <?php if(get_option("xcloner_gdrive_enable")) echo "checked"?> \> |
|
660 | + <input type="checkbox" name="xcloner_gdrive_enable" class="status" value="1" <?php if (get_option("xcloner_gdrive_enable")) echo "checked"?> \> |
|
661 | 661 | <span class="lever"></span> |
662 | 662 | On |
663 | 663 | </label> |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | </div> |
667 | 667 | <div class="collapsible-body"> |
668 | 668 | |
669 | - <?php if($gdrive_construct) : ?> |
|
669 | + <?php if ($gdrive_construct) : ?> |
|
670 | 670 | |
671 | 671 | <div class="row"> |
672 | 672 | <div class="col s12 m3 label"> |
@@ -674,28 +674,28 @@ discard block |
||
674 | 674 | </div> |
675 | 675 | <div class=" col s12 m9"> |
676 | 676 | <p> |
677 | - <?php echo sprintf(__('Visit %s to create a new application and get your Client ID and Client Secret.','xcloner-backup-and-restore'), '<a href="https://console.developers.google.com" target="_blank">https://console.developers.google.com</a>')?> |
|
677 | + <?php echo sprintf(__('Visit %s to create a new application and get your Client ID and Client Secret.', 'xcloner-backup-and-restore'), '<a href="https://console.developers.google.com" target="_blank">https://console.developers.google.com</a>')?> |
|
678 | 678 | <a href="https://youtu.be/YXUVPUVgG8k" target="_blank" class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-html="true" |
679 | - data-tooltip="<?php echo sprintf(__('Click here to view a short video explaining how to create the Client ID and Client Secret as well as connecting XCloner with the Google Drive API %s','xcloner-backup-and-restore'),"<br />https://youtu.be/YXUVPUVgG8k")?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
679 | + data-tooltip="<?php echo sprintf(__('Click here to view a short video explaining how to create the Client ID and Client Secret as well as connecting XCloner with the Google Drive API %s', 'xcloner-backup-and-restore'), "<br />https://youtu.be/YXUVPUVgG8k")?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
680 | 680 | </p> |
681 | 681 | </div> |
682 | 682 | </div> |
683 | 683 | |
684 | 684 | <div class="row"> |
685 | 685 | <div class="col s12 m3 label"> |
686 | - <label for="gdrive_client_id"><?php echo __("Client ID",'xcloner-backup-and-restore')?></label> |
|
686 | + <label for="gdrive_client_id"><?php echo __("Client ID", 'xcloner-backup-and-restore')?></label> |
|
687 | 687 | </div> |
688 | 688 | <div class=" col s12 m6"> |
689 | - <input placeholder="<?php echo __("Google Client ID",'xcloner-backup-and-restore')?>" id="gdrive_client_id" type="text" name="xcloner_gdrive_client_id" class="validate" value="<?php echo get_option("xcloner_gdrive_client_id")?>"> |
|
689 | + <input placeholder="<?php echo __("Google Client ID", 'xcloner-backup-and-restore')?>" id="gdrive_client_id" type="text" name="xcloner_gdrive_client_id" class="validate" value="<?php echo get_option("xcloner_gdrive_client_id")?>"> |
|
690 | 690 | </div> |
691 | 691 | </div> |
692 | 692 | |
693 | 693 | <div class="row"> |
694 | 694 | <div class="col s12 m3 label"> |
695 | - <label for="gdrive_client_secret"><?php echo __("Client Secret",'xcloner-backup-and-restore')?></label> |
|
695 | + <label for="gdrive_client_secret"><?php echo __("Client Secret", 'xcloner-backup-and-restore')?></label> |
|
696 | 696 | </div> |
697 | 697 | <div class=" col s12 m6"> |
698 | - <input placeholder="<?php echo __("Google Client Secret",'xcloner-backup-and-restore')?>" id="gdrive_client_secret" type="text" name="xcloner_gdrive_client_secret" class="validate" value="<?php echo get_option("xcloner_gdrive_client_secret")?>"> |
|
698 | + <input placeholder="<?php echo __("Google Client Secret", 'xcloner-backup-and-restore')?>" id="gdrive_client_secret" type="text" name="xcloner_gdrive_client_secret" class="validate" value="<?php echo get_option("xcloner_gdrive_client_secret")?>"> |
|
699 | 699 | </div> |
700 | 700 | </div> |
701 | 701 | |
@@ -705,41 +705,41 @@ discard block |
||
705 | 705 | |
706 | 706 | </div> |
707 | 707 | <div class=" col s12 m6"> |
708 | - <a class="btn" target="_blank" id="gdrive_authorization_click" onclick="jQuery('#authentification_code').show()" href="<?php echo $gdrive_auth_url?>"><?php echo sprintf(__('Authorize Google Drive','xcloner-backup-and-restore'))?></a> |
|
709 | - <input type="text" name="authentification_code" id="authentification_code" placeholder="<?php echo __("Paste Authorization Code Here","xcloner-backup-and-restore")?>"> |
|
708 | + <a class="btn" target="_blank" id="gdrive_authorization_click" onclick="jQuery('#authentification_code').show()" href="<?php echo $gdrive_auth_url?>"><?php echo sprintf(__('Authorize Google Drive', 'xcloner-backup-and-restore'))?></a> |
|
709 | + <input type="text" name="authentification_code" id="authentification_code" placeholder="<?php echo __("Paste Authorization Code Here", "xcloner-backup-and-restore")?>"> |
|
710 | 710 | </div> |
711 | 711 | </div> |
712 | 712 | |
713 | 713 | <div class="row"> |
714 | 714 | <div class="col s12 m3 label"> |
715 | - <label for="gdrive_target_folder"><?php echo __("Folder ID or Root Path",'xcloner-backup-and-restore')?> |
|
715 | + <label for="gdrive_target_folder"><?php echo __("Folder ID or Root Path", 'xcloner-backup-and-restore')?> |
|
716 | 716 | <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-html="true" \ |
717 | 717 | data-tooltip="<?php echo __('Folder ID can be found by right clicking on the folder name and selecting \'Get shareable link\' menu, format https://drive.google.com/open?id={FOLDER_ID}<br /> |
718 | 718 | If you supply a folder name, it has to exists in the drive root and start with / , example /backups.xcloner.com/','xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
719 | 719 | </label> |
720 | 720 | </div> |
721 | 721 | <div class=" col s12 m6"> |
722 | - <input placeholder="<?php echo __("Target Folder ID or Root Path",'xcloner-backup-and-restore')?>" id="gdrive_target_folder" type="text" name="xcloner_gdrive_target_folder" class="validate" value="<?php echo get_option("xcloner_gdrive_target_folder")?>" autocomplete="off" > |
|
722 | + <input placeholder="<?php echo __("Target Folder ID or Root Path", 'xcloner-backup-and-restore')?>" id="gdrive_target_folder" type="text" name="xcloner_gdrive_target_folder" class="validate" value="<?php echo get_option("xcloner_gdrive_target_folder")?>" autocomplete="off" > |
|
723 | 723 | </div> |
724 | 724 | </div> |
725 | 725 | |
726 | 726 | <div class="row"> |
727 | 727 | <div class="col s12 m3 label"> |
728 | - <label for="gdrive_cleanup_days"><?php echo __("Google Drive Cleanup (days)",'xcloner-backup-and-restore')?></label> |
|
728 | + <label for="gdrive_cleanup_days"><?php echo __("Google Drive Cleanup (days)", 'xcloner-backup-and-restore')?></label> |
|
729 | 729 | </div> |
730 | 730 | <div class=" col s12 m6"> |
731 | - <input placeholder="<?php echo __("how many days to keep the backups for",'xcloner-backup-and-restore')?>" id="gdrive_cleanup_days" type="text" name="xcloner_gdrive_cleanup_days" class="validate" value="<?php echo get_option("xcloner_gdrive_cleanup_days")?>"> |
|
731 | + <input placeholder="<?php echo __("how many days to keep the backups for", 'xcloner-backup-and-restore')?>" id="gdrive_cleanup_days" type="text" name="xcloner_gdrive_cleanup_days" class="validate" value="<?php echo get_option("xcloner_gdrive_cleanup_days")?>"> |
|
732 | 732 | </div> |
733 | 733 | </div> |
734 | 734 | |
735 | 735 | <div class="row"> |
736 | 736 | <div class="col s6 m4"> |
737 | - <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="gdrive"><?php echo __("Save Settings",'xcloner-backup-and-restore')?> |
|
737 | + <button class="btn waves-effect waves-light" type="submit" name="action" id="action" value="gdrive"><?php echo __("Save Settings", 'xcloner-backup-and-restore')?> |
|
738 | 738 | <i class="material-icons right">save</i> |
739 | 739 | </button> |
740 | 740 | </div> |
741 | 741 | <div class="col s6 m4"> |
742 | - <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="gdrive" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify",'xcloner-backup-and-restore')?> |
|
742 | + <button class="btn waves-effect waves-light orange" type="submit" name="action" id="action" value="gdrive" onclick="jQuery('#connection_check').val('1')"><?php echo __("Verify", 'xcloner-backup-and-restore')?> |
|
743 | 743 | <i class="material-icons right">import_export</i> |
744 | 744 | </button> |
745 | 745 | </div> |
@@ -755,15 +755,15 @@ discard block |
||
755 | 755 | <h6><?php echo __("This storage option requires the XCloner-Google-Drive Wordpress Plugin to be installed and activated.")?></h6> |
756 | 756 | <h6><?php echo __("PHP 5.5 minimum version is required.")?></h6> |
757 | 757 | <br /> |
758 | - <a class="install-now btn" data-slug="xcloner-google-drive" href="<?php echo $url;?>" aria-label="Install XCloner Google Drive 1.0.0 now" data-name="XCloner Google Drive 1.0.0"> |
|
759 | - <?php echo sprintf(__('Install Now','xcloner-backup-and-restore'))?> |
|
758 | + <a class="install-now btn" data-slug="xcloner-google-drive" href="<?php echo $url; ?>" aria-label="Install XCloner Google Drive 1.0.0 now" data-name="XCloner Google Drive 1.0.0"> |
|
759 | + <?php echo sprintf(__('Install Now', 'xcloner-backup-and-restore'))?> |
|
760 | 760 | </a> |
761 | 761 | |
762 | 762 | <a href="<?php echo admin_url("plugin-install.php")?>?tab=plugin-information&plugin=xcloner-google-drive&TB_iframe=true&width=772&height=499" class="btn thickbox open-plugin-details-modal" aria-label="More information about Theme Check 20160523.1" data-title="Theme Check 20160523.1"> |
763 | 763 | <!-- |
764 | 764 | <a class="btn" href="https://github.com/ovidiul/XCloner-Google-Drive/archive/master.zip"> |
765 | 765 | --> |
766 | - <?php echo sprintf(__('More Details','xcloner-backup-and-restore'))?> |
|
766 | + <?php echo sprintf(__('More Details', 'xcloner-backup-and-restore'))?> |
|
767 | 767 | </a> |
768 | 768 | </div> |
769 | 769 | </div> |
@@ -3,8 +3,9 @@ discard block |
||
3 | 3 | |
4 | 4 | $gdrive_auth_url = ""; |
5 | 5 | |
6 | -if(method_exists($remote_storage, "get_gdrive_auth_url")) |
|
6 | +if(method_exists($remote_storage, "get_gdrive_auth_url")) { |
|
7 | 7 | $gdrive_auth_url = $remote_storage->get_gdrive_auth_url(); |
8 | +} |
|
8 | 9 | |
9 | 10 | $gdrive_construct = $remote_storage->gdrive_construct(); |
10 | 11 | ?> |
@@ -24,7 +25,8 @@ discard block |
||
24 | 25 | <div class="switch right"> |
25 | 26 | <label> |
26 | 27 | Off |
27 | - <input type="checkbox" name="xcloner_ftp_enable" class="status" value="1" <?php if(get_option("xcloner_ftp_enable")) echo "checked"?> \> |
|
28 | + <input type="checkbox" name="xcloner_ftp_enable" class="status" value="1" <?php if(get_option("xcloner_ftp_enable")) { |
|
29 | + echo "checked"?> \> |
|
28 | 30 | <span class="lever"></span> |
29 | 31 | On |
30 | 32 | </label> |
@@ -280,6 +282,7 @@ discard block |
||
280 | 282 | <option readonly value=""><?php echo __("Please Select AWS Region")?></option> |
281 | 283 | <?php |
282 | 284 | $aws_regions = $remote_storage->get_aws_regions(); |
285 | +} |
|
283 | 286 | |
284 | 287 | foreach($aws_regions as $key=>$region){ |
285 | 288 | ?> |
@@ -332,7 +335,8 @@ discard block |
||
332 | 335 | <div class="switch right"> |
333 | 336 | <label> |
334 | 337 | Off |
335 | - <input type="checkbox" name="xcloner_dropbox_enable" class="status" value="1" <?php if(get_option("xcloner_dropbox_enable")) echo "checked"?> \> |
|
338 | + <input type="checkbox" name="xcloner_dropbox_enable" class="status" value="1" <?php if(get_option("xcloner_dropbox_enable")) { |
|
339 | + echo "checked"?> \> |
|
336 | 340 | <span class="lever"></span> |
337 | 341 | On |
338 | 342 | </label> |
@@ -751,6 +755,7 @@ discard block |
||
751 | 755 | <div class="center"> |
752 | 756 | <?php |
753 | 757 | $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=xcloner-google-drive'), 'install-plugin_xcloner-google-drive'); |
758 | +} |
|
754 | 759 | ?> |
755 | 760 | <h6><?php echo __("This storage option requires the XCloner-Google-Drive Wordpress Plugin to be installed and activated.")?></h6> |
756 | 761 | <h6><?php echo __("PHP 5.5 minimum version is required.")?></h6> |
@@ -4,19 +4,19 @@ discard block |
||
4 | 4 | use League\Flysystem\Util; |
5 | 5 | use League\Flysystem\Adapter\Local; |
6 | 6 | |
7 | -class Xcloner_File_System{ |
|
7 | +class Xcloner_File_System { |
|
8 | 8 | |
9 | - private $excluded_files = ""; |
|
9 | + private $excluded_files = ""; |
|
10 | 10 | private $additional_regex_patterns = array(); |
11 | 11 | private $excluded_files_by_default = array("administrator/backups", "wp-content/backups"); |
12 | - private $included_files_handler = "backup_files.csv"; |
|
13 | - private $temp_dir_handler = ".dir"; |
|
12 | + private $included_files_handler = "backup_files.csv"; |
|
13 | + private $temp_dir_handler = ".dir"; |
|
14 | 14 | public $filesystem; |
15 | 15 | public $tmp_filesystem; |
16 | 16 | public $storage_filesystem; |
17 | 17 | private $xcloner_settings_append; |
18 | 18 | private $xcloner_container; |
19 | - private $diff_timestamp_start = ""; |
|
19 | + private $diff_timestamp_start = ""; |
|
20 | 20 | |
21 | 21 | private $logger; |
22 | 22 | private $start_adapter; |
@@ -39,47 +39,47 @@ discard block |
||
39 | 39 | { |
40 | 40 | $this->xcloner_container = $xcloner_container; |
41 | 41 | |
42 | - $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_file_system"); |
|
42 | + $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_file_system"); |
|
43 | 43 | $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
44 | 44 | |
45 | - try{ |
|
45 | + try { |
|
46 | 46 | |
47 | - $this->start_adapter = new Local($this->xcloner_settings->get_xcloner_start_path(),LOCK_EX, 'SKIP_LINKS'); |
|
47 | + $this->start_adapter = new Local($this->xcloner_settings->get_xcloner_start_path(), LOCK_EX, 'SKIP_LINKS'); |
|
48 | 48 | $this->start_filesystem = new Filesystem($this->start_adapter, new Config([ |
49 | 49 | 'disable_asserts' => true, |
50 | 50 | ])); |
51 | 51 | |
52 | - $this->tmp_adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(),LOCK_EX, 'SKIP_LINKS'); |
|
52 | + $this->tmp_adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(), LOCK_EX, 'SKIP_LINKS'); |
|
53 | 53 | $this->tmp_filesystem = new Filesystem($this->tmp_adapter, new Config([ |
54 | 54 | 'disable_asserts' => true, |
55 | 55 | ])); |
56 | - $adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(),LOCK_EX|FILE_APPEND, 'SKIP_LINKS'); |
|
56 | + $adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(), LOCK_EX | FILE_APPEND, 'SKIP_LINKS'); |
|
57 | 57 | $this->tmp_filesystem_append = new Filesystem($adapter, new Config([ |
58 | 58 | 'disable_asserts' => true, |
59 | 59 | ])); |
60 | 60 | |
61 | - $adapter = new Local($this->xcloner_settings->get_xcloner_store_path(),LOCK_EX, 'SKIP_LINKS'); |
|
61 | + $adapter = new Local($this->xcloner_settings->get_xcloner_store_path(), LOCK_EX, 'SKIP_LINKS'); |
|
62 | 62 | $this->storage_filesystem = new Filesystem($adapter, new Config([ |
63 | 63 | 'disable_asserts' => true, |
64 | 64 | ])); |
65 | 65 | |
66 | - $this->storage_adapter = new Local($this->xcloner_settings->get_xcloner_store_path(),FILE_APPEND, 'SKIP_LINKS'); |
|
66 | + $this->storage_adapter = new Local($this->xcloner_settings->get_xcloner_store_path(), FILE_APPEND, 'SKIP_LINKS'); |
|
67 | 67 | $this->storage_filesystem_append = new Filesystem($this->storage_adapter, new Config([ |
68 | 68 | 'disable_asserts' => true, |
69 | 69 | ])); |
70 | - }catch(Exception $e){ |
|
70 | + }catch (Exception $e) { |
|
71 | 71 | $this->logger->error("Filesystem Initialization Error: ".$e->getMessage()); |
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | - if($value = get_option('xcloner_directories_to_scan_per_request')) |
|
75 | + if ($value = get_option('xcloner_directories_to_scan_per_request')) |
|
76 | 76 | $this->folders_to_process_per_session = $value; |
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | 80 | public function set_diff_timestamp_start($timestamp = "") |
81 | 81 | { |
82 | - if($timestamp) |
|
82 | + if ($timestamp) |
|
83 | 83 | { |
84 | 84 | $this->logger->info(sprintf("Setting Differential Timestamp To %s", date("Y-m-d", $timestamp)), array("FILESYSTEM", "DIFF")); |
85 | 85 | $this->diff_timestamp_start = $timestamp; |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | |
115 | 115 | public function get_storage_filesystem($remote_storage_selection = "") |
116 | 116 | { |
117 | - if($remote_storage_selection != "") |
|
117 | + if ($remote_storage_selection != "") |
|
118 | 118 | { |
119 | 119 | $remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
120 | 120 | $method = "get_".$remote_storage_selection."_filesystem"; |
121 | 121 | |
122 | - if(!method_exists($remote_storage, $method)) |
|
122 | + if (!method_exists($remote_storage, $method)) |
|
123 | 123 | return false; |
124 | 124 | |
125 | 125 | list($adapter, $filesystem) = $remote_storage->$method(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | public function get_start_path_file_info($file) |
159 | 159 | { |
160 | - $info= $this->getMetadataFull('start_adapter', $file); |
|
160 | + $info = $this->getMetadataFull('start_adapter', $file); |
|
161 | 161 | return $this->start_filesystem->normalizeFileInfo($info); |
162 | 162 | } |
163 | 163 | |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | return $this->getMetadataFull('storage_adapter', $file); |
167 | 167 | } |
168 | 168 | |
169 | - public function get_included_files_handler($metadata = 0) |
|
169 | + public function get_included_files_handler($metadata = 0) |
|
170 | 170 | { |
171 | 171 | $path = $this->included_files_handler; |
172 | - if(!$metadata) |
|
172 | + if (!$metadata) |
|
173 | 173 | return $path; |
174 | 174 | |
175 | 175 | $spl_info = $this->getMetadataFull('tmp_adapter', $path); |
@@ -186,16 +186,16 @@ discard block |
||
186 | 186 | { |
187 | 187 | $files = $this->get_backup_archives_list(); |
188 | 188 | |
189 | - if(is_array($files)) |
|
190 | - $this->sort_by($files, "timestamp","desc"); |
|
189 | + if (is_array($files)) |
|
190 | + $this->sort_by($files, "timestamp", "desc"); |
|
191 | 191 | |
192 | 192 | $new_list = array(); |
193 | 193 | |
194 | - foreach($files as $key=>$file) |
|
195 | - if(!isset($file['parent'])) |
|
194 | + foreach ($files as $key=>$file) |
|
195 | + if (!isset($file['parent'])) |
|
196 | 196 | $new_list[] = ($files[$key]); |
197 | 197 | |
198 | - if(isset($new_list[0])) |
|
198 | + if (isset($new_list[0])) |
|
199 | 199 | return $new_list[0]; |
200 | 200 | } |
201 | 201 | |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | { |
204 | 204 | $files = $this->get_backup_archives_list(); |
205 | 205 | |
206 | - if(is_array($files)) |
|
207 | - $this->sort_by($files, "timestamp","desc"); |
|
206 | + if (is_array($files)) |
|
207 | + $this->sort_by($files, "timestamp", "desc"); |
|
208 | 208 | |
209 | 209 | $new_list = array(); |
210 | 210 | |
211 | - foreach($files as $key=>$file) |
|
212 | - if(!isset($file['parent'])) |
|
211 | + foreach ($files as $key=>$file) |
|
212 | + if (!isset($file['parent'])) |
|
213 | 213 | $new_list[] = ($files[$key]); |
214 | 214 | |
215 | 215 | return $new_list; |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | $files = $this->get_backup_archives_list(); |
221 | 221 | $total = 0; |
222 | 222 | |
223 | - if(is_array($files)) |
|
224 | - foreach($files as $file) |
|
223 | + if (is_array($files)) |
|
224 | + foreach ($files as $file) |
|
225 | 225 | $total += $file['size']; |
226 | 226 | |
227 | 227 | return $total; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | public function is_part($backup_name) |
231 | 231 | { |
232 | - if(stristr($backup_name, "-part")) |
|
232 | + if (stristr($backup_name, "-part")) |
|
233 | 233 | return true; |
234 | 234 | |
235 | 235 | return false; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | public function is_multipart($backup_name) |
239 | 239 | { |
240 | - if(stristr($backup_name, "-multipart")) |
|
240 | + if (stristr($backup_name, "-multipart")) |
|
241 | 241 | return true; |
242 | 242 | |
243 | 243 | return false; |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | public function get_backup_size($backup_name) |
247 | 247 | { |
248 | 248 | $backup_size = $this->get_storage_filesystem()->getSize($backup_name); |
249 | - if($this->is_multipart($backup_name)) |
|
249 | + if ($this->is_multipart($backup_name)) |
|
250 | 250 | { |
251 | 251 | $backup_parts = $this->get_multipart_files($backup_name); |
252 | - foreach($backup_parts as $part_file) |
|
252 | + foreach ($backup_parts as $part_file) |
|
253 | 253 | $backup_size += $this->get_storage_filesystem()->getSize($part_file); |
254 | 254 | } |
255 | 255 | |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | { |
261 | 261 | $files = array(); |
262 | 262 | |
263 | - if($this->is_multipart($backup_name)) |
|
263 | + if ($this->is_multipart($backup_name)) |
|
264 | 264 | { |
265 | 265 | $lines = explode(PHP_EOL, $this->get_storage_filesystem($storage_selection)->read($backup_name)); |
266 | - foreach($lines as $line) |
|
266 | + foreach ($lines as $line) |
|
267 | 267 | { |
268 | - if($line) |
|
268 | + if ($line) |
|
269 | 269 | { |
270 | 270 | $data = str_getcsv($line); |
271 | 271 | $files[] = $data[0]; |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | |
279 | 279 | public function delete_backup_by_name($backup_name, $storage_selection = "") |
280 | 280 | { |
281 | - if($this->is_multipart($backup_name)) |
|
281 | + if ($this->is_multipart($backup_name)) |
|
282 | 282 | { |
283 | 283 | $lines = explode(PHP_EOL, $this->get_storage_filesystem($storage_selection)->read($backup_name)); |
284 | - foreach($lines as $line) |
|
284 | + foreach ($lines as $line) |
|
285 | 285 | { |
286 | - if($line) |
|
286 | + if ($line) |
|
287 | 287 | { |
288 | 288 | $data = str_getcsv($line); |
289 | 289 | $this->get_storage_filesystem($storage_selection)->delete($data[0]); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
294 | - if($this->get_storage_filesystem($storage_selection)->delete($backup_name)) |
|
294 | + if ($this->get_storage_filesystem($storage_selection)->delete($backup_name)) |
|
295 | 295 | $return = true; |
296 | 296 | else |
297 | 297 | $return = false; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | return $return; |
300 | 300 | } |
301 | 301 | |
302 | - public function getMetadataFull($adapter = "storage_adapter" , $path) |
|
302 | + public function getMetadataFull($adapter = "storage_adapter", $path) |
|
303 | 303 | { |
304 | 304 | $location = $this->$adapter->applyPathPrefix($path); |
305 | 305 | $spl_info = new SplFileInfo($location); |
@@ -313,25 +313,25 @@ discard block |
||
313 | 313 | $list = array(); |
314 | 314 | |
315 | 315 | |
316 | - if(method_exists($this->get_storage_filesystem($storage_selection), "listContents")) |
|
316 | + if (method_exists($this->get_storage_filesystem($storage_selection), "listContents")) |
|
317 | 317 | $list = $this->get_storage_filesystem($storage_selection)->listContents(); |
318 | 318 | |
319 | 319 | |
320 | 320 | $backup_files = array(); |
321 | 321 | $parents = array(); |
322 | 322 | |
323 | - foreach($list as $file_info) |
|
323 | + foreach ($list as $file_info) |
|
324 | 324 | { |
325 | - if(isset($file_info['extension']) and $file_info['extension'] == "csv") |
|
325 | + if (isset($file_info['extension']) and $file_info['extension'] == "csv") |
|
326 | 326 | { |
327 | 327 | $data = array(); |
328 | 328 | |
329 | 329 | $lines = explode(PHP_EOL, $this->get_storage_filesystem($storage_selection)->read($file_info['path'])); |
330 | - foreach($lines as $line) |
|
331 | - if($line) |
|
330 | + foreach ($lines as $line) |
|
331 | + if ($line) |
|
332 | 332 | { |
333 | 333 | $data = str_getcsv($line); |
334 | - if(is_array($data)){ |
|
334 | + if (is_array($data)) { |
|
335 | 335 | $parents[$data[0]] = $file_info['basename']; |
336 | 336 | $file_info['childs'][] = $data; |
337 | 337 | $file_info['size'] += $data[2]; |
@@ -340,18 +340,18 @@ discard block |
||
340 | 340 | |
341 | 341 | } |
342 | 342 | |
343 | - if($file_info['type'] == 'file' and isset($file_info['extension']) and in_array($file_info['extension'], $this->backup_archive_extensions)) |
|
343 | + if ($file_info['type'] == 'file' and isset($file_info['extension']) and in_array($file_info['extension'], $this->backup_archive_extensions)) |
|
344 | 344 | $backup_files[$file_info['path']] = $file_info; |
345 | 345 | } |
346 | 346 | |
347 | - foreach($backup_files as $key=>$file_info) |
|
347 | + foreach ($backup_files as $key=>$file_info) |
|
348 | 348 | { |
349 | - if(!isset($backup_files[$key]['timestamp'])) |
|
349 | + if (!isset($backup_files[$key]['timestamp'])) |
|
350 | 350 | { |
351 | 351 | //$backup_files[$key]['timestamp'] = $this->get_storage_filesystem($storage_selection)->getTimestamp($file_info['path']); |
352 | 352 | } |
353 | 353 | |
354 | - if(isset($parents[$file_info['basename']])) |
|
354 | + if (isset($parents[$file_info['basename']])) |
|
355 | 355 | $backup_files[$key]['parent'] = $parents[$file_info['basename']]; |
356 | 356 | } |
357 | 357 | |
@@ -360,40 +360,40 @@ discard block |
||
360 | 360 | |
361 | 361 | public function start_file_recursion($init = 0) |
362 | 362 | { |
363 | - if($init) |
|
363 | + if ($init) |
|
364 | 364 | { |
365 | 365 | $this->logger->info(sprintf(__("Starting the filesystem scanner on root folder %s"), $this->xcloner_settings->get_xcloner_start_path())); |
366 | 366 | $this->do_system_init(); |
367 | 367 | } |
368 | 368 | |
369 | - if($this->tmp_filesystem->has($this->get_temp_dir_handler())){ |
|
369 | + if ($this->tmp_filesystem->has($this->get_temp_dir_handler())) { |
|
370 | 370 | //.dir exists, we presume we have files to iterate |
371 | 371 | $content = $this->tmp_filesystem->read($this->get_temp_dir_handler()); |
372 | 372 | $files = array_filter(explode("\n", $content)); |
373 | 373 | $this->tmp_filesystem->delete($this->get_temp_dir_handler()); |
374 | 374 | |
375 | 375 | $counter = 0; |
376 | - foreach($files as $file) |
|
376 | + foreach ($files as $file) |
|
377 | 377 | { |
378 | - if($counter < $this->folders_to_process_per_session){ |
|
378 | + if ($counter < $this->folders_to_process_per_session) { |
|
379 | 379 | $this->build_files_list($file); |
380 | 380 | $counter++; |
381 | - }else{ |
|
381 | + } else { |
|
382 | 382 | $this->tmp_filesystem_append->write($this->get_temp_dir_handler(), $file."\n"); |
383 | 383 | } |
384 | 384 | } |
385 | - }else{ |
|
385 | + } else { |
|
386 | 386 | $this->build_files_list(); |
387 | 387 | } |
388 | 388 | |
389 | - if($this->scan_finished()) |
|
389 | + if ($this->scan_finished()) |
|
390 | 390 | { |
391 | 391 | $metadata_dumpfile = $this->get_tmp_filesystem()->getMetadata("index.html"); |
392 | 392 | $this->store_file($metadata_dumpfile, 'tmp_filesystem'); |
393 | 393 | $this->files_counter++; |
394 | 394 | |
395 | 395 | //adding included dump file to the included files list |
396 | - if($this->get_tmp_filesystem()->has($this->get_included_files_handler())) |
|
396 | + if ($this->get_tmp_filesystem()->has($this->get_included_files_handler())) |
|
397 | 397 | { |
398 | 398 | $metadata_dumpfile = $this->get_tmp_filesystem()->getMetadata($this->get_included_files_handler()); |
399 | 399 | $this->store_file($metadata_dumpfile, 'tmp_filesystem'); |
@@ -401,13 +401,13 @@ discard block |
||
401 | 401 | } |
402 | 402 | |
403 | 403 | //adding a default index.html to the temp xcloner folder |
404 | - if(!$this->get_tmp_filesystem()->has("index.html")) |
|
404 | + if (!$this->get_tmp_filesystem()->has("index.html")) |
|
405 | 405 | { |
406 | - $this->get_tmp_filesystem()->write("index.html",""); |
|
406 | + $this->get_tmp_filesystem()->write("index.html", ""); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | //adding the default log file |
410 | - if($this->get_tmp_filesystem()->has($this->xcloner_settings->get_logger_filename(1))) |
|
410 | + if ($this->get_tmp_filesystem()->has($this->xcloner_settings->get_logger_filename(1))) |
|
411 | 411 | { |
412 | 412 | $metadata_dumpfile = $this->get_tmp_filesystem()->getMetadata($this->xcloner_settings->get_logger_filename(1)); |
413 | 413 | $this->store_file($metadata_dumpfile, 'tmp_filesystem'); |
@@ -425,20 +425,20 @@ discard block |
||
425 | 425 | $return = array(); |
426 | 426 | |
427 | 427 | $files_list_file = $this->xcloner_settings->get_xcloner_tmp_path().DS.$this->get_included_files_handler(); |
428 | - if(file_exists($files_list_file)) |
|
428 | + if (file_exists($files_list_file)) |
|
429 | 429 | { |
430 | 430 | $return[] = $files_list_file; |
431 | 431 | } |
432 | 432 | |
433 | - if($this->xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
|
433 | + if ($this->xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
|
434 | 434 | { |
435 | 435 | $log_file = $this->xcloner_settings->get_xcloner_tmp_path().DS.$this->xcloner_settings->get_logger_filename(1); |
436 | - if(!file_exists($log_file)) |
|
436 | + if (!file_exists($log_file)) |
|
437 | 437 | { |
438 | 438 | $log_file = $this->xcloner_settings->get_xcloner_store_path().DS.$this->xcloner_settings->get_logger_filename(); |
439 | 439 | } |
440 | 440 | |
441 | - if(file_exists($log_file)) |
|
441 | + if (file_exists($log_file)) |
|
442 | 442 | { |
443 | 443 | $return[] = $log_file; |
444 | 444 | } |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | |
455 | 455 | $contents = $this->get_tmp_filesystem()->listContents(); |
456 | 456 | |
457 | - if(is_array($contents)) |
|
458 | - foreach($contents as $file_info) |
|
457 | + if (is_array($contents)) |
|
458 | + foreach ($contents as $file_info) |
|
459 | 459 | $this->get_tmp_filesystem()->delete($file_info['path']); |
460 | 460 | |
461 | 461 | @rmdir($this->xcloner_settings->get_xcloner_tmp_path()); |
@@ -465,16 +465,16 @@ discard block |
||
465 | 465 | |
466 | 466 | public function cleanup_tmp_directories() |
467 | 467 | { |
468 | - $adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(false),LOCK_EX|FILE_APPEND, 'SKIP_LINKS'); |
|
468 | + $adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(false), LOCK_EX | FILE_APPEND, 'SKIP_LINKS'); |
|
469 | 469 | $tmp_filesystem = new Filesystem($adapter, new Config([ |
470 | 470 | 'disable_asserts' => true, |
471 | 471 | ])); |
472 | 472 | |
473 | 473 | $contents = $tmp_filesystem->listContents(); |
474 | 474 | |
475 | - foreach($contents as $file) |
|
475 | + foreach ($contents as $file) |
|
476 | 476 | { |
477 | - if(preg_match("/.xcloner-(.*)/",$file['path'])) |
|
477 | + if (preg_match("/.xcloner-(.*)/", $file['path'])) |
|
478 | 478 | { |
479 | 479 | $tmp_filesystem->deleteDir($file['path']); |
480 | 480 | $this->logger->info(sprintf("Delete temporary directory %s", $file['path'])); |
@@ -488,16 +488,16 @@ discard block |
||
488 | 488 | { |
489 | 489 | $this->files_counter = 0; |
490 | 490 | |
491 | - if(!$this->storage_filesystem->has("index.html")) |
|
492 | - $this->storage_filesystem->write("index.html",""); |
|
491 | + if (!$this->storage_filesystem->has("index.html")) |
|
492 | + $this->storage_filesystem->write("index.html", ""); |
|
493 | 493 | |
494 | - if(!$this->tmp_filesystem->has("index.html")) |
|
495 | - $this->tmp_filesystem->write("index.html",""); |
|
494 | + if (!$this->tmp_filesystem->has("index.html")) |
|
495 | + $this->tmp_filesystem->write("index.html", ""); |
|
496 | 496 | |
497 | - if($this->tmp_filesystem->has($this->get_included_files_handler())) |
|
497 | + if ($this->tmp_filesystem->has($this->get_included_files_handler())) |
|
498 | 498 | $this->tmp_filesystem->delete($this->get_included_files_handler()); |
499 | 499 | |
500 | - if($this->tmp_filesystem->has($this->get_temp_dir_handler())) |
|
500 | + if ($this->tmp_filesystem->has($this->get_temp_dir_handler())) |
|
501 | 501 | $this->tmp_filesystem->delete($this->get_temp_dir_handler()); |
502 | 502 | } |
503 | 503 | |
@@ -517,20 +517,20 @@ discard block |
||
517 | 517 | } |
518 | 518 | |
519 | 519 | public static function is_regex($regex) { |
520 | - return preg_match("/^\^(.*)\$$/i",$regex); |
|
520 | + return preg_match("/^\^(.*)\$$/i", $regex); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | public function set_excluded_files($excluded_files = array()) |
524 | 524 | { |
525 | - if(!is_array($excluded_files)) |
|
525 | + if (!is_array($excluded_files)) |
|
526 | 526 | { |
527 | 527 | $excluded_files = array(); |
528 | 528 | } |
529 | 529 | |
530 | - foreach($excluded_files as $excl) |
|
530 | + foreach ($excluded_files as $excl) |
|
531 | 531 | { |
532 | 532 | |
533 | - if($this->is_regex($excl)) |
|
533 | + if ($this->is_regex($excl)) |
|
534 | 534 | { |
535 | 535 | $this->additional_regex_patterns[] = $excl; |
536 | 536 | } |
@@ -556,35 +556,35 @@ discard block |
||
556 | 556 | $this->logger->debug(sprintf(("Building the files system list"))); |
557 | 557 | |
558 | 558 | //if we start with the root folder(empty value), we initializa the file system |
559 | - if(!$folder){ |
|
559 | + if (!$folder) { |
|
560 | 560 | |
561 | 561 | } |
562 | 562 | |
563 | - try{ |
|
563 | + try { |
|
564 | 564 | |
565 | 565 | $files = $this->start_filesystem->listContents($folder); |
566 | - foreach($files as $file) |
|
566 | + foreach ($files as $file) |
|
567 | 567 | { |
568 | - if(!is_readable($this->xcloner_settings->get_xcloner_start_path().DS.$file['path'])) |
|
568 | + if (!is_readable($this->xcloner_settings->get_xcloner_start_path().DS.$file['path'])) |
|
569 | 569 | { |
570 | - $this->logger->info(sprintf(__("Excluding %s from the filesystem list, file not readable"), $file['path']), array("FILESYSTEM SCAN","NOT READABLE")); |
|
570 | + $this->logger->info(sprintf(__("Excluding %s from the filesystem list, file not readable"), $file['path']), array("FILESYSTEM SCAN", "NOT READABLE")); |
|
571 | 571 | } |
572 | - elseif(!$matching_pattern = $this->is_excluded($file) ){ |
|
573 | - $this->logger->info(sprintf(__("Adding %s to the filesystem list"), $file['path']), array("FILESYSTEM SCAN","INCLUDE")); |
|
572 | + elseif (!$matching_pattern = $this->is_excluded($file)) { |
|
573 | + $this->logger->info(sprintf(__("Adding %s to the filesystem list"), $file['path']), array("FILESYSTEM SCAN", "INCLUDE")); |
|
574 | 574 | $file['visibility'] = $this->start_filesystem->getVisibility($file['path']); |
575 | - if($this->store_file($file)) |
|
575 | + if ($this->store_file($file)) |
|
576 | 576 | { |
577 | 577 | $this->files_counter++; |
578 | 578 | } |
579 | - if(isset($file['size'])) |
|
579 | + if (isset($file['size'])) |
|
580 | 580 | $this->files_size += $file['size']; |
581 | 581 | |
582 | - }else{ |
|
583 | - $this->logger->info(sprintf(__("Excluding %s from the filesystem list, matching pattern %s"), $file['path'], $matching_pattern), array("FILESYSTEM SCAN","EXCLUDE")); |
|
582 | + } else { |
|
583 | + $this->logger->info(sprintf(__("Excluding %s from the filesystem list, matching pattern %s"), $file['path'], $matching_pattern), array("FILESYSTEM SCAN", "EXCLUDE")); |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | |
587 | - }catch(Exception $e){ |
|
587 | + }catch (Exception $e) { |
|
588 | 588 | |
589 | 589 | $this->logger->error($e->getMessage()); |
590 | 590 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | |
599 | 599 | $start_time = microtime(); |
600 | 600 | |
601 | - $data = str_repeat(rand(0,9), 1024*1024); //write 1MB data |
|
601 | + $data = str_repeat(rand(0, 9), 1024 * 1024); //write 1MB data |
|
602 | 602 | |
603 | - try{ |
|
603 | + try { |
|
604 | 604 | $this->tmp_filesystem->write($tmp_file, $data); |
605 | 605 | |
606 | 606 | $end_time = microtime() - $start_time; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | |
612 | 612 | $this->tmp_filesystem->delete($tmp_file); |
613 | 613 | |
614 | - }catch(Exception $e){ |
|
614 | + }catch (Exception $e) { |
|
615 | 615 | |
616 | 616 | $this->logger->error($e->getMessage()); |
617 | 617 | |
@@ -632,10 +632,10 @@ discard block |
||
632 | 632 | |
633 | 633 | $files = $this->storage_filesystem->listContents(); |
634 | 634 | |
635 | - if(is_array($files)) |
|
636 | - foreach($files as $file) |
|
635 | + if (is_array($files)) |
|
636 | + foreach ($files as $file) |
|
637 | 637 | { |
638 | - if(isset($file['extension']) and in_array($file['extension'], $this->backup_archive_extensions)) |
|
638 | + if (isset($file['extension']) and in_array($file['extension'], $this->backup_archive_extensions)) |
|
639 | 639 | { |
640 | 640 | $_storage_size += $file['size']; //bytes |
641 | 641 | $_backup_files_list[] = $file; |
@@ -643,15 +643,15 @@ discard block |
||
643 | 643 | } |
644 | 644 | |
645 | 645 | |
646 | - $this->sort_by($_backup_files_list, "timestamp","asc"); |
|
646 | + $this->sort_by($_backup_files_list, "timestamp", "asc"); |
|
647 | 647 | |
648 | 648 | $_backups_counter = sizeof($_backup_files_list); |
649 | 649 | |
650 | - foreach($_backup_files_list as $file) |
|
650 | + foreach ($_backup_files_list as $file) |
|
651 | 651 | { |
652 | 652 | //processing rule folder capacity |
653 | - if($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit') && |
|
654 | - $_storage_size >= ($set_storage_limit = 1024*1024*$this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit'))) //bytes |
|
653 | + if ($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit') && |
|
654 | + $_storage_size >= ($set_storage_limit = 1024 * 1024 * $this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit'))) //bytes |
|
655 | 655 | { |
656 | 656 | $this->storage_filesystem->delete($file['path']); |
657 | 657 | $_storage_size -= $file['size']; |
@@ -659,14 +659,14 @@ discard block |
||
659 | 659 | } |
660 | 660 | |
661 | 661 | //processing rule days limit |
662 | - if($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_retention_limit_days') && $current_timestamp >= $file['timestamp']) |
|
662 | + if ($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_retention_limit_days') && $current_timestamp >= $file['timestamp']) |
|
663 | 663 | { |
664 | 664 | $this->storage_filesystem->delete($file['path']); |
665 | 665 | $this->logger->info("Deleting backup ".$file['path']." matching rule", array("RETENTION LIMIT TIMESTAMP", $file['timestamp']." =< ".$this->xcloner_settings->get_xcloner_option('xcloner_cleanup_retention_limit_days'))); |
666 | 666 | } |
667 | 667 | |
668 | 668 | //processing backup countert limit |
669 | - if($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_retention_limit_archives') && $_backups_counter >= $this->xcloner_settings->get_xcloner_option('xcloner_cleanup_retention_limit_archives')) |
|
669 | + if ($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_retention_limit_archives') && $_backups_counter >= $this->xcloner_settings->get_xcloner_option('xcloner_cleanup_retention_limit_archives')) |
|
670 | 670 | { |
671 | 671 | $this->storage_filesystem->delete($file['path']); |
672 | 672 | $_backups_counter--; |
@@ -692,33 +692,33 @@ discard block |
||
692 | 692 | |
693 | 693 | } |
694 | 694 | |
695 | - public function process_backup_name($name = "", $max_length=100) |
|
695 | + public function process_backup_name($name = "", $max_length = 100) |
|
696 | 696 | { |
697 | - if(!$name) |
|
697 | + if (!$name) |
|
698 | 698 | $name = $this->xcloner_settings->get_default_backup_name(); |
699 | 699 | |
700 | - foreach($this->backup_name_tags as $tag) |
|
700 | + foreach ($this->backup_name_tags as $tag) |
|
701 | 701 | { |
702 | - if($tag == '[time]') |
|
703 | - $name = str_replace($tag, date("Y-m-d_H-i"),$name); |
|
704 | - elseif($tag == '[hostname]') |
|
705 | - $name = str_replace($tag, gethostname() ,$name); |
|
706 | - elseif($tag == '[domain]') |
|
702 | + if ($tag == '[time]') |
|
703 | + $name = str_replace($tag, date("Y-m-d_H-i"), $name); |
|
704 | + elseif ($tag == '[hostname]') |
|
705 | + $name = str_replace($tag, gethostname(), $name); |
|
706 | + elseif ($tag == '[domain]') |
|
707 | 707 | { |
708 | 708 | $domain = parse_url(admin_url(), PHP_URL_HOST); |
709 | - $name = str_replace($tag, $domain ,$name); |
|
709 | + $name = str_replace($tag, $domain, $name); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | |
713 | - if($max_length) |
|
713 | + if ($max_length) |
|
714 | 714 | $name = substr($name, 0, $max_length); |
715 | 715 | |
716 | 716 | return $name; |
717 | 717 | } |
718 | 718 | |
719 | - public function sort_by( &$array, $field, $direction = 'asc') |
|
719 | + public function sort_by(&$array, $field, $direction = 'asc') |
|
720 | 720 | { |
721 | - if(strtolower($direction) == "desc" || $direction == SORT_DESC) |
|
721 | + if (strtolower($direction) == "desc" || $direction == SORT_DESC) |
|
722 | 722 | $direction = SORT_DESC; |
723 | 723 | else |
724 | 724 | $direction = SORT_ASC; |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | $tmp = array(); |
739 | 739 | foreach ($data as $key => $row) |
740 | 740 | { |
741 | - if(is_array($row)) |
|
741 | + if (is_array($row)) |
|
742 | 742 | $tmp[$key] = $row[$field]; |
743 | 743 | else |
744 | 744 | $tmp[$key] = $row->$field; |
@@ -755,18 +755,18 @@ discard block |
||
755 | 755 | |
756 | 756 | private function check_file_diff_time($file) |
757 | 757 | { |
758 | - if($this->get_diff_timestamp_start() != "") |
|
758 | + if ($this->get_diff_timestamp_start() != "") |
|
759 | 759 | { |
760 | 760 | $fileMeta = $this->getMetadataFull("start_adapter", $file['path']); |
761 | 761 | $timestamp = $fileMeta->getMTime(); |
762 | - if($timestamp < $fileMeta->getCTime()) |
|
762 | + if ($timestamp < $fileMeta->getCTime()) |
|
763 | 763 | { |
764 | 764 | $timestamp = $fileMeta->getCTime(); |
765 | 765 | } |
766 | 766 | |
767 | - if($timestamp <= $this->get_diff_timestamp_start()) |
|
767 | + if ($timestamp <= $this->get_diff_timestamp_start()) |
|
768 | 768 | { |
769 | - return " file DIFF timestamp ".$timestamp." < ". $this->diff_timestamp_start; |
|
769 | + return " file DIFF timestamp ".$timestamp." < ".$this->diff_timestamp_start; |
|
770 | 770 | } |
771 | 771 | } |
772 | 772 | |
@@ -777,37 +777,37 @@ discard block |
||
777 | 777 | { |
778 | 778 | $this->logger->debug(sprintf(("Checking if %s is excluded"), $file['path'])); |
779 | 779 | |
780 | - if($xcloner_exclude_files_larger_than_mb = $this->xcloner_settings->get_xcloner_option('xcloner_exclude_files_larger_than_mb')) |
|
780 | + if ($xcloner_exclude_files_larger_than_mb = $this->xcloner_settings->get_xcloner_option('xcloner_exclude_files_larger_than_mb')) |
|
781 | 781 | { |
782 | - if(isset($file['size']) && $file['size'] > $this->calc_to_bytes($xcloner_exclude_files_larger_than_mb)) |
|
782 | + if (isset($file['size']) && $file['size'] > $this->calc_to_bytes($xcloner_exclude_files_larger_than_mb)) |
|
783 | 783 | return "> ".$xcloner_exclude_files_larger_than_mb."MB"; |
784 | 784 | } |
785 | 785 | |
786 | - if(!sizeof($this->excluded_files)) |
|
786 | + if (!sizeof($this->excluded_files)) |
|
787 | 787 | { |
788 | 788 | $this->set_excluded_files(); |
789 | 789 | } |
790 | 790 | |
791 | - if(is_array($this->excluded_files)) |
|
792 | - foreach($this->excluded_files as $excluded_file_pattern) |
|
791 | + if (is_array($this->excluded_files)) |
|
792 | + foreach ($this->excluded_files as $excluded_file_pattern) |
|
793 | 793 | { |
794 | - if($excluded_file_pattern == "/") |
|
794 | + if ($excluded_file_pattern == "/") |
|
795 | 795 | $needle = "$"; |
796 | 796 | else |
797 | 797 | $needle = "$".$excluded_file_pattern; |
798 | 798 | |
799 | - if(strstr("$".$file['path'], $needle)){ |
|
799 | + if (strstr("$".$file['path'], $needle)) { |
|
800 | 800 | return $excluded_file_pattern; |
801 | 801 | } |
802 | 802 | } |
803 | 803 | |
804 | - if( $regex = $this->is_excluded_regex($file)) |
|
804 | + if ($regex = $this->is_excluded_regex($file)) |
|
805 | 805 | return $regex; |
806 | 806 | |
807 | - if($file['type'] == "file") |
|
807 | + if ($file['type'] == "file") |
|
808 | 808 | { |
809 | 809 | $check_file_diff_timestamp = $this->check_file_diff_time($file); |
810 | - if($check_file_diff_timestamp) |
|
810 | + if ($check_file_diff_timestamp) |
|
811 | 811 | { |
812 | 812 | return $check_file_diff_timestamp; |
813 | 813 | } |
@@ -854,32 +854,32 @@ discard block |
||
854 | 854 | |
855 | 855 | $regex_patterns = explode(PHP_EOL, $this->xcloner_settings->get_xcloner_option('xcloner_regex_exclude')); |
856 | 856 | |
857 | - if(is_array($this->additional_regex_patterns)) |
|
857 | + if (is_array($this->additional_regex_patterns)) |
|
858 | 858 | { |
859 | 859 | $regex_patterns = array_merge($regex_patterns, $this->additional_regex_patterns); |
860 | 860 | } |
861 | 861 | |
862 | 862 | //print_r($regex_patterns);exit; |
863 | 863 | |
864 | - if(is_array($regex_patterns)) |
|
864 | + if (is_array($regex_patterns)) |
|
865 | 865 | { |
866 | 866 | //$this->excluded_files = array(); |
867 | 867 | //$this->excluded_files[] ="(.*)\.(git)(.*)$"; |
868 | 868 | //$this->excluded_files[] ="wp-content\/backups(.*)$"; |
869 | 869 | |
870 | - foreach($regex_patterns as $excluded_file_pattern) |
|
870 | + foreach ($regex_patterns as $excluded_file_pattern) |
|
871 | 871 | { |
872 | 872 | |
873 | - if( substr($excluded_file_pattern, strlen($excluded_file_pattern)-1, strlen($excluded_file_pattern)) == "\r") |
|
874 | - $excluded_file_pattern = substr($excluded_file_pattern, 0, strlen($excluded_file_pattern)-1); |
|
873 | + if (substr($excluded_file_pattern, strlen($excluded_file_pattern) - 1, strlen($excluded_file_pattern)) == "\r") |
|
874 | + $excluded_file_pattern = substr($excluded_file_pattern, 0, strlen($excluded_file_pattern) - 1); |
|
875 | 875 | |
876 | - if($file['path'] == "/") |
|
876 | + if ($file['path'] == "/") |
|
877 | 877 | $needle = "/"; |
878 | 878 | else |
879 | 879 | $needle = "/".$file['path']; |
880 | 880 | //echo $needle."---".$excluded_file_pattern."---\n"; |
881 | 881 | |
882 | - if(@preg_match("/(^|^\/)".$excluded_file_pattern."/i", $needle)){ |
|
882 | + if (@preg_match("/(^|^\/)".$excluded_file_pattern."/i", $needle)) { |
|
883 | 883 | return $excluded_file_pattern; |
884 | 884 | } |
885 | 885 | } |
@@ -892,36 +892,36 @@ discard block |
||
892 | 892 | { |
893 | 893 | $this->logger->debug(sprintf("Storing %s in the backup list", $file['path'])); |
894 | 894 | |
895 | - if(!isset($file['size'])) |
|
895 | + if (!isset($file['size'])) |
|
896 | 896 | $file['size'] = 0; |
897 | - if(!isset($file['visibility'])) |
|
897 | + if (!isset($file['visibility'])) |
|
898 | 898 | $file['visibility'] = "private"; |
899 | 899 | |
900 | - $csv_filename = str_replace('"','""', $file['path']); |
|
900 | + $csv_filename = str_replace('"', '""', $file['path']); |
|
901 | 901 | |
902 | 902 | $line = '"'.($csv_filename).'","'.$file['timestamp'].'","'.$file['size'].'","'.$file['visibility'].'","'.$storage.'"'.PHP_EOL; |
903 | 903 | |
904 | 904 | $this->last_logged_file = $file['path']; |
905 | 905 | |
906 | - if($file['type'] == "dir"){ |
|
907 | - try{ |
|
906 | + if ($file['type'] == "dir") { |
|
907 | + try { |
|
908 | 908 | $this->tmp_filesystem_append->write($this->get_temp_dir_handler(), $file['path']."\n"); |
909 | - }catch(Exception $e){ |
|
909 | + }catch (Exception $e) { |
|
910 | 910 | $this->logger->error($e->getMessage()); |
911 | 911 | } |
912 | 912 | } |
913 | 913 | |
914 | - if($this->get_diff_timestamp_start()) |
|
914 | + if ($this->get_diff_timestamp_start()) |
|
915 | 915 | { |
916 | - if($file['type'] != "file" && $response = $this->check_file_diff_time($file)) |
|
916 | + if ($file['type'] != "file" && $response = $this->check_file_diff_time($file)) |
|
917 | 917 | { |
918 | - $this->logger->info(sprintf("Directory %s archiving skipped on differential backup %s", $file['path'], $response), array("FILESYSTEM SCAN","DIR DIFF")); |
|
918 | + $this->logger->info(sprintf("Directory %s archiving skipped on differential backup %s", $file['path'], $response), array("FILESYSTEM SCAN", "DIR DIFF")); |
|
919 | 919 | return false; |
920 | 920 | } |
921 | 921 | } |
922 | 922 | |
923 | - try{ |
|
924 | - if(!$this->tmp_filesystem_append->has($this->get_included_files_handler())) |
|
923 | + try { |
|
924 | + if (!$this->tmp_filesystem_append->has($this->get_included_files_handler())) |
|
925 | 925 | { |
926 | 926 | //adding fix for UTF-8 CSV preview |
927 | 927 | $start_line = "\xEF\xBB\xBF".'"Filename","Timestamp","Size","Visibility","Storage"'.PHP_EOL; |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | |
931 | 931 | $this->tmp_filesystem_append->write($this->get_included_files_handler(), $line); |
932 | 932 | |
933 | - }catch(Exception $e){ |
|
933 | + }catch (Exception $e) { |
|
934 | 934 | |
935 | 935 | $this->logger->error($e->getMessage()); |
936 | 936 | } |
@@ -945,13 +945,13 @@ discard block |
||
945 | 945 | |
946 | 946 | public function get_filesystem($system = "") |
947 | 947 | { |
948 | - if($system == "storage_filesystem_append") |
|
948 | + if ($system == "storage_filesystem_append") |
|
949 | 949 | return $this->storage_filesystem_append; |
950 | - elseif($system == "tmp_filesystem_append") |
|
950 | + elseif ($system == "tmp_filesystem_append") |
|
951 | 951 | return $this->tmp_filesystem_append; |
952 | - elseif($system == "tmp_filesystem") |
|
952 | + elseif ($system == "tmp_filesystem") |
|
953 | 953 | return $this->tmp_filesystem; |
954 | - elseif($system == "storage_filesystem") |
|
954 | + elseif ($system == "storage_filesystem") |
|
955 | 955 | return $this->storage_filesystem; |
956 | 956 | else |
957 | 957 | return $this->start_filesystem; |
@@ -959,9 +959,9 @@ discard block |
||
959 | 959 | |
960 | 960 | public function get_adapter($system) |
961 | 961 | { |
962 | - if($system == "tmp_filesystem") |
|
962 | + if ($system == "tmp_filesystem") |
|
963 | 963 | return $this->tmp_adapter; |
964 | - elseif($system == "storage_filesystem") |
|
964 | + elseif ($system == "storage_filesystem") |
|
965 | 965 | return $this->storage_adapter; |
966 | 966 | else |
967 | 967 | return $this->start_adapter; |
@@ -969,10 +969,10 @@ discard block |
||
969 | 969 | |
970 | 970 | private function scan_finished() |
971 | 971 | { |
972 | - if($this->tmp_filesystem_append->has($this->get_temp_dir_handler()) && $this->tmp_filesystem_append->getSize($this->get_temp_dir_handler())) |
|
972 | + if ($this->tmp_filesystem_append->has($this->get_temp_dir_handler()) && $this->tmp_filesystem_append->getSize($this->get_temp_dir_handler())) |
|
973 | 973 | return false; |
974 | 974 | |
975 | - if($this->tmp_filesystem->has($this->get_temp_dir_handler())) |
|
975 | + if ($this->tmp_filesystem->has($this->get_temp_dir_handler())) |
|
976 | 976 | $this->tmp_filesystem->delete($this->get_temp_dir_handler()); |
977 | 977 | |
978 | 978 | $this->logger->debug(sprintf(("File scan finished"))); |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | |
983 | 983 | private function calc_to_bytes($mb_size) |
984 | 984 | { |
985 | - return $mb_size*(1024*1024); |
|
985 | + return $mb_size * (1024 * 1024); |
|
986 | 986 | } |
987 | 987 | |
988 | 988 | } |
@@ -67,13 +67,14 @@ discard block |
||
67 | 67 | $this->storage_filesystem_append = new Filesystem($this->storage_adapter, new Config([ |
68 | 68 | 'disable_asserts' => true, |
69 | 69 | ])); |
70 | - }catch(Exception $e){ |
|
70 | + } catch(Exception $e){ |
|
71 | 71 | $this->logger->error("Filesystem Initialization Error: ".$e->getMessage()); |
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | - if($value = get_option('xcloner_directories_to_scan_per_request')) |
|
76 | - $this->folders_to_process_per_session = $value; |
|
75 | + if($value = get_option('xcloner_directories_to_scan_per_request')) { |
|
76 | + $this->folders_to_process_per_session = $value; |
|
77 | + } |
|
77 | 78 | |
78 | 79 | } |
79 | 80 | |
@@ -119,8 +120,9 @@ discard block |
||
119 | 120 | $remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
120 | 121 | $method = "get_".$remote_storage_selection."_filesystem"; |
121 | 122 | |
122 | - if(!method_exists($remote_storage, $method)) |
|
123 | - return false; |
|
123 | + if(!method_exists($remote_storage, $method)) { |
|
124 | + return false; |
|
125 | + } |
|
124 | 126 | |
125 | 127 | list($adapter, $filesystem) = $remote_storage->$method(); |
126 | 128 | |
@@ -169,8 +171,9 @@ discard block |
||
169 | 171 | public function get_included_files_handler($metadata = 0) |
170 | 172 | { |
171 | 173 | $path = $this->included_files_handler; |
172 | - if(!$metadata) |
|
173 | - return $path; |
|
174 | + if(!$metadata) { |
|
175 | + return $path; |
|
176 | + } |
|
174 | 177 | |
175 | 178 | $spl_info = $this->getMetadataFull('tmp_adapter', $path); |
176 | 179 | return $spl_info; |
@@ -186,31 +189,36 @@ discard block |
||
186 | 189 | { |
187 | 190 | $files = $this->get_backup_archives_list(); |
188 | 191 | |
189 | - if(is_array($files)) |
|
190 | - $this->sort_by($files, "timestamp","desc"); |
|
192 | + if(is_array($files)) { |
|
193 | + $this->sort_by($files, "timestamp","desc"); |
|
194 | + } |
|
191 | 195 | |
192 | 196 | $new_list = array(); |
193 | 197 | |
194 | - foreach($files as $key=>$file) |
|
195 | - if(!isset($file['parent'])) |
|
198 | + foreach($files as $key=>$file) { |
|
199 | + if(!isset($file['parent'])) |
|
196 | 200 | $new_list[] = ($files[$key]); |
201 | + } |
|
197 | 202 | |
198 | - if(isset($new_list[0])) |
|
199 | - return $new_list[0]; |
|
203 | + if(isset($new_list[0])) { |
|
204 | + return $new_list[0]; |
|
205 | + } |
|
200 | 206 | } |
201 | 207 | |
202 | 208 | public function get_latest_backups() |
203 | 209 | { |
204 | 210 | $files = $this->get_backup_archives_list(); |
205 | 211 | |
206 | - if(is_array($files)) |
|
207 | - $this->sort_by($files, "timestamp","desc"); |
|
212 | + if(is_array($files)) { |
|
213 | + $this->sort_by($files, "timestamp","desc"); |
|
214 | + } |
|
208 | 215 | |
209 | 216 | $new_list = array(); |
210 | 217 | |
211 | - foreach($files as $key=>$file) |
|
212 | - if(!isset($file['parent'])) |
|
218 | + foreach($files as $key=>$file) { |
|
219 | + if(!isset($file['parent'])) |
|
213 | 220 | $new_list[] = ($files[$key]); |
221 | + } |
|
214 | 222 | |
215 | 223 | return $new_list; |
216 | 224 | } |
@@ -220,25 +228,28 @@ discard block |
||
220 | 228 | $files = $this->get_backup_archives_list(); |
221 | 229 | $total = 0; |
222 | 230 | |
223 | - if(is_array($files)) |
|
224 | - foreach($files as $file) |
|
231 | + if(is_array($files)) { |
|
232 | + foreach($files as $file) |
|
225 | 233 | $total += $file['size']; |
234 | + } |
|
226 | 235 | |
227 | 236 | return $total; |
228 | 237 | } |
229 | 238 | |
230 | 239 | public function is_part($backup_name) |
231 | 240 | { |
232 | - if(stristr($backup_name, "-part")) |
|
233 | - return true; |
|
241 | + if(stristr($backup_name, "-part")) { |
|
242 | + return true; |
|
243 | + } |
|
234 | 244 | |
235 | 245 | return false; |
236 | 246 | } |
237 | 247 | |
238 | 248 | public function is_multipart($backup_name) |
239 | 249 | { |
240 | - if(stristr($backup_name, "-multipart")) |
|
241 | - return true; |
|
250 | + if(stristr($backup_name, "-multipart")) { |
|
251 | + return true; |
|
252 | + } |
|
242 | 253 | |
243 | 254 | return false; |
244 | 255 | } |
@@ -249,8 +260,9 @@ discard block |
||
249 | 260 | if($this->is_multipart($backup_name)) |
250 | 261 | { |
251 | 262 | $backup_parts = $this->get_multipart_files($backup_name); |
252 | - foreach($backup_parts as $part_file) |
|
253 | - $backup_size += $this->get_storage_filesystem()->getSize($part_file); |
|
263 | + foreach($backup_parts as $part_file) { |
|
264 | + $backup_size += $this->get_storage_filesystem()->getSize($part_file); |
|
265 | + } |
|
254 | 266 | } |
255 | 267 | |
256 | 268 | return $backup_size; |
@@ -291,10 +303,11 @@ discard block |
||
291 | 303 | } |
292 | 304 | } |
293 | 305 | |
294 | - if($this->get_storage_filesystem($storage_selection)->delete($backup_name)) |
|
295 | - $return = true; |
|
296 | - else |
|
297 | - $return = false; |
|
306 | + if($this->get_storage_filesystem($storage_selection)->delete($backup_name)) { |
|
307 | + $return = true; |
|
308 | + } else { |
|
309 | + $return = false; |
|
310 | + } |
|
298 | 311 | |
299 | 312 | return $return; |
300 | 313 | } |
@@ -313,8 +326,9 @@ discard block |
||
313 | 326 | $list = array(); |
314 | 327 | |
315 | 328 | |
316 | - if(method_exists($this->get_storage_filesystem($storage_selection), "listContents")) |
|
317 | - $list = $this->get_storage_filesystem($storage_selection)->listContents(); |
|
329 | + if(method_exists($this->get_storage_filesystem($storage_selection), "listContents")) { |
|
330 | + $list = $this->get_storage_filesystem($storage_selection)->listContents(); |
|
331 | + } |
|
318 | 332 | |
319 | 333 | |
320 | 334 | $backup_files = array(); |
@@ -327,10 +341,11 @@ discard block |
||
327 | 341 | $data = array(); |
328 | 342 | |
329 | 343 | $lines = explode(PHP_EOL, $this->get_storage_filesystem($storage_selection)->read($file_info['path'])); |
330 | - foreach($lines as $line) |
|
331 | - if($line) |
|
344 | + foreach($lines as $line) { |
|
345 | + if($line) |
|
332 | 346 | { |
333 | 347 | $data = str_getcsv($line); |
348 | + } |
|
334 | 349 | if(is_array($data)){ |
335 | 350 | $parents[$data[0]] = $file_info['basename']; |
336 | 351 | $file_info['childs'][] = $data; |
@@ -340,8 +355,9 @@ discard block |
||
340 | 355 | |
341 | 356 | } |
342 | 357 | |
343 | - if($file_info['type'] == 'file' and isset($file_info['extension']) and in_array($file_info['extension'], $this->backup_archive_extensions)) |
|
344 | - $backup_files[$file_info['path']] = $file_info; |
|
358 | + if($file_info['type'] == 'file' and isset($file_info['extension']) and in_array($file_info['extension'], $this->backup_archive_extensions)) { |
|
359 | + $backup_files[$file_info['path']] = $file_info; |
|
360 | + } |
|
345 | 361 | } |
346 | 362 | |
347 | 363 | foreach($backup_files as $key=>$file_info) |
@@ -351,8 +367,9 @@ discard block |
||
351 | 367 | //$backup_files[$key]['timestamp'] = $this->get_storage_filesystem($storage_selection)->getTimestamp($file_info['path']); |
352 | 368 | } |
353 | 369 | |
354 | - if(isset($parents[$file_info['basename']])) |
|
355 | - $backup_files[$key]['parent'] = $parents[$file_info['basename']]; |
|
370 | + if(isset($parents[$file_info['basename']])) { |
|
371 | + $backup_files[$key]['parent'] = $parents[$file_info['basename']]; |
|
372 | + } |
|
356 | 373 | } |
357 | 374 | |
358 | 375 | return $backup_files; |
@@ -378,11 +395,11 @@ discard block |
||
378 | 395 | if($counter < $this->folders_to_process_per_session){ |
379 | 396 | $this->build_files_list($file); |
380 | 397 | $counter++; |
381 | - }else{ |
|
398 | + } else{ |
|
382 | 399 | $this->tmp_filesystem_append->write($this->get_temp_dir_handler(), $file."\n"); |
383 | 400 | } |
384 | 401 | } |
385 | - }else{ |
|
402 | + } else{ |
|
386 | 403 | $this->build_files_list(); |
387 | 404 | } |
388 | 405 | |
@@ -454,9 +471,10 @@ discard block |
||
454 | 471 | |
455 | 472 | $contents = $this->get_tmp_filesystem()->listContents(); |
456 | 473 | |
457 | - if(is_array($contents)) |
|
458 | - foreach($contents as $file_info) |
|
474 | + if(is_array($contents)) { |
|
475 | + foreach($contents as $file_info) |
|
459 | 476 | $this->get_tmp_filesystem()->delete($file_info['path']); |
477 | + } |
|
460 | 478 | |
461 | 479 | @rmdir($this->xcloner_settings->get_xcloner_tmp_path()); |
462 | 480 | |
@@ -488,17 +506,21 @@ discard block |
||
488 | 506 | { |
489 | 507 | $this->files_counter = 0; |
490 | 508 | |
491 | - if(!$this->storage_filesystem->has("index.html")) |
|
492 | - $this->storage_filesystem->write("index.html",""); |
|
509 | + if(!$this->storage_filesystem->has("index.html")) { |
|
510 | + $this->storage_filesystem->write("index.html",""); |
|
511 | + } |
|
493 | 512 | |
494 | - if(!$this->tmp_filesystem->has("index.html")) |
|
495 | - $this->tmp_filesystem->write("index.html",""); |
|
513 | + if(!$this->tmp_filesystem->has("index.html")) { |
|
514 | + $this->tmp_filesystem->write("index.html",""); |
|
515 | + } |
|
496 | 516 | |
497 | - if($this->tmp_filesystem->has($this->get_included_files_handler())) |
|
498 | - $this->tmp_filesystem->delete($this->get_included_files_handler()); |
|
517 | + if($this->tmp_filesystem->has($this->get_included_files_handler())) { |
|
518 | + $this->tmp_filesystem->delete($this->get_included_files_handler()); |
|
519 | + } |
|
499 | 520 | |
500 | - if($this->tmp_filesystem->has($this->get_temp_dir_handler())) |
|
501 | - $this->tmp_filesystem->delete($this->get_temp_dir_handler()); |
|
521 | + if($this->tmp_filesystem->has($this->get_temp_dir_handler())) { |
|
522 | + $this->tmp_filesystem->delete($this->get_temp_dir_handler()); |
|
523 | + } |
|
502 | 524 | } |
503 | 525 | |
504 | 526 | public function get_scanned_files_num() |
@@ -568,23 +590,23 @@ discard block |
||
568 | 590 | if(!is_readable($this->xcloner_settings->get_xcloner_start_path().DS.$file['path'])) |
569 | 591 | { |
570 | 592 | $this->logger->info(sprintf(__("Excluding %s from the filesystem list, file not readable"), $file['path']), array("FILESYSTEM SCAN","NOT READABLE")); |
571 | - } |
|
572 | - elseif(!$matching_pattern = $this->is_excluded($file) ){ |
|
593 | + } elseif(!$matching_pattern = $this->is_excluded($file) ){ |
|
573 | 594 | $this->logger->info(sprintf(__("Adding %s to the filesystem list"), $file['path']), array("FILESYSTEM SCAN","INCLUDE")); |
574 | 595 | $file['visibility'] = $this->start_filesystem->getVisibility($file['path']); |
575 | 596 | if($this->store_file($file)) |
576 | 597 | { |
577 | 598 | $this->files_counter++; |
578 | 599 | } |
579 | - if(isset($file['size'])) |
|
580 | - $this->files_size += $file['size']; |
|
600 | + if(isset($file['size'])) { |
|
601 | + $this->files_size += $file['size']; |
|
602 | + } |
|
581 | 603 | |
582 | - }else{ |
|
604 | + } else{ |
|
583 | 605 | $this->logger->info(sprintf(__("Excluding %s from the filesystem list, matching pattern %s"), $file['path'], $matching_pattern), array("FILESYSTEM SCAN","EXCLUDE")); |
584 | 606 | } |
585 | 607 | } |
586 | 608 | |
587 | - }catch(Exception $e){ |
|
609 | + } catch(Exception $e){ |
|
588 | 610 | |
589 | 611 | $this->logger->error($e->getMessage()); |
590 | 612 | |
@@ -611,7 +633,7 @@ discard block |
||
611 | 633 | |
612 | 634 | $this->tmp_filesystem->delete($tmp_file); |
613 | 635 | |
614 | - }catch(Exception $e){ |
|
636 | + } catch(Exception $e){ |
|
615 | 637 | |
616 | 638 | $this->logger->error($e->getMessage()); |
617 | 639 | |
@@ -632,12 +654,14 @@ discard block |
||
632 | 654 | |
633 | 655 | $files = $this->storage_filesystem->listContents(); |
634 | 656 | |
635 | - if(is_array($files)) |
|
636 | - foreach($files as $file) |
|
657 | + if(is_array($files)) { |
|
658 | + foreach($files as $file) |
|
637 | 659 | { |
638 | 660 | if(isset($file['extension']) and in_array($file['extension'], $this->backup_archive_extensions)) |
639 | 661 | { |
640 | - $_storage_size += $file['size']; //bytes |
|
662 | + $_storage_size += $file['size']; |
|
663 | + } |
|
664 | + //bytes |
|
641 | 665 | $_backup_files_list[] = $file; |
642 | 666 | } |
643 | 667 | } |
@@ -651,9 +675,11 @@ discard block |
||
651 | 675 | { |
652 | 676 | //processing rule folder capacity |
653 | 677 | if($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit') && |
654 | - $_storage_size >= ($set_storage_limit = 1024*1024*$this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit'))) //bytes |
|
678 | + $_storage_size >= ($set_storage_limit = 1024*1024*$this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit'))) { |
|
679 | + //bytes |
|
655 | 680 | { |
656 | 681 | $this->storage_filesystem->delete($file['path']); |
682 | + } |
|
657 | 683 | $_storage_size -= $file['size']; |
658 | 684 | $this->logger->info("Deleting backup ".$file['path']." matching rule", array("STORAGE SIZE LIMIT", $_storage_size." >= ".$set_storage_limit)); |
659 | 685 | } |
@@ -694,34 +720,37 @@ discard block |
||
694 | 720 | |
695 | 721 | public function process_backup_name($name = "", $max_length=100) |
696 | 722 | { |
697 | - if(!$name) |
|
698 | - $name = $this->xcloner_settings->get_default_backup_name(); |
|
723 | + if(!$name) { |
|
724 | + $name = $this->xcloner_settings->get_default_backup_name(); |
|
725 | + } |
|
699 | 726 | |
700 | 727 | foreach($this->backup_name_tags as $tag) |
701 | 728 | { |
702 | - if($tag == '[time]') |
|
703 | - $name = str_replace($tag, date("Y-m-d_H-i"),$name); |
|
704 | - elseif($tag == '[hostname]') |
|
705 | - $name = str_replace($tag, gethostname() ,$name); |
|
706 | - elseif($tag == '[domain]') |
|
729 | + if($tag == '[time]') { |
|
730 | + $name = str_replace($tag, date("Y-m-d_H-i"),$name); |
|
731 | + } elseif($tag == '[hostname]') { |
|
732 | + $name = str_replace($tag, gethostname() ,$name); |
|
733 | + } elseif($tag == '[domain]') |
|
707 | 734 | { |
708 | 735 | $domain = parse_url(admin_url(), PHP_URL_HOST); |
709 | 736 | $name = str_replace($tag, $domain ,$name); |
710 | 737 | } |
711 | 738 | } |
712 | 739 | |
713 | - if($max_length) |
|
714 | - $name = substr($name, 0, $max_length); |
|
740 | + if($max_length) { |
|
741 | + $name = substr($name, 0, $max_length); |
|
742 | + } |
|
715 | 743 | |
716 | 744 | return $name; |
717 | 745 | } |
718 | 746 | |
719 | 747 | public function sort_by( &$array, $field, $direction = 'asc') |
720 | 748 | { |
721 | - if(strtolower($direction) == "desc" || $direction == SORT_DESC) |
|
722 | - $direction = SORT_DESC; |
|
723 | - else |
|
724 | - $direction = SORT_ASC; |
|
749 | + if(strtolower($direction) == "desc" || $direction == SORT_DESC) { |
|
750 | + $direction = SORT_DESC; |
|
751 | + } else { |
|
752 | + $direction = SORT_ASC; |
|
753 | + } |
|
725 | 754 | |
726 | 755 | $array = $this->array_orderby($array, $field, $direction); |
727 | 756 | |
@@ -738,10 +767,11 @@ discard block |
||
738 | 767 | $tmp = array(); |
739 | 768 | foreach ($data as $key => $row) |
740 | 769 | { |
741 | - if(is_array($row)) |
|
742 | - $tmp[$key] = $row[$field]; |
|
743 | - else |
|
744 | - $tmp[$key] = $row->$field; |
|
770 | + if(is_array($row)) { |
|
771 | + $tmp[$key] = $row[$field]; |
|
772 | + } else { |
|
773 | + $tmp[$key] = $row->$field; |
|
774 | + } |
|
745 | 775 | } |
746 | 776 | $args[$n] = $tmp; |
747 | 777 | } |
@@ -779,8 +809,9 @@ discard block |
||
779 | 809 | |
780 | 810 | if($xcloner_exclude_files_larger_than_mb = $this->xcloner_settings->get_xcloner_option('xcloner_exclude_files_larger_than_mb')) |
781 | 811 | { |
782 | - if(isset($file['size']) && $file['size'] > $this->calc_to_bytes($xcloner_exclude_files_larger_than_mb)) |
|
783 | - return "> ".$xcloner_exclude_files_larger_than_mb."MB"; |
|
812 | + if(isset($file['size']) && $file['size'] > $this->calc_to_bytes($xcloner_exclude_files_larger_than_mb)) { |
|
813 | + return "> ".$xcloner_exclude_files_larger_than_mb."MB"; |
|
814 | + } |
|
784 | 815 | } |
785 | 816 | |
786 | 817 | if(!sizeof($this->excluded_files)) |
@@ -788,21 +819,23 @@ discard block |
||
788 | 819 | $this->set_excluded_files(); |
789 | 820 | } |
790 | 821 | |
791 | - if(is_array($this->excluded_files)) |
|
792 | - foreach($this->excluded_files as $excluded_file_pattern) |
|
822 | + if(is_array($this->excluded_files)) { |
|
823 | + foreach($this->excluded_files as $excluded_file_pattern) |
|
793 | 824 | { |
794 | 825 | if($excluded_file_pattern == "/") |
795 | 826 | $needle = "$"; |
796 | - else |
|
797 | - $needle = "$".$excluded_file_pattern; |
|
827 | + } else { |
|
828 | + $needle = "$".$excluded_file_pattern; |
|
829 | + } |
|
798 | 830 | |
799 | 831 | if(strstr("$".$file['path'], $needle)){ |
800 | 832 | return $excluded_file_pattern; |
801 | 833 | } |
802 | 834 | } |
803 | 835 | |
804 | - if( $regex = $this->is_excluded_regex($file)) |
|
805 | - return $regex; |
|
836 | + if( $regex = $this->is_excluded_regex($file)) { |
|
837 | + return $regex; |
|
838 | + } |
|
806 | 839 | |
807 | 840 | if($file['type'] == "file") |
808 | 841 | { |
@@ -870,13 +903,15 @@ discard block |
||
870 | 903 | foreach($regex_patterns as $excluded_file_pattern) |
871 | 904 | { |
872 | 905 | |
873 | - if( substr($excluded_file_pattern, strlen($excluded_file_pattern)-1, strlen($excluded_file_pattern)) == "\r") |
|
874 | - $excluded_file_pattern = substr($excluded_file_pattern, 0, strlen($excluded_file_pattern)-1); |
|
906 | + if( substr($excluded_file_pattern, strlen($excluded_file_pattern)-1, strlen($excluded_file_pattern)) == "\r") { |
|
907 | + $excluded_file_pattern = substr($excluded_file_pattern, 0, strlen($excluded_file_pattern)-1); |
|
908 | + } |
|
875 | 909 | |
876 | - if($file['path'] == "/") |
|
877 | - $needle = "/"; |
|
878 | - else |
|
879 | - $needle = "/".$file['path']; |
|
910 | + if($file['path'] == "/") { |
|
911 | + $needle = "/"; |
|
912 | + } else { |
|
913 | + $needle = "/".$file['path']; |
|
914 | + } |
|
880 | 915 | //echo $needle."---".$excluded_file_pattern."---\n"; |
881 | 916 | |
882 | 917 | if(@preg_match("/(^|^\/)".$excluded_file_pattern."/i", $needle)){ |
@@ -892,10 +927,12 @@ discard block |
||
892 | 927 | { |
893 | 928 | $this->logger->debug(sprintf("Storing %s in the backup list", $file['path'])); |
894 | 929 | |
895 | - if(!isset($file['size'])) |
|
896 | - $file['size'] = 0; |
|
897 | - if(!isset($file['visibility'])) |
|
898 | - $file['visibility'] = "private"; |
|
930 | + if(!isset($file['size'])) { |
|
931 | + $file['size'] = 0; |
|
932 | + } |
|
933 | + if(!isset($file['visibility'])) { |
|
934 | + $file['visibility'] = "private"; |
|
935 | + } |
|
899 | 936 | |
900 | 937 | $csv_filename = str_replace('"','""', $file['path']); |
901 | 938 | |
@@ -906,7 +943,7 @@ discard block |
||
906 | 943 | if($file['type'] == "dir"){ |
907 | 944 | try{ |
908 | 945 | $this->tmp_filesystem_append->write($this->get_temp_dir_handler(), $file['path']."\n"); |
909 | - }catch(Exception $e){ |
|
946 | + } catch(Exception $e){ |
|
910 | 947 | $this->logger->error($e->getMessage()); |
911 | 948 | } |
912 | 949 | } |
@@ -930,7 +967,7 @@ discard block |
||
930 | 967 | |
931 | 968 | $this->tmp_filesystem_append->write($this->get_included_files_handler(), $line); |
932 | 969 | |
933 | - }catch(Exception $e){ |
|
970 | + } catch(Exception $e){ |
|
934 | 971 | |
935 | 972 | $this->logger->error($e->getMessage()); |
936 | 973 | } |
@@ -945,35 +982,39 @@ discard block |
||
945 | 982 | |
946 | 983 | public function get_filesystem($system = "") |
947 | 984 | { |
948 | - if($system == "storage_filesystem_append") |
|
949 | - return $this->storage_filesystem_append; |
|
950 | - elseif($system == "tmp_filesystem_append") |
|
951 | - return $this->tmp_filesystem_append; |
|
952 | - elseif($system == "tmp_filesystem") |
|
953 | - return $this->tmp_filesystem; |
|
954 | - elseif($system == "storage_filesystem") |
|
955 | - return $this->storage_filesystem; |
|
956 | - else |
|
957 | - return $this->start_filesystem; |
|
985 | + if($system == "storage_filesystem_append") { |
|
986 | + return $this->storage_filesystem_append; |
|
987 | + } elseif($system == "tmp_filesystem_append") { |
|
988 | + return $this->tmp_filesystem_append; |
|
989 | + } elseif($system == "tmp_filesystem") { |
|
990 | + return $this->tmp_filesystem; |
|
991 | + } elseif($system == "storage_filesystem") { |
|
992 | + return $this->storage_filesystem; |
|
993 | + } else { |
|
994 | + return $this->start_filesystem; |
|
995 | + } |
|
958 | 996 | } |
959 | 997 | |
960 | 998 | public function get_adapter($system) |
961 | 999 | { |
962 | - if($system == "tmp_filesystem") |
|
963 | - return $this->tmp_adapter; |
|
964 | - elseif($system == "storage_filesystem") |
|
965 | - return $this->storage_adapter; |
|
966 | - else |
|
967 | - return $this->start_adapter; |
|
1000 | + if($system == "tmp_filesystem") { |
|
1001 | + return $this->tmp_adapter; |
|
1002 | + } elseif($system == "storage_filesystem") { |
|
1003 | + return $this->storage_adapter; |
|
1004 | + } else { |
|
1005 | + return $this->start_adapter; |
|
1006 | + } |
|
968 | 1007 | } |
969 | 1008 | |
970 | 1009 | private function scan_finished() |
971 | 1010 | { |
972 | - if($this->tmp_filesystem_append->has($this->get_temp_dir_handler()) && $this->tmp_filesystem_append->getSize($this->get_temp_dir_handler())) |
|
973 | - return false; |
|
1011 | + if($this->tmp_filesystem_append->has($this->get_temp_dir_handler()) && $this->tmp_filesystem_append->getSize($this->get_temp_dir_handler())) { |
|
1012 | + return false; |
|
1013 | + } |
|
974 | 1014 | |
975 | - if($this->tmp_filesystem->has($this->get_temp_dir_handler())) |
|
976 | - $this->tmp_filesystem->delete($this->get_temp_dir_handler()); |
|
1015 | + if($this->tmp_filesystem->has($this->get_temp_dir_handler())) { |
|
1016 | + $this->tmp_filesystem->delete($this->get_temp_dir_handler()); |
|
1017 | + } |
|
977 | 1018 | |
978 | 1019 | $this->logger->debug(sprintf(("File scan finished"))); |
979 | 1020 |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | use Sabre\DAV\Client as SabreClient; |
22 | 22 | use League\Flysystem\WebDAV\WebDAVAdapter; |
23 | 23 | |
24 | -class Xcloner_Remote_Storage{ |
|
24 | +class Xcloner_Remote_Storage { |
|
25 | 25 | |
26 | - private $gdrive_app_name = "XCloner Backup and Restore"; |
|
26 | + private $gdrive_app_name = "XCloner Backup and Restore"; |
|
27 | 27 | |
28 | 28 | private $storage_fields = array( |
29 | 29 | "option_prefix" => "xcloner_", |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | { |
134 | 134 | $this->xcloner_sanitization = $xcloner_container->get_xcloner_sanitization(); |
135 | 135 | $this->xcloner_file_system = $xcloner_container->get_xcloner_filesystem(); |
136 | - $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_remote_storage"); |
|
137 | - $this->xcloner = $xcloner_container; |
|
136 | + $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_remote_storage"); |
|
137 | + $this->xcloner = $xcloner_container; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | private function get_xcloner_container() |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | public function get_available_storages() |
146 | 146 | { |
147 | 147 | $return = array(); |
148 | - foreach($this->storage_fields as $storage=>$data) |
|
148 | + foreach ($this->storage_fields as $storage=>$data) |
|
149 | 149 | { |
150 | 150 | $check_field = $this->storage_fields["option_prefix"].$storage."_enable"; |
151 | - if(get_option($check_field)) |
|
151 | + if (get_option($check_field)) |
|
152 | 152 | $return[$storage] = $data['text']; |
153 | 153 | } |
154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | public function save($action = "ftp") |
159 | 159 | { |
160 | - if(!$action) |
|
160 | + if (!$action) |
|
161 | 161 | { |
162 | 162 | return false; |
163 | 163 | } |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | $storage = $this->xcloner_sanitization->sanitize_input_as_string($action); |
166 | 166 | $this->logger->debug(sprintf("Saving the remote storage %s options", strtoupper($action))); |
167 | 167 | |
168 | - if(is_array($this->storage_fields[$storage])) |
|
168 | + if (is_array($this->storage_fields[$storage])) |
|
169 | 169 | { |
170 | - foreach($this->storage_fields[$storage] as $field=>$validation) |
|
170 | + foreach ($this->storage_fields[$storage] as $field=>$validation) |
|
171 | 171 | { |
172 | 172 | $check_field = $this->storage_fields["option_prefix"].$field; |
173 | 173 | $sanitize_method = "sanitize_input_as_".$validation; |
174 | 174 | |
175 | - if(!isset($_POST[$check_field])) |
|
175 | + if (!isset($_POST[$check_field])) |
|
176 | 176 | $_POST[$check_field] = 0; |
177 | 177 | |
178 | - if(!method_exists($this->xcloner_sanitization, $sanitize_method)) |
|
178 | + if (!method_exists($this->xcloner_sanitization, $sanitize_method)) |
|
179 | 179 | $sanitize_method = "sanitize_input_as_string"; |
180 | 180 | |
181 | 181 | $sanitized_value = $this->xcloner_sanitization->$sanitize_method(stripslashes($_POST[$check_field])); |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | |
190 | 190 | public function check($action = "ftp") |
191 | 191 | { |
192 | - try{ |
|
192 | + try { |
|
193 | 193 | $this->verify_filesystem($action); |
194 | 194 | $this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success", ucfirst($action)); |
195 | 195 | $this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action))); |
196 | - }catch(Exception $e){ |
|
196 | + }catch (Exception $e) { |
|
197 | 197 | $this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error", ucfirst($action)); |
198 | 198 | } |
199 | 199 | } |
@@ -204,35 +204,35 @@ discard block |
||
204 | 204 | |
205 | 205 | $this->logger->info(sprintf("Checking validity of the remote storage %s filesystem", strtoupper($storage_type))); |
206 | 206 | |
207 | - if(!method_exists($this, $method)) |
|
207 | + if (!method_exists($this, $method)) |
|
208 | 208 | return false; |
209 | 209 | |
210 | 210 | list($adapter, $filesystem) = $this->$method(); |
211 | 211 | |
212 | 212 | $test_file = substr(".xcloner_".md5(time()), 0, 15); |
213 | 213 | |
214 | - if($storage_type == "gdrive") |
|
214 | + if ($storage_type == "gdrive") |
|
215 | 215 | { |
216 | - if(!is_array($filesystem->listContents())) |
|
217 | - throw new Exception(__("Could not read data",'xcloner-backup-and-restore')); |
|
216 | + if (!is_array($filesystem->listContents())) |
|
217 | + throw new Exception(__("Could not read data", 'xcloner-backup-and-restore')); |
|
218 | 218 | $this->logger->debug(sprintf("I can list data from remote storage %s", strtoupper($storage_type))); |
219 | 219 | |
220 | 220 | return true; |
221 | 221 | } |
222 | 222 | |
223 | 223 | //testing write access |
224 | - if(!$filesystem->write($test_file, "data")) |
|
225 | - throw new Exception(__("Could not write data",'xcloner-backup-and-restore')); |
|
224 | + if (!$filesystem->write($test_file, "data")) |
|
225 | + throw new Exception(__("Could not write data", 'xcloner-backup-and-restore')); |
|
226 | 226 | $this->logger->debug(sprintf("I can write data to remote storage %s", strtoupper($storage_type))); |
227 | 227 | |
228 | 228 | //testing read access |
229 | - if(!$filesystem->read($test_file)) |
|
230 | - throw new Exception(__("Could not read data",'xcloner-backup-and-restore')); |
|
229 | + if (!$filesystem->read($test_file)) |
|
230 | + throw new Exception(__("Could not read data", 'xcloner-backup-and-restore')); |
|
231 | 231 | $this->logger->debug(sprintf("I can read data to remote storage %s", strtoupper($storage_type))); |
232 | 232 | |
233 | 233 | //delete test file |
234 | - if(!$filesystem->delete($test_file)) |
|
235 | - throw new Exception(__("Could not delete data",'xcloner-backup-and-restore')); |
|
234 | + if (!$filesystem->delete($test_file)) |
|
235 | + throw new Exception(__("Could not delete data", 'xcloner-backup-and-restore')); |
|
236 | 236 | $this->logger->debug(sprintf("I can delete data to remote storage %s", strtoupper($storage_type))); |
237 | 237 | |
238 | 238 | return true; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | public function upload_backup_to_storage($file, $storage) |
242 | 242 | { |
243 | - if(!$this->xcloner_file_system->get_storage_filesystem()->has($file)) |
|
243 | + if (!$this->xcloner_file_system->get_storage_filesystem()->has($file)) |
|
244 | 244 | { |
245 | 245 | $this->logger->info(sprintf("File not found %s in local storage", $file)); |
246 | 246 | return false; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | $method = "get_".$storage."_filesystem"; |
250 | 250 | |
251 | - if(!method_exists($this, $method)) |
|
251 | + if (!method_exists($this, $method)) |
|
252 | 252 | return false; |
253 | 253 | |
254 | 254 | list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method(); |
@@ -266,22 +266,22 @@ discard block |
||
266 | 266 | |
267 | 267 | $backup_file_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($file); |
268 | 268 | |
269 | - if(!$remote_storage_filesystem->writeStream($file, $backup_file_stream)) |
|
269 | + if (!$remote_storage_filesystem->writeStream($file, $backup_file_stream)) |
|
270 | 270 | { |
271 | 271 | $this->logger->info(sprintf("Could not transfer file %s", $file)); |
272 | 272 | return false; |
273 | 273 | } |
274 | 274 | |
275 | - if($this->xcloner_file_system->is_multipart($file)) |
|
275 | + if ($this->xcloner_file_system->is_multipart($file)) |
|
276 | 276 | { |
277 | 277 | $parts = $this->xcloner_file_system->get_multipart_files($file); |
278 | - if(is_array($parts)) |
|
279 | - foreach($parts as $part_file) |
|
278 | + if (is_array($parts)) |
|
279 | + foreach ($parts as $part_file) |
|
280 | 280 | { |
281 | 281 | $this->logger->info(sprintf("Transferring backup %s to remote storage %s", $part_file, strtoupper($storage)), array("")); |
282 | 282 | |
283 | 283 | $backup_file_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($part_file); |
284 | - if(!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream)) |
|
284 | + if (!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream)) |
|
285 | 285 | return false; |
286 | 286 | } |
287 | 287 | } |
@@ -298,18 +298,18 @@ discard block |
||
298 | 298 | |
299 | 299 | $target_filename = $file; |
300 | 300 | |
301 | - if(!method_exists($this, $method)) |
|
301 | + if (!method_exists($this, $method)) |
|
302 | 302 | return false; |
303 | 303 | |
304 | 304 | list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method(); |
305 | 305 | |
306 | - if(!$remote_storage_filesystem->has($file)) |
|
306 | + if (!$remote_storage_filesystem->has($file)) |
|
307 | 307 | { |
308 | 308 | $this->logger->info(sprintf("File not found %s in remote storage %s", $file, strtoupper($storage))); |
309 | 309 | return false; |
310 | 310 | } |
311 | 311 | |
312 | - if($storage == "gdrive") |
|
312 | + if ($storage == "gdrive") |
|
313 | 313 | { |
314 | 314 | $metadata = $remote_storage_filesystem->getMetadata($file); |
315 | 315 | $target_filename = $metadata['filename'].".".$metadata['extension']; |
@@ -319,22 +319,22 @@ discard block |
||
319 | 319 | |
320 | 320 | $backup_file_stream = $remote_storage_filesystem->readStream($file); |
321 | 321 | |
322 | - if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($target_filename, $backup_file_stream)) |
|
322 | + if (!$this->xcloner_file_system->get_storage_filesystem()->writeStream($target_filename, $backup_file_stream)) |
|
323 | 323 | { |
324 | 324 | $this->logger->info(sprintf("Could not transfer file %s", $file)); |
325 | 325 | return false; |
326 | 326 | } |
327 | 327 | |
328 | - if($this->xcloner_file_system->is_multipart($target_filename)) |
|
328 | + if ($this->xcloner_file_system->is_multipart($target_filename)) |
|
329 | 329 | { |
330 | 330 | $parts = $this->xcloner_file_system->get_multipart_files($file, $storage); |
331 | - if(is_array($parts)) |
|
332 | - foreach($parts as $part_file) |
|
331 | + if (is_array($parts)) |
|
332 | + foreach ($parts as $part_file) |
|
333 | 333 | { |
334 | 334 | $this->logger->info(sprintf("Transferring backup %s to local storage from %s storage", $part_file, strtoupper($storage)), array("")); |
335 | 335 | |
336 | 336 | $backup_file_stream = $remote_storage_filesystem->readStream($part_file); |
337 | - if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream)) |
|
337 | + if (!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream)) |
|
338 | 338 | return false; |
339 | 339 | } |
340 | 340 | } |
@@ -348,19 +348,19 @@ discard block |
||
348 | 348 | public function clean_remote_storage($storage, $remote_storage_filesystem) |
349 | 349 | { |
350 | 350 | $check_field = $this->storage_fields["option_prefix"].$storage."_cleanup_days"; |
351 | - if($expire_days = get_option($check_field)) |
|
351 | + if ($expire_days = get_option($check_field)) |
|
352 | 352 | { |
353 | 353 | $this->logger->info(sprintf("Doing %s remote storage cleanup for %s days limit", strtoupper($storage), $expire_days)); |
354 | 354 | $files = $remote_storage_filesystem->listContents(); |
355 | 355 | |
356 | 356 | $current_timestamp = strtotime("-".$expire_days." days"); |
357 | 357 | |
358 | - if(is_array($files)) |
|
359 | - foreach($files as $file) |
|
358 | + if (is_array($files)) |
|
359 | + foreach ($files as $file) |
|
360 | 360 | { |
361 | 361 | $file['timestamp'] = $remote_storage_filesystem->getTimestamp($file['path']); |
362 | 362 | |
363 | - if($current_timestamp >= $file['timestamp']) |
|
363 | + if ($current_timestamp >= $file['timestamp']) |
|
364 | 364 | { |
365 | 365 | $remote_storage_filesystem->delete($file['path']); |
366 | 366 | $this->logger->info("Deleting remote file ".$file['path']." matching rule", array("RETENTION LIMIT TIMESTAMP", $file['timestamp']." =< ".$expire_days)); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | { |
499 | 499 | |
500 | 500 | //if((function_exists("is_plugin_active") && !is_plugin_active("xcloner-google-drive/xcloner-google-drive.php")) || !file_exists(__DIR__ . "/../../xcloner-google-drive/vendor/autoload.php")) |
501 | - if(!class_exists('Google_Client')) |
|
501 | + if (!class_exists('Google_Client')) |
|
502 | 502 | { |
503 | 503 | return false; |
504 | 504 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | { |
525 | 525 | $client = $this->gdrive_construct(); |
526 | 526 | |
527 | - if(!$client) |
|
527 | + if (!$client) |
|
528 | 528 | return false; |
529 | 529 | |
530 | 530 | return $authUrl = $client->createAuthUrl(); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | { |
535 | 535 | $client = $this->gdrive_construct(); |
536 | 536 | |
537 | - if(!$client) |
|
537 | + if (!$client) |
|
538 | 538 | { |
539 | 539 | $error_msg = "Could not initialize the Google Drive Class, please check that the xcloner-google-drive plugin is enabled..."; |
540 | 540 | $this->logger->error($error_msg); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | update_option("xcloner_gdrive_access_token", $token['access_token']); |
548 | 548 | update_option("xcloner_gdrive_refresh_token", $token['refresh_token']); |
549 | 549 | |
550 | - $redirect_url = ('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=xcloner_remote_storage_page#gdrive"); |
|
550 | + $redirect_url = ('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?page=xcloner_remote_storage_page#gdrive"); |
|
551 | 551 | |
552 | 552 | ?> |
553 | 553 | <script> |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | $client = $this->gdrive_construct(); |
574 | 574 | |
575 | - if(!$client) |
|
575 | + if (!$client) |
|
576 | 576 | { |
577 | 577 | $error_msg = "Could not initialize the Google Drive Class, please check that the xcloner-google-drive plugin is enabled..."; |
578 | 578 | $this->logger->error($error_msg); |
@@ -584,18 +584,18 @@ discard block |
||
584 | 584 | $service = new \Google_Service_Drive($client); |
585 | 585 | |
586 | 586 | $parent = 'root'; |
587 | - $dir = basename( get_option("xcloner_gdrive_target_folder")); |
|
587 | + $dir = basename(get_option("xcloner_gdrive_target_folder")); |
|
588 | 588 | |
589 | 589 | $folderID = get_option("xcloner_gdrive_target_folder"); |
590 | 590 | |
591 | 591 | $tmp = parse_url($folderID); |
592 | 592 | |
593 | - if(isset($tmp['query'])) |
|
593 | + if (isset($tmp['query'])) |
|
594 | 594 | { |
595 | 595 | $folderID = str_replace("id=", "", $tmp['query']); |
596 | 596 | } |
597 | 597 | |
598 | - if(stristr($folderID, "/")) |
|
598 | + if (stristr($folderID, "/")) |
|
599 | 599 | { |
600 | 600 | $query = sprintf('mimeType = \'application/vnd.google-apps.folder\' and \'%s\' in parents and name contains \'%s\'', $parent, $dir); |
601 | 601 | $response = $service->files->listFiles([ |
@@ -603,12 +603,12 @@ discard block |
||
603 | 603 | 'q' => $query |
604 | 604 | ]); |
605 | 605 | |
606 | - if(sizeof($response)) |
|
606 | + if (sizeof($response)) |
|
607 | 607 | { |
608 | 608 | foreach ($response as $obj) { |
609 | - $folderID = $obj->getId(); |
|
609 | + $folderID = $obj->getId(); |
|
610 | 610 | } |
611 | - }else{ |
|
611 | + } else { |
|
612 | 612 | $this->xcloner->trigger_message(sprintf(__("Could not find folder ID by name %s", 'xcloner-backup-and-restore'), $folderID), "error"); |
613 | 613 | } |
614 | 614 | } |
@@ -148,8 +148,9 @@ discard block |
||
148 | 148 | foreach($this->storage_fields as $storage=>$data) |
149 | 149 | { |
150 | 150 | $check_field = $this->storage_fields["option_prefix"].$storage."_enable"; |
151 | - if(get_option($check_field)) |
|
152 | - $return[$storage] = $data['text']; |
|
151 | + if(get_option($check_field)) { |
|
152 | + $return[$storage] = $data['text']; |
|
153 | + } |
|
153 | 154 | } |
154 | 155 | |
155 | 156 | return $return; |
@@ -172,11 +173,13 @@ discard block |
||
172 | 173 | $check_field = $this->storage_fields["option_prefix"].$field; |
173 | 174 | $sanitize_method = "sanitize_input_as_".$validation; |
174 | 175 | |
175 | - if(!isset($_POST[$check_field])) |
|
176 | - $_POST[$check_field] = 0; |
|
176 | + if(!isset($_POST[$check_field])) { |
|
177 | + $_POST[$check_field] = 0; |
|
178 | + } |
|
177 | 179 | |
178 | - if(!method_exists($this->xcloner_sanitization, $sanitize_method)) |
|
179 | - $sanitize_method = "sanitize_input_as_string"; |
|
180 | + if(!method_exists($this->xcloner_sanitization, $sanitize_method)) { |
|
181 | + $sanitize_method = "sanitize_input_as_string"; |
|
182 | + } |
|
180 | 183 | |
181 | 184 | $sanitized_value = $this->xcloner_sanitization->$sanitize_method(stripslashes($_POST[$check_field])); |
182 | 185 | update_option($check_field, $sanitized_value); |
@@ -193,7 +196,7 @@ discard block |
||
193 | 196 | $this->verify_filesystem($action); |
194 | 197 | $this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success", ucfirst($action)); |
195 | 198 | $this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action))); |
196 | - }catch(Exception $e){ |
|
199 | + } catch(Exception $e){ |
|
197 | 200 | $this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error", ucfirst($action)); |
198 | 201 | } |
199 | 202 | } |
@@ -204,8 +207,9 @@ discard block |
||
204 | 207 | |
205 | 208 | $this->logger->info(sprintf("Checking validity of the remote storage %s filesystem", strtoupper($storage_type))); |
206 | 209 | |
207 | - if(!method_exists($this, $method)) |
|
208 | - return false; |
|
210 | + if(!method_exists($this, $method)) { |
|
211 | + return false; |
|
212 | + } |
|
209 | 213 | |
210 | 214 | list($adapter, $filesystem) = $this->$method(); |
211 | 215 | |
@@ -213,26 +217,30 @@ discard block |
||
213 | 217 | |
214 | 218 | if($storage_type == "gdrive") |
215 | 219 | { |
216 | - if(!is_array($filesystem->listContents())) |
|
217 | - throw new Exception(__("Could not read data",'xcloner-backup-and-restore')); |
|
220 | + if(!is_array($filesystem->listContents())) { |
|
221 | + throw new Exception(__("Could not read data",'xcloner-backup-and-restore')); |
|
222 | + } |
|
218 | 223 | $this->logger->debug(sprintf("I can list data from remote storage %s", strtoupper($storage_type))); |
219 | 224 | |
220 | 225 | return true; |
221 | 226 | } |
222 | 227 | |
223 | 228 | //testing write access |
224 | - if(!$filesystem->write($test_file, "data")) |
|
225 | - throw new Exception(__("Could not write data",'xcloner-backup-and-restore')); |
|
229 | + if(!$filesystem->write($test_file, "data")) { |
|
230 | + throw new Exception(__("Could not write data",'xcloner-backup-and-restore')); |
|
231 | + } |
|
226 | 232 | $this->logger->debug(sprintf("I can write data to remote storage %s", strtoupper($storage_type))); |
227 | 233 | |
228 | 234 | //testing read access |
229 | - if(!$filesystem->read($test_file)) |
|
230 | - throw new Exception(__("Could not read data",'xcloner-backup-and-restore')); |
|
235 | + if(!$filesystem->read($test_file)) { |
|
236 | + throw new Exception(__("Could not read data",'xcloner-backup-and-restore')); |
|
237 | + } |
|
231 | 238 | $this->logger->debug(sprintf("I can read data to remote storage %s", strtoupper($storage_type))); |
232 | 239 | |
233 | 240 | //delete test file |
234 | - if(!$filesystem->delete($test_file)) |
|
235 | - throw new Exception(__("Could not delete data",'xcloner-backup-and-restore')); |
|
241 | + if(!$filesystem->delete($test_file)) { |
|
242 | + throw new Exception(__("Could not delete data",'xcloner-backup-and-restore')); |
|
243 | + } |
|
236 | 244 | $this->logger->debug(sprintf("I can delete data to remote storage %s", strtoupper($storage_type))); |
237 | 245 | |
238 | 246 | return true; |
@@ -248,8 +256,9 @@ discard block |
||
248 | 256 | |
249 | 257 | $method = "get_".$storage."_filesystem"; |
250 | 258 | |
251 | - if(!method_exists($this, $method)) |
|
252 | - return false; |
|
259 | + if(!method_exists($this, $method)) { |
|
260 | + return false; |
|
261 | + } |
|
253 | 262 | |
254 | 263 | list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method(); |
255 | 264 | |
@@ -275,14 +284,16 @@ discard block |
||
275 | 284 | if($this->xcloner_file_system->is_multipart($file)) |
276 | 285 | { |
277 | 286 | $parts = $this->xcloner_file_system->get_multipart_files($file); |
278 | - if(is_array($parts)) |
|
279 | - foreach($parts as $part_file) |
|
287 | + if(is_array($parts)) { |
|
288 | + foreach($parts as $part_file) |
|
280 | 289 | { |
281 | 290 | $this->logger->info(sprintf("Transferring backup %s to remote storage %s", $part_file, strtoupper($storage)), array("")); |
291 | + } |
|
282 | 292 | |
283 | 293 | $backup_file_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($part_file); |
284 | - if(!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream)) |
|
285 | - return false; |
|
294 | + if(!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream)) { |
|
295 | + return false; |
|
296 | + } |
|
286 | 297 | } |
287 | 298 | } |
288 | 299 | |
@@ -298,8 +309,9 @@ discard block |
||
298 | 309 | |
299 | 310 | $target_filename = $file; |
300 | 311 | |
301 | - if(!method_exists($this, $method)) |
|
302 | - return false; |
|
312 | + if(!method_exists($this, $method)) { |
|
313 | + return false; |
|
314 | + } |
|
303 | 315 | |
304 | 316 | list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method(); |
305 | 317 | |
@@ -328,14 +340,16 @@ discard block |
||
328 | 340 | if($this->xcloner_file_system->is_multipart($target_filename)) |
329 | 341 | { |
330 | 342 | $parts = $this->xcloner_file_system->get_multipart_files($file, $storage); |
331 | - if(is_array($parts)) |
|
332 | - foreach($parts as $part_file) |
|
343 | + if(is_array($parts)) { |
|
344 | + foreach($parts as $part_file) |
|
333 | 345 | { |
334 | 346 | $this->logger->info(sprintf("Transferring backup %s to local storage from %s storage", $part_file, strtoupper($storage)), array("")); |
347 | + } |
|
335 | 348 | |
336 | 349 | $backup_file_stream = $remote_storage_filesystem->readStream($part_file); |
337 | - if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream)) |
|
338 | - return false; |
|
350 | + if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream)) { |
|
351 | + return false; |
|
352 | + } |
|
339 | 353 | } |
340 | 354 | } |
341 | 355 | |
@@ -355,10 +369,11 @@ discard block |
||
355 | 369 | |
356 | 370 | $current_timestamp = strtotime("-".$expire_days." days"); |
357 | 371 | |
358 | - if(is_array($files)) |
|
359 | - foreach($files as $file) |
|
372 | + if(is_array($files)) { |
|
373 | + foreach($files as $file) |
|
360 | 374 | { |
361 | 375 | $file['timestamp'] = $remote_storage_filesystem->getTimestamp($file['path']); |
376 | + } |
|
362 | 377 | |
363 | 378 | if($current_timestamp >= $file['timestamp']) |
364 | 379 | { |
@@ -524,8 +539,9 @@ discard block |
||
524 | 539 | { |
525 | 540 | $client = $this->gdrive_construct(); |
526 | 541 | |
527 | - if(!$client) |
|
528 | - return false; |
|
542 | + if(!$client) { |
|
543 | + return false; |
|
544 | + } |
|
529 | 545 | |
530 | 546 | return $authUrl = $client->createAuthUrl(); |
531 | 547 | } |
@@ -608,7 +624,7 @@ discard block |
||
608 | 624 | foreach ($response as $obj) { |
609 | 625 | $folderID = $obj->getId(); |
610 | 626 | } |
611 | - }else{ |
|
627 | + } else{ |
|
612 | 628 | $this->xcloner->trigger_message(sprintf(__("Could not find folder ID by name %s", 'xcloner-backup-and-restore'), $folderID), "error"); |
613 | 629 | } |
614 | 630 | } |
@@ -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,90 +491,90 @@ 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 | 566 | //REGISTERING THE 'CRON SECTION' FIELDS |
567 | 567 | register_setting('xcloner_cron_settings_group', 'xcloner_cron_frequency'); |
568 | - add_settings_field( |
|
569 | - 'xcloner_cron_frequency', |
|
570 | - __('Cron frequency','xcloner-backup-and-restore'), |
|
571 | - array($this, 'do_form_text_field'), |
|
572 | - 'xcloner_cron_settings_page', |
|
573 | - 'xcloner_cron_settings_group', |
|
574 | - array('xcloner_cron_frequency', |
|
568 | + add_settings_field( |
|
569 | + 'xcloner_cron_frequency', |
|
570 | + __('Cron frequency','xcloner-backup-and-restore'), |
|
571 | + array($this, 'do_form_text_field'), |
|
572 | + 'xcloner_cron_settings_page', |
|
573 | + 'xcloner_cron_settings_group', |
|
574 | + array('xcloner_cron_frequency', |
|
575 | 575 | __('Cron frequency') |
576 | 576 | ) |
577 | - ); |
|
577 | + ); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | // section content cb |
588 | 588 | public function xcloner_settings_section_cb() |
589 | 589 | { |
590 | - //echo '<p>WPOrg Section Introduction.</p>'; |
|
590 | + //echo '<p>WPOrg Section Introduction.</p>'; |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | // text field content cb |
@@ -602,8 +602,8 @@ discard block |
||
602 | 602 | |
603 | 603 | if(!$value) |
604 | 604 | $value = get_option($fieldname); |
605 | - // output the field |
|
606 | - ?> |
|
605 | + // output the field |
|
606 | + ?> |
|
607 | 607 | <div class="row"> |
608 | 608 | <div class="input-field col s10 m10 l8"> |
609 | 609 | <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) : ''; ?>"> |
@@ -629,8 +629,8 @@ discard block |
||
629 | 629 | |
630 | 630 | if(!$value) |
631 | 631 | $value = get_option($fieldname); |
632 | - // output the field |
|
633 | - ?> |
|
632 | + // output the field |
|
633 | + ?> |
|
634 | 634 | <div class="row"> |
635 | 635 | <div class="input-field col s10 m10 l8"> |
636 | 636 | <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> |
@@ -673,8 +673,8 @@ discard block |
||
673 | 673 | |
674 | 674 | if(!$value) |
675 | 675 | $value = get_option($fieldname); |
676 | - // output the field |
|
677 | - ?> |
|
676 | + // output the field |
|
677 | + ?> |
|
678 | 678 | <div class="row"> |
679 | 679 | <div class="input-field col s10 m5 l3"> |
680 | 680 | <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,36 +530,36 @@ 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 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | register_setting('xcloner_cron_settings_group', 'xcloner_cron_frequency'); |
568 | 568 | add_settings_field( |
569 | 569 | 'xcloner_cron_frequency', |
570 | - __('Cron frequency','xcloner-backup-and-restore'), |
|
570 | + __('Cron frequency', 'xcloner-backup-and-restore'), |
|
571 | 571 | array($this, 'do_form_text_field'), |
572 | 572 | 'xcloner_cron_settings_page', |
573 | 573 | 'xcloner_cron_settings_group', |
@@ -593,20 +593,20 @@ discard block |
||
593 | 593 | // text field content cb |
594 | 594 | public function do_form_text_field($params) |
595 | 595 | { |
596 | - if(!isset($params['3'])) |
|
596 | + if (!isset($params['3'])) |
|
597 | 597 | $params[3] = 0; |
598 | - if(!isset($params['2'])) |
|
598 | + if (!isset($params['2'])) |
|
599 | 599 | $params[2] = 0; |
600 | 600 | |
601 | 601 | list($fieldname, $label, $value, $disabled) = $params; |
602 | 602 | |
603 | - if(!$value) |
|
603 | + if (!$value) |
|
604 | 604 | $value = get_option($fieldname); |
605 | 605 | // output the field |
606 | 606 | ?> |
607 | 607 | <div class="row"> |
608 | 608 | <div class="input-field col s10 m10 l8"> |
609 | - <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) : ''; ?>"> |
|
609 | + <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) : ''; ?>"> |
|
610 | 610 | </div> |
611 | 611 | <div class="col s2 m2 "> |
612 | 612 | <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> |
@@ -620,20 +620,20 @@ discard block |
||
620 | 620 | // textarea field content cb |
621 | 621 | public function do_form_textarea_field($params) |
622 | 622 | { |
623 | - if(!isset($params['3'])) |
|
623 | + if (!isset($params['3'])) |
|
624 | 624 | $params[3] = 0; |
625 | - if(!isset($params['2'])) |
|
625 | + if (!isset($params['2'])) |
|
626 | 626 | $params[2] = 0; |
627 | 627 | |
628 | 628 | list($fieldname, $label, $value, $disabled) = $params; |
629 | 629 | |
630 | - if(!$value) |
|
630 | + if (!$value) |
|
631 | 631 | $value = get_option($fieldname); |
632 | 632 | // output the field |
633 | 633 | ?> |
634 | 634 | <div class="row"> |
635 | 635 | <div class="input-field col s10 m10 l8"> |
636 | - <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> |
|
636 | + <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> |
|
637 | 637 | </div> |
638 | 638 | <div class="col s2 m2 "> |
639 | 639 | <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> |
@@ -664,20 +664,20 @@ discard block |
||
664 | 664 | // number field content cb |
665 | 665 | public function do_form_number_field($params) |
666 | 666 | { |
667 | - if(!isset($params['3'])) |
|
667 | + if (!isset($params['3'])) |
|
668 | 668 | $params[3] = 0; |
669 | - if(!isset($params['2'])) |
|
669 | + if (!isset($params['2'])) |
|
670 | 670 | $params[2] = 0; |
671 | 671 | |
672 | 672 | list($fieldname, $label, $value, $disabled) = $params; |
673 | 673 | |
674 | - if(!$value) |
|
674 | + if (!$value) |
|
675 | 675 | $value = get_option($fieldname); |
676 | 676 | // output the field |
677 | 677 | ?> |
678 | 678 | <div class="row"> |
679 | 679 | <div class="input-field col s10 m5 l3"> |
680 | - <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) : ''; ?>"> |
|
680 | + <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) : ''; ?>"> |
|
681 | 681 | </div> |
682 | 682 | <div class="col s2 m2 "> |
683 | 683 | <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> |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | |
691 | 691 | public function do_form_range_field($params) |
692 | 692 | { |
693 | - if(!isset($params['4'])) |
|
693 | + if (!isset($params['4'])) |
|
694 | 694 | $params[4] = 0; |
695 | 695 | |
696 | 696 | list($fieldname, $label, $range_start, $range_end, $disabled) = $params; |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | <div class="row"> |
700 | 700 | <div class="input-field col s10 m10 l8"> |
701 | 701 | <p class="range-field"> |
702 | - <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) : ''; ?>" /> |
|
702 | + <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) : ''; ?>" /> |
|
703 | 703 | </p> |
704 | 704 | </div> |
705 | 705 | <div class="col s2 m2 "> |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | |
713 | 713 | public function do_form_switch_field($params) |
714 | 714 | { |
715 | - if(!isset($params['2'])) |
|
715 | + if (!isset($params['2'])) |
|
716 | 716 | $params[2] = 0; |
717 | 717 | list($fieldname, $label, $disabled) = $params; |
718 | 718 | $value = get_option($fieldname); |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | <div class="switch"> |
723 | 723 | <label> |
724 | 724 | Off |
725 | - <input <?php echo ($disabled)?"disabled":""?> type="checkbox" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" value="1" <?php echo ($value) ? 'checked="checked"' : ''; ?>"> |
|
725 | + <input <?php echo ($disabled) ? "disabled" : ""?> type="checkbox" name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" value="1" <?php echo ($value) ? 'checked="checked"' : ''; ?>"> |
|
726 | 726 | <span class="lever"></span> |
727 | 727 | On |
728 | 728 | </label> |
@@ -4,44 +4,44 @@ discard block |
||
4 | 4 | use Monolog\Handler\StreamHandler; |
5 | 5 | use Monolog\Handler\RotatingFileHandler; |
6 | 6 | |
7 | -class Xcloner_Logger extends Logger{ |
|
7 | +class Xcloner_Logger extends Logger { |
|
8 | 8 | |
9 | - private $logger_path ; |
|
9 | + private $logger_path; |
|
10 | 10 | private $max_logger_files = 7; |
11 | 11 | private $main_logger_url; |
12 | 12 | |
13 | 13 | public function __construct(Xcloner $xcloner_container, $logger_name = "xcloner_logger") |
14 | 14 | { |
15 | - if(!$xcloner_container->get_xcloner_settings()) |
|
15 | + if (!$xcloner_container->get_xcloner_settings()) |
|
16 | 16 | { |
17 | 17 | $xcloner_settings = new Xcloner_Settings($xcloner_container); |
18 | - }else{ |
|
18 | + } else { |
|
19 | 19 | $xcloner_settings = $xcloner_container->get_xcloner_settings(); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $hash = $xcloner_settings->get_hash(); |
23 | - if($hash == "-".$xcloner_settings->get_server_unique_hash(5)) |
|
23 | + if ($hash == "-".$xcloner_settings->get_server_unique_hash(5)) |
|
24 | 24 | { |
25 | 25 | $hash = ""; |
26 | 26 | } |
27 | 27 | |
28 | - $logger_path = $xcloner_settings->get_xcloner_store_path().DS.$xcloner_settings->get_logger_filename(); |
|
29 | - $logger_path_tmp = ""; |
|
28 | + $logger_path = $xcloner_settings->get_xcloner_store_path().DS.$xcloner_settings->get_logger_filename(); |
|
29 | + $logger_path_tmp = ""; |
|
30 | 30 | |
31 | - if($hash) |
|
31 | + if ($hash) |
|
32 | 32 | { |
33 | 33 | $logger_path_tmp = $xcloner_settings->get_xcloner_tmp_path().DS.$xcloner_settings->get_logger_filename(1); |
34 | 34 | } |
35 | 35 | |
36 | 36 | $this->logger_path = $logger_path; |
37 | 37 | |
38 | - if(!is_dir($xcloner_settings->get_xcloner_store_path()) or !is_writable($xcloner_settings->get_xcloner_store_path())) |
|
38 | + if (!is_dir($xcloner_settings->get_xcloner_store_path()) or !is_writable($xcloner_settings->get_xcloner_store_path())) |
|
39 | 39 | { |
40 | 40 | $logger_path = 'php://stderr'; |
41 | 41 | $logger_path_tmp = ""; |
42 | 42 | } |
43 | 43 | |
44 | - if(!$xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
|
44 | + if (!$xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
|
45 | 45 | { |
46 | 46 | $logger_path = 'php://stderr'; |
47 | 47 | $logger_path_tmp = ""; |
@@ -52,27 +52,27 @@ discard block |
||
52 | 52 | |
53 | 53 | $debug_level = Logger::INFO; |
54 | 54 | |
55 | - if(WP_DEBUG) |
|
55 | + if (WP_DEBUG) |
|
56 | 56 | { |
57 | 57 | $debug_level = Logger::DEBUG; |
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | - if($logger_path) |
|
61 | + if ($logger_path) |
|
62 | 62 | { |
63 | - if(!$xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
|
63 | + if (!$xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
|
64 | 64 | { |
65 | 65 | $stream = new StreamHandler($logger_path, $debug_level); |
66 | - }else{ |
|
66 | + } else { |
|
67 | 67 | $stream = new RotatingFileHandler($logger_path, $this->max_logger_files, $debug_level); |
68 | 68 | } |
69 | 69 | |
70 | 70 | $this->pushHandler($stream); |
71 | 71 | |
72 | - $this->main_logger_url = $stream->getUrl(); |
|
72 | + $this->main_logger_url = $stream->getUrl(); |
|
73 | 73 | } |
74 | 74 | |
75 | - if($hash and $logger_path_tmp) |
|
75 | + if ($hash and $logger_path_tmp) |
|
76 | 76 | { |
77 | 77 | $this->pushHandler(new StreamHandler($logger_path_tmp, $debug_level)); |
78 | 78 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | $lines = array(); |
91 | 91 | |
92 | - if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) |
|
92 | + if (!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) |
|
93 | 93 | return false; |
94 | 94 | |
95 | 95 | $fp = fopen($this->main_logger_url, 'r'); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | $lastLine = ""; |
99 | 99 | |
100 | 100 | // Loop backword until we have our lines or we reach the start |
101 | - while($pos > 0 && count($lines) < $totalLines) { |
|
101 | + while ($pos > 0 && count($lines) < $totalLines) { |
|
102 | 102 | |
103 | 103 | $C = fgetc($fp); |
104 | - if($C == "\n") { |
|
104 | + if ($C == "\n") { |
|
105 | 105 | // skip empty lines |
106 | - if(trim($lastLine) != "") { |
|
106 | + if (trim($lastLine) != "") { |
|
107 | 107 | $lines[] = $lastLine; |
108 | 108 | } |
109 | 109 | $lastLine = ''; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | if(!$xcloner_container->get_xcloner_settings()) |
16 | 16 | { |
17 | 17 | $xcloner_settings = new Xcloner_Settings($xcloner_container); |
18 | - }else{ |
|
18 | + } else{ |
|
19 | 19 | $xcloner_settings = $xcloner_container->get_xcloner_settings(); |
20 | 20 | } |
21 | 21 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if(!$xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
64 | 64 | { |
65 | 65 | $stream = new StreamHandler($logger_path, $debug_level); |
66 | - }else{ |
|
66 | + } else{ |
|
67 | 67 | $stream = new RotatingFileHandler($logger_path, $this->max_logger_files, $debug_level); |
68 | 68 | } |
69 | 69 | |
@@ -89,8 +89,9 @@ discard block |
||
89 | 89 | { |
90 | 90 | $lines = array(); |
91 | 91 | |
92 | - if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) |
|
93 | - return false; |
|
92 | + if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) { |
|
93 | + return false; |
|
94 | + } |
|
94 | 95 | |
95 | 96 | $fp = fopen($this->main_logger_url, 'r'); |
96 | 97 | fseek($fp, -1, SEEK_END); |
@@ -33,11 +33,11 @@ |
||
33 | 33 | |
34 | 34 | global $xcloner_plugin; |
35 | 35 | |
36 | - if(is_a($xcloner_plugin, 'Xcloner')) |
|
36 | + if (is_a($xcloner_plugin, 'Xcloner')) |
|
37 | 37 | { |
38 | - try{ |
|
38 | + try { |
|
39 | 39 | $xcloner_plugin->get_xcloner_filesystem()->cleanup_tmp_directories(); |
40 | - }catch(Exception $e) |
|
40 | + }catch (Exception $e) |
|
41 | 41 | { |
42 | 42 | $xcloner_plugin->trigger_message_notice($e->getMessage()); |
43 | 43 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | try{ |
39 | 39 | $xcloner_plugin->get_xcloner_filesystem()->cleanup_tmp_directories(); |
40 | - }catch(Exception $e) |
|
40 | + } catch(Exception $e) |
|
41 | 41 | { |
42 | 42 | $xcloner_plugin->trigger_message_notice($e->getMessage()); |
43 | 43 | } |