@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | <h1><?= esc_html(get_admin_page_title()); ?></h1> |
| 11 | 11 | |
| 12 | 12 | <ul class="nav-tab-wrapper content row"> |
| 13 | - <li><a href="#backup_options" class="nav-tab col s12 m3 l2 nav-tab-active"><?php echo $tab.". ".__('Backup Options','xcloner-backup-and-restore')?></a></li> |
|
| 14 | - <?php if($xcloner_settings->get_enable_mysql_backup()):?> |
|
| 15 | - <li><a href="#database_options" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Database Options','xcloner-backup-and-restore')?></a></li> |
|
| 13 | + <li><a href="#backup_options" class="nav-tab col s12 m3 l2 nav-tab-active"><?php echo $tab.". ".__('Backup Options', 'xcloner-backup-and-restore')?></a></li> |
|
| 14 | + <?php if ($xcloner_settings->get_enable_mysql_backup()):?> |
|
| 15 | + <li><a href="#database_options" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Database Options', 'xcloner-backup-and-restore')?></a></li> |
|
| 16 | 16 | <?php endif?> |
| 17 | - <li><a href="#files_options" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Files Options','xcloner-backup-and-restore')?></a></li> |
|
| 18 | - <li><a href="#generate_backup" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Generate Backup','xcloner-backup-and-restore')?></a></li> |
|
| 19 | - <li><a href="#schedule_backup" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Schedule Backup','xcloner-backup-and-restore')?></a></li> |
|
| 17 | + <li><a href="#files_options" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Files Options', 'xcloner-backup-and-restore')?></a></li> |
|
| 18 | + <li><a href="#generate_backup" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Generate Backup', 'xcloner-backup-and-restore')?></a></li> |
|
| 19 | + <li><a href="#schedule_backup" class="nav-tab col s12 m3 l2 "><?php echo ++$tab.". ".__('Schedule Backup', 'xcloner-backup-and-restore')?></a></li> |
|
| 20 | 20 | </ul> |
| 21 | 21 | |
| 22 | 22 | <form action="" method="POST" id="generate_backup_form"> |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | <div class="input-field inline col s12 m10 l6"> |
| 28 | 28 | <i class="material-icons prefix">input</i> |
| 29 | 29 | <input name="backup_name" id="backup_name" type="text" value=<?php echo $xcloner_settings->get_default_backup_name() ?> > |
| 30 | - <label for="backup_name"><?php echo __('Backup Name','xcloner-backup-and-restore')?></label> |
|
| 30 | + <label for="backup_name"><?php echo __('Backup Name', 'xcloner-backup-and-restore')?></label> |
|
| 31 | 31 | </div> |
| 32 | 32 | <div class="hide-on-small-only m2"> |
| 33 | - <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('The default backup name, supported tags [time], [hostname], [domain]','xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 33 | + <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('The default backup name, supported tags [time], [hostname], [domain]', 'xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 34 | 34 | </div> |
| 35 | 35 | </div> |
| 36 | 36 | |
| 37 | 37 | <div class="row"> |
| 38 | 38 | <div class="input-field inline col s12 m10 l6"> |
| 39 | 39 | <i class="material-icons prefix">input</i> |
| 40 | - <input name="email_notification" id="email_notification" type="text" value="<?php echo get_option('admin_email');?>" > |
|
| 41 | - <label for="email_notification"><?php echo __('Send Email Notification To','xcloner-backup-and-restore')?></label> |
|
| 40 | + <input name="email_notification" id="email_notification" type="text" value="<?php echo get_option('admin_email'); ?>" > |
|
| 41 | + <label for="email_notification"><?php echo __('Send Email Notification To', 'xcloner-backup-and-restore')?></label> |
|
| 42 | 42 | </div> |
| 43 | 43 | <div class="hide-on-small-only m2"> |
| 44 | - <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('If left blank, no notification will be sent','xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 44 | + <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('If left blank, no notification will be sent', 'xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 45 | 45 | </div> |
| 46 | 46 | </div> |
| 47 | 47 | |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | <div class="input-field col s12 m10 l6"> |
| 50 | 50 | <i class="material-icons prefix">input</i> |
| 51 | 51 | <textarea name="backup_comments" id="backup_comments" class="materialize-textarea"></textarea> |
| 52 | - <label for="backup_comments"><?php echo __('Backup Comments','xcloner-backup-and-restore')?></label> |
|
| 52 | + <label for="backup_comments"><?php echo __('Backup Comments', 'xcloner-backup-and-restore')?></label> |
|
| 53 | 53 | </div> |
| 54 | 54 | <div class="hide-on-small-only m2"> |
| 55 | - <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('Some default backup comments that will be stored inside the backup archive','xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 55 | + <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('Some default backup comments that will be stored inside the backup archive', 'xcloner-backup-and-restore')?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 56 | 56 | </div> |
| 57 | 57 | </div> |
| 58 | 58 | |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | </div> |
| 64 | 64 | </div> |
| 65 | 65 | |
| 66 | - <?php if($xcloner_settings->get_enable_mysql_backup()):?> |
|
| 66 | + <?php if ($xcloner_settings->get_enable_mysql_backup()):?> |
|
| 67 | 67 | <div id="database_options" class="tab-content"> |
| 68 | 68 | <h2><?php echo __('Select database data to include in the backup', 'xcloner-backup-and-restore')?>: |
| 69 | - <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('Enable the \'Backup only WP tables\' setting if you don\'t want to show all other databases and tables not related to this Wordpress install','xcloner-backup-and-restore');?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 69 | + <a class="btn-floating tooltipped btn-small" data-position="right" data-delay="50" data-tooltip="<?php echo __('Enable the \'Backup only WP tables\' setting if you don\'t want to show all other databases and tables not related to this Wordpress install', 'xcloner-backup-and-restore'); ?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 70 | 70 | </h2> |
| 71 | 71 | |
| 72 | 72 | <!-- database/tables tree --> |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | <?php endif ?> |
| 87 | 87 | |
| 88 | 88 | <div id="files_options" class="tab-content"> |
| 89 | - <h2><?php echo __('Select from below the files/folders you want to exclude from your Backup Archive','xcloner-backup-and-restore')?>: |
|
| 90 | - <a class="btn-floating tooltipped btn-small" data-position="bottom" data-delay="50" data-html="true" data-tooltip="<?php echo __('You can navigate below through all your site structure(Backup Start Location) to exclude any file/folder you need by clicking the checkbox near it. <br />If the checkobx is disabled, then it matches a Regex Exclude File option and it can\'t be unchecked','xcloner-backup-and-restore');?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 89 | + <h2><?php echo __('Select from below the files/folders you want to exclude from your Backup Archive', 'xcloner-backup-and-restore')?>: |
|
| 90 | + <a class="btn-floating tooltipped btn-small" data-position="bottom" data-delay="50" data-html="true" data-tooltip="<?php echo __('You can navigate below through all your site structure(Backup Start Location) to exclude any file/folder you need by clicking the checkbox near it. <br />If the checkobx is disabled, then it matches a Regex Exclude File option and it can\'t be unchecked', 'xcloner-backup-and-restore'); ?>" data-tooltip-id=""><i class="material-icons">help_outline</i></a> |
|
| 91 | 91 | </h2> |
| 92 | 92 | |
| 93 | 93 | <!-- Files System Container --> |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | <ul class="backup-status collapsible" data-collapsible="accordion"> |
| 116 | 116 | <li class="file-system"> |
| 117 | 117 | <div class="collapsible-header"> |
| 118 | - <i class="material-icons">folder</i><?php echo __('Scanning The File System...','xcloner-backup-and-restore')?> |
|
| 118 | + <i class="material-icons">folder</i><?php echo __('Scanning The File System...', 'xcloner-backup-and-restore')?> |
|
| 119 | 119 | |
| 120 | 120 | <p class="right"><?php echo sprintf(__('Found %s files (%s)', 'xcloner-backup-and-restore'), '<span class="file-counter">0</span>', '<span class="file-size-total">0</span>MB')?></p> |
| 121 | 121 | |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | </div> |
| 130 | 130 | <div class="collapsible-body status-body"></div> |
| 131 | 131 | </li> |
| 132 | - <?php if($xcloner_settings->get_enable_mysql_backup()):?> |
|
| 132 | + <?php if ($xcloner_settings->get_enable_mysql_backup()):?> |
|
| 133 | 133 | <li class="database-backup"> |
| 134 | 134 | <div class="collapsible-header"> |
| 135 | - <i class="material-icons">storage</i><?php echo __('Generating the Mysql Backup...','xcloner-backup-and-restore')?> |
|
| 135 | + <i class="material-icons">storage</i><?php echo __('Generating the Mysql Backup...', 'xcloner-backup-and-restore')?> |
|
| 136 | 136 | |
| 137 | - <p class="right"><?php echo sprintf(__('Found %s tables in %s databases (%s)', 'xcloner-backup-and-restore'), '<span class="table-counter">0</span>', '<span class="database-counter">0</span>', '<span data-processed="0" class="total-records">0</span> records','xcloner-backup-and-restore')?></p> |
|
| 137 | + <p class="right"><?php echo sprintf(__('Found %s tables in %s databases (%s)', 'xcloner-backup-and-restore'), '<span class="table-counter">0</span>', '<span class="database-counter">0</span>', '<span data-processed="0" class="total-records">0</span> records', 'xcloner-backup-and-restore')?></p> |
|
| 138 | 138 | |
| 139 | 139 | <div> |
| 140 | 140 | <p class="right"><span class="last-logged-table"></span></p> |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | <?php endif?> |
| 159 | 159 | <li class="files-backup"> |
| 160 | 160 | <div class="collapsible-header"> |
| 161 | - <i class="material-icons">archive</i><?php echo __('Adding Files to Archive...','xcloner-backup-and-restore')?> |
|
| 161 | + <i class="material-icons">archive</i><?php echo __('Adding Files to Archive...', 'xcloner-backup-and-restore')?> |
|
| 162 | 162 | |
| 163 | - <p class="right"><?php echo sprintf(__('Adding %s files (%s)','xcloner-backup-and-restore'), '<span class="file-counter">0</span>', '<span data-processed="0" class="file-size-total">0</span>MB')?></p> |
|
| 163 | + <p class="right"><?php echo sprintf(__('Adding %s files (%s)', 'xcloner-backup-and-restore'), '<span class="file-counter">0</span>', '<span data-processed="0" class="file-size-total">0</span>MB')?></p> |
|
| 164 | 164 | |
| 165 | 165 | <div> |
| 166 | 166 | <p class="right"><span class="last-logged-file"></span></p> |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | <div class="collapsible-body status-body"> |
| 174 | 174 | <div class="row"> |
| 175 | 175 | <div class="col l3 s12"> |
| 176 | - <h2><?php echo __("Backup Parts",'xcloner-backup-and-restore')?>: </h2> |
|
| 176 | + <h2><?php echo __("Backup Parts", 'xcloner-backup-and-restore')?>: </h2> |
|
| 177 | 177 | </div> |
| 178 | 178 | <div class="col l9 s12"> |
| 179 | 179 | <ul class="backup-name"></ul> |
@@ -183,14 +183,14 @@ discard block |
||
| 183 | 183 | </li> |
| 184 | 184 | <li class="backup-done"> |
| 185 | 185 | <div class="collapsible-header"> |
| 186 | - <i class="material-icons">done</i><?php echo __('Backup Done','xcloner-backup-and-restore')?> |
|
| 186 | + <i class="material-icons">done</i><?php echo __('Backup Done', 'xcloner-backup-and-restore')?> |
|
| 187 | 187 | |
| 188 | 188 | <p class="right"> |
| 189 | - <?php if(sizeof($available_storages)):?> |
|
| 190 | - <a href="#" class="cloud-upload" title="<?php echo __("Send Backup To Remote Storage",'xcloner-backup-and-restore')?>"><i class="material-icons">cloud_upload</i></a> |
|
| 189 | + <?php if (sizeof($available_storages)):?> |
|
| 190 | + <a href="#" class="cloud-upload" title="<?php echo __("Send Backup To Remote Storage", 'xcloner-backup-and-restore')?>"><i class="material-icons">cloud_upload</i></a> |
|
| 191 | 191 | <?php endif?> |
| 192 | - <a href="#" class="download" title="<?php echo __("Download Backup",'xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
| 193 | - <a href="#" class="list-backup-content" title="<?php echo __("List Backup Content",'xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 192 | + <a href="#" class="download" title="<?php echo __("Download Backup", 'xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
| 193 | + <a href="#" class="list-backup-content" title="<?php echo __("List Backup Content", 'xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 194 | 194 | </p> |
| 195 | 195 | |
| 196 | 196 | <div class="progress"> |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | </div> |
| 201 | 201 | <div class="collapsible-body center-align"> |
| 202 | 202 | <div class="row"> |
| 203 | - <h5><?php echo __("Thank you for using XCloner.",'xcloner-backup-and-restore')?></h5> |
|
| 204 | - <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/reviews/" target="_blank">Wordpress XCloner Reviews Section</a>') ?></h6> |
|
| 203 | + <h5><?php echo __("Thank you for using XCloner.", 'xcloner-backup-and-restore')?></h5> |
|
| 204 | + <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/reviews/" target="_blank">Wordpress XCloner Reviews Section</a>') ?></h6> |
|
| 205 | 205 | <a class="twitter-follow-button" href="https://twitter.com/thinkovi" data-show-count="false">Follow @thinkovi</a> |
| 206 | 206 | <script src="//platform.twitter.com/widgets.js" async="" charset="utf-8"></script> |
| 207 | 207 | </div> |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | <div class="row"> |
| 219 | 219 | <div id="schedule_backup_success" class="col s12 l6 updated settings-error notice is-dismissible"> |
| 220 | 220 | <p><strong><?php echo __('Schedule Saved', 'xcloner-backup-and-restore')?></strong></p> |
| 221 | - <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php echo __('(Dismiss this notice.','xcloner-backup-and-restore')?></span></button> |
|
| 221 | + <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php echo __('(Dismiss this notice.', 'xcloner-backup-and-restore')?></span></button> |
|
| 222 | 222 | </div> |
| 223 | 223 | </div> |
| 224 | 224 | |
@@ -238,11 +238,11 @@ discard block |
||
| 238 | 238 | <div class="row"> |
| 239 | 239 | <div class="input-field inline col s12 m8 l4"> |
| 240 | 240 | <input type="datetime-local" id="datepicker" class="datepicker" name="schedule_start_date" > |
| 241 | - <label for="datepicker"><?php echo __('Schedule Backup To Start On:','xcloner-backup-and-restore')?></label> |
|
| 241 | + <label for="datepicker"><?php echo __('Schedule Backup To Start On:', 'xcloner-backup-and-restore')?></label> |
|
| 242 | 242 | </div> |
| 243 | 243 | <div class="input-field inline col s12 m4 l3"> |
| 244 | 244 | <input id="timepicker_ampm_dark" class="timepicker" type="time" name="schedule_start_time"> |
| 245 | - <label for="timepicker_ampm_dark"><?php echo __('At:','xcloner-backup-and-restore')?></label> |
|
| 245 | + <label for="timepicker_ampm_dark"><?php echo __('At:', 'xcloner-backup-and-restore')?></label> |
|
| 246 | 246 | </div> |
| 247 | 247 | </div> |
| 248 | 248 | |
@@ -250,22 +250,22 @@ discard block |
||
| 250 | 250 | <div class="input-field col s12 l7"> |
| 251 | 251 | <select name="schedule_frequency" id="schedule_frequency" class="validate" required> |
| 252 | 252 | <option value="" disabled selected><?php echo __('please select', 'xcloner-backup-and-restore') ?></option> |
| 253 | - <option value="single"><?php echo __("Don't Repeat",'xcloner-backup-and-restore')?></option> |
|
| 254 | - <option value="hourly"><?php echo __("Hourly",'xcloner-backup-and-restore')?></option> |
|
| 255 | - <option value="daily"><?php echo __("Daily",'xcloner-backup-and-restore')?></option> |
|
| 256 | - <option value="weekly"><?php echo __("Weekly",'xcloner-backup-and-restore')?></option> |
|
| 257 | - <option value="monthly"><?php echo __("Monthly",'xcloner-backup-and-restore')?></option> |
|
| 253 | + <option value="single"><?php echo __("Don't Repeat", 'xcloner-backup-and-restore')?></option> |
|
| 254 | + <option value="hourly"><?php echo __("Hourly", 'xcloner-backup-and-restore')?></option> |
|
| 255 | + <option value="daily"><?php echo __("Daily", 'xcloner-backup-and-restore')?></option> |
|
| 256 | + <option value="weekly"><?php echo __("Weekly", 'xcloner-backup-and-restore')?></option> |
|
| 257 | + <option value="monthly"><?php echo __("Monthly", 'xcloner-backup-and-restore')?></option> |
|
| 258 | 258 | </select> |
| 259 | 259 | <label><?php echo __('Please Select Frequency to run', 'xcloner-backup-and-restore') ?></label> |
| 260 | 260 | </div> |
| 261 | 261 | </div> |
| 262 | 262 | |
| 263 | - <?php if(sizeof($available_storages)):?> |
|
| 263 | + <?php if (sizeof($available_storages)):?> |
|
| 264 | 264 | <div class="row"> |
| 265 | 265 | <div class="input-field col s12 m12 l7"> |
| 266 | 266 | <select name="schedule_storage" id="schedule_storage" class="validate"> |
| 267 | 267 | <option value="" selected><?php echo __('none', 'xcloner-backup-and-restore') ?></option> |
| 268 | - <?php foreach($available_storages as $storage=>$text):?> |
|
| 268 | + <?php foreach ($available_storages as $storage=>$text):?> |
|
| 269 | 269 | <option value="<?php echo $storage?>"><?php echo $text?></option> |
| 270 | 270 | <?php endforeach?> |
| 271 | 271 | </select> |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | <?php endif?> |
| 276 | 276 | <div class="row"> |
| 277 | 277 | <div class="col s12 l7"> |
| 278 | - <button class="right btn waves-effect waves-light submit_schedule" type="submit" name="action"><?php echo __("Submit" ,'xcloner-backup-and-restore')?> |
|
| 278 | + <button class="right btn waves-effect waves-light submit_schedule" type="submit" name="action"><?php echo __("Submit", 'xcloner-backup-and-restore')?> |
|
| 279 | 279 | <i class="material-icons right">send</i> |
| 280 | 280 | </button> |
| 281 | 281 | </div> |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | <textarea class="body" rows="5"></textarea> |
| 295 | 295 | </div> |
| 296 | 296 | <div class="modal-footer"> |
| 297 | - <a class=" modal-action modal-close waves-effect waves-green btn-flat red darken-2"><?php echo __('Close','xcloner-backup-and-restore')?></a> |
|
| 297 | + <a class=" modal-action modal-close waves-effect waves-green btn-flat red darken-2"><?php echo __('Close', 'xcloner-backup-and-restore')?></a> |
|
| 298 | 298 | </div> |
| 299 | 299 | </div> |
| 300 | 300 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | <div id="backup_cotent_modal" class="modal"> |
| 304 | 304 | <div class="modal-content"> |
| 305 | - <h4><?php echo sprintf(__("Listing Backup Content ",'xcloner-backup-and-restore'), "")?></h4> |
|
| 305 | + <h4><?php echo sprintf(__("Listing Backup Content ", 'xcloner-backup-and-restore'), "")?></h4> |
|
| 306 | 306 | <h5 class="backup-name"></h5> |
| 307 | 307 | |
| 308 | 308 | <div class="progress"> |
@@ -317,9 +317,9 @@ discard block |
||
| 317 | 317 | <form method="POST" class="remote-storage-form"> |
| 318 | 318 | <input type="hidden" name="file" class="backup_name"> |
| 319 | 319 | <div class="modal-content"> |
| 320 | - <h4><?php echo __("Remote Storage Transfer",'xcloner-backup-and-restore')?></h4> |
|
| 320 | + <h4><?php echo __("Remote Storage Transfer", 'xcloner-backup-and-restore')?></h4> |
|
| 321 | 321 | <p> |
| 322 | - <?php if(sizeof($available_storages)):?> |
|
| 322 | + <?php if (sizeof($available_storages)):?> |
|
| 323 | 323 | <div class="row"> |
| 324 | 324 | <div class="col s12 label"> |
| 325 | 325 | <label><?php echo __(sprintf('Send %s to remote storage', "<span class='backup_name'></span>"), 'xcloner-backup-and-restore') ?></label> |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | <div class="input-field col s8 m10"> |
| 328 | 328 | <select name="transfer_storage" id="transfer_storage" class="validate" required > |
| 329 | 329 | <option value="" selected><?php echo __('please select...', 'xcloner-backup-and-restore') ?></option> |
| 330 | - <?php foreach($available_storages as $storage=>$text):?> |
|
| 330 | + <?php foreach ($available_storages as $storage=>$text):?> |
|
| 331 | 331 | <option value="<?php echo $storage?>"><?php echo $text?></option> |
| 332 | 332 | <?php endforeach?> |
| 333 | 333 | </select> |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | </div> |
| 339 | 339 | </div> |
| 340 | 340 | <div class="row status"> |
| 341 | - <?php echo __("Uploading backup to the selected remote storage...",'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
| 341 | + <?php echo __("Uploading backup to the selected remote storage...", 'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
| 342 | 342 | <div class="progress"> |
| 343 | 343 | <div class="indeterminate"></div> |
| 344 | 344 | </div> |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | }); |
| 413 | 413 | |
| 414 | - <?php if($xcloner_settings->get_enable_mysql_backup()):?> |
|
| 414 | + <?php if ($xcloner_settings->get_enable_mysql_backup()):?> |
|
| 415 | 415 | jQuery('#jstree_database_container').jstree({ |
| 416 | 416 | 'core' : { |
| 417 | 417 | 'check_callback' : true, |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | $xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
| 5 | 5 | $available_storages = $xcloner_remote_storage->get_available_storages(); |
| 6 | 6 | ?> |
| 7 | -<?php if(!defined("DISABLE_WP_CRON") || !DISABLE_WP_CRON): ?> |
|
| 7 | +<?php if (!defined("DISABLE_WP_CRON") || !DISABLE_WP_CRON): ?> |
|
| 8 | 8 | <div id="setting-error-" class="error settings-error notice is-dismissible"> |
| 9 | 9 | <p><strong> |
| 10 | 10 | <?php echo sprintf(__('We have noticed that DISABLE_WP_CRON is disabled, we recommend enabling that and setting up wp-cron.php to run manually through your hosting account scheduler as explained <a href="%s" target="_blank">here</a>', 'xcloner-backup-and-restore'), "http://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress") ?> |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | <div class="row"> |
| 50 | 50 | <div class="col s12 m6 offset-m6 teal lighten-1" id="server_time"> |
| 51 | - <h2><?php echo __('Current Server Time', 'xcloner-backup-and-restore')?>: <span class="right"><?php echo current_time('mysql');?></span></h2> |
|
| 51 | + <h2><?php echo __('Current Server Time', 'xcloner-backup-and-restore')?>: <span class="right"><?php echo current_time('mysql'); ?></span></h2> |
|
| 52 | 52 | </div> |
| 53 | 53 | </div> |
| 54 | 54 | |
@@ -103,21 +103,21 @@ discard block |
||
| 103 | 103 | <div class="input-field col s12 l6"> |
| 104 | 104 | <select name="schedule_frequency" id="schedule_frequency" class="validate" required> |
| 105 | 105 | <option value="" disabled selected><?php echo __('Schedule Recurrence', 'xcloner-backup-and-restore') ?></option> |
| 106 | - <option value="single"><?php echo __("Don't Repeat",'xcloner-backup-and-restore')?></option> |
|
| 107 | - <option value="hourly"><?php echo __("Hourly",'xcloner-backup-and-restore')?></option> |
|
| 108 | - <option value="daily"><?php echo __("Daily",'xcloner-backup-and-restore')?></option> |
|
| 109 | - <option value="weekly"><?php echo __("Weekly",'xcloner-backup-and-restore')?></option> |
|
| 110 | - <option value="monthly"><?php echo __("Monthly",'xcloner-backup-and-restore')?></option> |
|
| 106 | + <option value="single"><?php echo __("Don't Repeat", 'xcloner-backup-and-restore')?></option> |
|
| 107 | + <option value="hourly"><?php echo __("Hourly", 'xcloner-backup-and-restore')?></option> |
|
| 108 | + <option value="daily"><?php echo __("Daily", 'xcloner-backup-and-restore')?></option> |
|
| 109 | + <option value="weekly"><?php echo __("Weekly", 'xcloner-backup-and-restore')?></option> |
|
| 110 | + <option value="monthly"><?php echo __("Monthly", 'xcloner-backup-and-restore')?></option> |
|
| 111 | 111 | </select> |
| 112 | 112 | </div> |
| 113 | 113 | </div> |
| 114 | 114 | |
| 115 | - <?php if(sizeof($available_storages)):?> |
|
| 115 | + <?php if (sizeof($available_storages)):?> |
|
| 116 | 116 | <div class="row"> |
| 117 | 117 | <div class="input-field col s12 l12"> |
| 118 | 118 | <select name="schedule_storage" id="schedule_storage" class="validate" > |
| 119 | 119 | <option value="" selected><?php echo __('none', 'xcloner-backup-and-restore') ?></option> |
| 120 | - <?php foreach($available_storages as $storage=>$text):?> |
|
| 120 | + <?php foreach ($available_storages as $storage=>$text):?> |
|
| 121 | 121 | <option value="<?php echo $storage?>"><?php echo $text?></option> |
| 122 | 122 | <?php endforeach?> |
| 123 | 123 | </select> |
@@ -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"; |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | global $wpdb; |
| 22 | 22 | |
| 23 | - $this->db = $wpdb; |
|
| 24 | - $wpdb->show_errors = false; |
|
| 23 | + $this->db = $wpdb; |
|
| 24 | + $wpdb->show_errors = false; |
|
| 25 | 25 | |
| 26 | 26 | $this->xcloner_container = $xcloner_container; |
| 27 | 27 | $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
@@ -34,18 +34,18 @@ discard block |
||
| 34 | 34 | return $this->xcloner_container; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function get_scheduler_list($return_only_enabled = 0 ) |
|
| 37 | + public function get_scheduler_list($return_only_enabled = 0) |
|
| 38 | 38 | { |
| 39 | 39 | $list = $this->db->get_results("SELECT * FROM ".$this->scheduler_table); |
| 40 | 40 | |
| 41 | - if($return_only_enabled) |
|
| 41 | + if ($return_only_enabled) |
|
| 42 | 42 | { |
| 43 | - $new_list= array(); |
|
| 43 | + $new_list = array(); |
|
| 44 | 44 | |
| 45 | - foreach($list as $res) |
|
| 46 | - if($res->status) |
|
| 45 | + foreach ($list as $res) |
|
| 46 | + if ($res->status) |
|
| 47 | 47 | { |
| 48 | - $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
|
| 48 | + $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)) + (get_option('gmt_offset') * HOUR_IN_SECONDS); |
|
| 49 | 49 | $new_list[] = $res; |
| 50 | 50 | } |
| 51 | 51 | $list = $new_list; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
| 73 | 73 | |
| 74 | - if(!$data) |
|
| 74 | + if (!$data) |
|
| 75 | 75 | return false; |
| 76 | 76 | |
| 77 | 77 | $params = json_decode($data['params']); |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | public function delete_schedule_by_id($id) |
| 90 | 90 | { |
| 91 | - $hook = 'xcloner_scheduler_'.$id; |
|
| 92 | - wp_clear_scheduled_hook( $hook, array($id) ); |
|
| 91 | + $hook = 'xcloner_scheduler_'.$id; |
|
| 92 | + wp_clear_scheduled_hook($hook, array($id)); |
|
| 93 | 93 | |
| 94 | - $data = $this->db->delete( $this->scheduler_table , array( 'id' => $id ) ); |
|
| 94 | + $data = $this->db->delete($this->scheduler_table, array('id' => $id)); |
|
| 95 | 95 | |
| 96 | 96 | return $data; |
| 97 | 97 | } |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $list = $this->get_scheduler_list(); |
| 102 | 102 | |
| 103 | - foreach($list as $schedule) |
|
| 103 | + foreach ($list as $schedule) |
|
| 104 | 104 | { |
| 105 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 105 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 106 | 106 | |
| 107 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 108 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 107 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 108 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
@@ -113,24 +113,24 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $list = $this->get_scheduler_list(); |
| 115 | 115 | |
| 116 | - foreach($list as $schedule) |
|
| 116 | + foreach ($list as $schedule) |
|
| 117 | 117 | { |
| 118 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 118 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 119 | 119 | |
| 120 | 120 | //adding the xcloner_scheduler hook with xcloner_scheduler_callback callback |
| 121 | - add_action( $hook, array($this, 'xcloner_scheduler_callback'), 10, 1 ); |
|
| 121 | + add_action($hook, array($this, 'xcloner_scheduler_callback'), 10, 1); |
|
| 122 | 122 | |
| 123 | - if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
|
| 123 | + if (!wp_next_scheduled($hook, array($schedule->id)) and $schedule->status) { |
|
| 124 | 124 | |
| 125 | - if($schedule->recurrence == "single") |
|
| 126 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 125 | + if ($schedule->recurrence == "single") |
|
| 126 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 127 | 127 | else |
| 128 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 128 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
| 129 | 129 | |
| 130 | - }elseif(!$schedule->status) |
|
| 130 | + }elseif (!$schedule->status) |
|
| 131 | 131 | { |
| 132 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 133 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 132 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 133 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
@@ -139,17 +139,17 @@ discard block |
||
| 139 | 139 | public function update_cron_hook($id) |
| 140 | 140 | { |
| 141 | 141 | $schedule = $this->get_schedule_by_id_object($id); |
| 142 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 142 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 143 | 143 | |
| 144 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 145 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 144 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 145 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 146 | 146 | |
| 147 | 147 | if ($schedule->status) { |
| 148 | 148 | |
| 149 | - if($schedule->recurrence == "single") |
|
| 150 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 151 | - else{ |
|
| 152 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 149 | + if ($schedule->recurrence == "single") |
|
| 150 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 151 | + else { |
|
| 152 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | } |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | public function disable_single_cron($schedule_id) |
| 159 | 159 | { |
| 160 | - $hook = 'xcloner_scheduler_'.$schedule_id; |
|
| 161 | - $timestamp = wp_next_scheduled( $hook , array($schedule_id) ); |
|
| 162 | - wp_unschedule_event( $timestamp, $hook, array($schedule_id) ); |
|
| 160 | + $hook = 'xcloner_scheduler_'.$schedule_id; |
|
| 161 | + $timestamp = wp_next_scheduled($hook, array($schedule_id)); |
|
| 162 | + wp_unschedule_event($timestamp, $hook, array($schedule_id)); |
|
| 163 | 163 | |
| 164 | 164 | $schedule['status'] = 0; |
| 165 | 165 | |
| 166 | 166 | $update = $this->db->update( |
| 167 | 167 | $this->scheduler_table, |
| 168 | 168 | $schedule, |
| 169 | - array( 'id' => $schedule_id ), |
|
| 169 | + array('id' => $schedule_id), |
|
| 170 | 170 | array( |
| 171 | 171 | '%s', |
| 172 | 172 | '%s' |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $update = $this->db->update( |
| 183 | 183 | $this->scheduler_table, |
| 184 | 184 | $schedule, |
| 185 | - array( 'id' => $schedule_id ), |
|
| 185 | + array('id' => $schedule_id), |
|
| 186 | 186 | array( |
| 187 | 187 | '%s', |
| 188 | 188 | '%s' |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $update = $this->db->update( |
| 199 | 199 | $this->scheduler_table, |
| 200 | 200 | $schedule, |
| 201 | - array( 'id' => $schedule_id ), |
|
| 201 | + array('id' => $schedule_id), |
|
| 202 | 202 | array( |
| 203 | 203 | '%s', |
| 204 | 204 | '%s' |
@@ -211,18 +211,18 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | set_time_limit(0); |
| 213 | 213 | |
| 214 | - $this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 215 | - $this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database(); |
|
| 216 | - $this->archive_system = $this->get_xcloner_container()->get_archive_system(); |
|
| 217 | - $this->logger = $this->get_xcloner_container()->get_xcloner_logger()->withName("xcloner_scheduler"); |
|
| 218 | - $this->xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
| 214 | + $this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 215 | + $this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database(); |
|
| 216 | + $this->archive_system = $this->get_xcloner_container()->get_archive_system(); |
|
| 217 | + $this->logger = $this->get_xcloner_container()->get_xcloner_logger()->withName("xcloner_scheduler"); |
|
| 218 | + $this->xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
| 219 | 219 | |
| 220 | - if($schedule['recurrence'] == "single") |
|
| 220 | + if ($schedule['recurrence'] == "single") |
|
| 221 | 221 | { |
| 222 | 222 | $this->disable_single_cron($schedule['id']); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if(!$schedule) |
|
| 225 | + if (!$schedule) |
|
| 226 | 226 | { |
| 227 | 227 | $this->logger->info(sprintf("Could not load schedule with id'%s'", $id), array("CRON")); |
| 228 | 228 | return; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $init = 1; |
| 238 | 238 | $continue = 1; |
| 239 | 239 | |
| 240 | - while($continue) |
|
| 240 | + while ($continue) |
|
| 241 | 241 | { |
| 242 | 242 | $continue = $this->xcloner_file_system->start_file_recursion($init); |
| 243 | 243 | |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | $init = 1; |
| 252 | 252 | $return['finished'] = 0; |
| 253 | 253 | |
| 254 | - while(!$return['finished']) |
|
| 254 | + while (!$return['finished']) |
|
| 255 | 255 | { |
| 256 | - $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
| 256 | + $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
| 257 | 257 | $init = 0; |
| 258 | 258 | } |
| 259 | 259 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $return['finished'] = 0; |
| 266 | 266 | $return['extra'] = array(); |
| 267 | 267 | |
| 268 | - while(!$return['finished']) |
|
| 268 | + while (!$return['finished']) |
|
| 269 | 269 | { |
| 270 | 270 | $return = $this->archive_system->start_incremental_backup((array)$schedule['backup_params'], $return['extra'], $init); |
| 271 | 271 | $init = 0; |
@@ -274,29 +274,29 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | //getting the last backup archive file |
| 276 | 276 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 277 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 277 | + if ($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 278 | 278 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
| 279 | 279 | |
| 280 | 280 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
| 281 | 281 | |
| 282 | - if($schedule['remote_storage'] and array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
| 282 | + if ($schedule['remote_storage'] and array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
| 283 | 283 | { |
| 284 | 284 | $backup_file = $return['extra']['backup_parent']; |
| 285 | 285 | |
| 286 | 286 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
| 287 | 287 | |
| 288 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 288 | + if (method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 289 | 289 | call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
| 293 | - if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
|
| 293 | + if (isset($schedule['backup_params']->email_notification) and $to = $schedule['backup_params']->email_notification) |
|
| 294 | 294 | { |
| 295 | - try{ |
|
| 295 | + try { |
|
| 296 | 296 | $from = "XCloner Schedule - ".$schedule['name']; |
| 297 | 297 | $additional['lines_total'] = $return['extra']['lines_total']; |
| 298 | 298 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule, "", $additional); |
| 299 | - }catch(Exception $e) |
|
| 299 | + }catch (Exception $e) |
|
| 300 | 300 | { |
| 301 | 301 | $this->logger->error($e->getMessage()); |
| 302 | 302 | } |
@@ -311,20 +311,20 @@ discard block |
||
| 311 | 311 | { |
| 312 | 312 | $schedule = $this->get_schedule_by_id($id); |
| 313 | 313 | |
| 314 | - try{ |
|
| 314 | + try { |
|
| 315 | 315 | |
| 316 | 316 | $this->__xcloner_scheduler_callback($id, $schedule); |
| 317 | 317 | |
| 318 | - }catch(Exception $e){ |
|
| 318 | + }catch (Exception $e) { |
|
| 319 | 319 | |
| 320 | 320 | //send email to site admin if email notification is not set in the scheduler |
| 321 | - if(!isset($schedule['backup_params']->email_notification)) |
|
| 321 | + if (!isset($schedule['backup_params']->email_notification)) |
|
| 322 | 322 | $schedule['backup_params']->email_notification = get_option('admin_email'); |
| 323 | 323 | |
| 324 | - if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
|
| 324 | + if (isset($schedule['backup_params']->email_notification) and $to = $schedule['backup_params']->email_notification) |
|
| 325 | 325 | { |
| 326 | 326 | $from = "XCloner Schedule - ".$schedule['name']; |
| 327 | - $this->archive_system->send_notification($to, $from, "Scheduled backup error","", "", $e->getMessage()); |
|
| 327 | + $this->archive_system->send_notification($to, $from, "Scheduled backup error", "", "", $e->getMessage()); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | } |
@@ -42,10 +42,11 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $new_list= array(); |
| 44 | 44 | |
| 45 | - foreach($list as $res) |
|
| 46 | - if($res->status) |
|
| 45 | + foreach($list as $res) { |
|
| 46 | + if($res->status) |
|
| 47 | 47 | { |
| 48 | 48 | $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
| 49 | + } |
|
| 49 | 50 | $new_list[] = $res; |
| 50 | 51 | } |
| 51 | 52 | $list = $new_list; |
@@ -71,8 +72,9 @@ discard block |
||
| 71 | 72 | { |
| 72 | 73 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
| 73 | 74 | |
| 74 | - if(!$data) |
|
| 75 | - return false; |
|
| 75 | + if(!$data) { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 76 | 78 | |
| 77 | 79 | $params = json_decode($data['params']); |
| 78 | 80 | |
@@ -122,12 +124,13 @@ discard block |
||
| 122 | 124 | |
| 123 | 125 | if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
| 124 | 126 | |
| 125 | - if($schedule->recurrence == "single") |
|
| 126 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 127 | - else |
|
| 128 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 127 | + if($schedule->recurrence == "single") { |
|
| 128 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 129 | + } else { |
|
| 130 | + wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 131 | + } |
|
| 129 | 132 | |
| 130 | - }elseif(!$schedule->status) |
|
| 133 | + } elseif(!$schedule->status) |
|
| 131 | 134 | { |
| 132 | 135 | $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
| 133 | 136 | wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
@@ -146,9 +149,9 @@ discard block |
||
| 146 | 149 | |
| 147 | 150 | if ($schedule->status) { |
| 148 | 151 | |
| 149 | - if($schedule->recurrence == "single") |
|
| 150 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 151 | - else{ |
|
| 152 | + if($schedule->recurrence == "single") { |
|
| 153 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 154 | + } else{ |
|
| 152 | 155 | wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
| 153 | 156 | } |
| 154 | 157 | |
@@ -274,8 +277,9 @@ discard block |
||
| 274 | 277 | |
| 275 | 278 | //getting the last backup archive file |
| 276 | 279 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 277 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 278 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 280 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
| 281 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 282 | + } |
|
| 279 | 283 | |
| 280 | 284 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
| 281 | 285 | |
@@ -285,8 +289,9 @@ discard block |
||
| 285 | 289 | |
| 286 | 290 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
| 287 | 291 | |
| 288 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 289 | - call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
| 292 | + if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) { |
|
| 293 | + call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
| 294 | + } |
|
| 290 | 295 | } |
| 291 | 296 | |
| 292 | 297 | |
@@ -296,7 +301,7 @@ discard block |
||
| 296 | 301 | $from = "XCloner Schedule - ".$schedule['name']; |
| 297 | 302 | $additional['lines_total'] = $return['extra']['lines_total']; |
| 298 | 303 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule, "", $additional); |
| 299 | - }catch(Exception $e) |
|
| 304 | + } catch(Exception $e) |
|
| 300 | 305 | { |
| 301 | 306 | $this->logger->error($e->getMessage()); |
| 302 | 307 | } |
@@ -315,11 +320,12 @@ discard block |
||
| 315 | 320 | |
| 316 | 321 | $this->__xcloner_scheduler_callback($id, $schedule); |
| 317 | 322 | |
| 318 | - }catch(Exception $e){ |
|
| 323 | + } catch(Exception $e){ |
|
| 319 | 324 | |
| 320 | 325 | //send email to site admin if email notification is not set in the scheduler |
| 321 | - if(!isset($schedule['backup_params']->email_notification)) |
|
| 322 | - $schedule['backup_params']->email_notification = get_option('admin_email'); |
|
| 326 | + if(!isset($schedule['backup_params']->email_notification)) { |
|
| 327 | + $schedule['backup_params']->email_notification = get_option('admin_email'); |
|
| 328 | + } |
|
| 323 | 329 | |
| 324 | 330 | if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
| 325 | 331 | { |
@@ -35,22 +35,22 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | global $wpdb; |
| 37 | 37 | |
| 38 | - if(version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) |
|
| 38 | + if (version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) |
|
| 39 | 39 | { |
| 40 | - wp_die('<p>'.sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s"),Xcloner_Activator::xcloner_minimum_version, phpversion()).'</p>', __("XCloner Activation Error"), array( 'response'=>500, 'back_link'=>TRUE ) ); |
|
| 40 | + wp_die('<p>'.sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s"), Xcloner_Activator::xcloner_minimum_version, phpversion()).'</p>', __("XCloner Activation Error"), array('response'=>500, 'back_link'=>TRUE)); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $charset_collate = $wpdb->get_charset_collate(); |
| 44 | 44 | |
| 45 | - $installed_ver = get_option( "xcloner_db_version" ); |
|
| 45 | + $installed_ver = get_option("xcloner_db_version"); |
|
| 46 | 46 | |
| 47 | 47 | $xcloner_db_version = Xcloner_Activator::xcloner_db_version; |
| 48 | 48 | |
| 49 | - $xcloner_scheduler_table = $wpdb->prefix . "xcloner_scheduler"; |
|
| 49 | + $xcloner_scheduler_table = $wpdb->prefix."xcloner_scheduler"; |
|
| 50 | 50 | |
| 51 | - if($installed_ver != $xcloner_db_version) |
|
| 51 | + if ($installed_ver != $xcloner_db_version) |
|
| 52 | 52 | { |
| 53 | - $xcloner_schedule_sql="CREATE TABLE `".$xcloner_scheduler_table."` ( |
|
| 53 | + $xcloner_schedule_sql = "CREATE TABLE `".$xcloner_scheduler_table."` ( |
|
| 54 | 54 | `id` int(11) NOT NULL AUTO_INCREMENT, |
| 55 | 55 | `name` varchar(255) NOT NULL, |
| 56 | 56 | `recurrence` varchar(10) NOT NULL, |
@@ -64,49 +64,49 @@ discard block |
||
| 64 | 64 | ) ".$charset_collate."; |
| 65 | 65 | "; |
| 66 | 66 | |
| 67 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
| 68 | - dbDelta( $xcloner_schedule_sql ); |
|
| 67 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
| 68 | + dbDelta($xcloner_schedule_sql); |
|
| 69 | 69 | |
| 70 | - update_option( "xcloner_db_version", $xcloner_db_version ); |
|
| 70 | + update_option("xcloner_db_version", $xcloner_db_version); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if(!get_option('xcloner_backup_compression_level')) |
|
| 73 | + if (!get_option('xcloner_backup_compression_level')) |
|
| 74 | 74 | update_option('xcloner_backup_compression_level', 0); |
| 75 | 75 | |
| 76 | - if(!get_option('xcloner_enable_log')) |
|
| 76 | + if (!get_option('xcloner_enable_log')) |
|
| 77 | 77 | update_option('xcloner_enable_log', 1); |
| 78 | 78 | |
| 79 | - if(!get_option('xcloner_enable_mysql_backup')) |
|
| 79 | + if (!get_option('xcloner_enable_mysql_backup')) |
|
| 80 | 80 | update_option('xcloner_enable_mysql_backup', 1); |
| 81 | 81 | |
| 82 | - if(!get_option('xcloner_system_settings_page')) |
|
| 82 | + if (!get_option('xcloner_system_settings_page')) |
|
| 83 | 83 | update_option('xcloner_system_settings_page', 100); |
| 84 | 84 | |
| 85 | - if(!get_option('xcloner_files_to_process_per_request')) |
|
| 85 | + if (!get_option('xcloner_files_to_process_per_request')) |
|
| 86 | 86 | update_option('xcloner_files_to_process_per_request', 250); |
| 87 | 87 | |
| 88 | - if(!get_option('xcloner_database_records_per_request')) |
|
| 88 | + if (!get_option('xcloner_database_records_per_request')) |
|
| 89 | 89 | update_option('xcloner_database_records_per_request', 10000); |
| 90 | 90 | |
| 91 | - if(!get_option('xcloner_exclude_files_larger_than_mb')) |
|
| 91 | + if (!get_option('xcloner_exclude_files_larger_than_mb')) |
|
| 92 | 92 | update_option('xcloner_exclude_files_larger_than_mb', 0); |
| 93 | 93 | |
| 94 | - if(!get_option('xcloner_split_backup_limit')) |
|
| 94 | + if (!get_option('xcloner_split_backup_limit')) |
|
| 95 | 95 | update_option('xcloner_split_backup_limit', 2048); |
| 96 | 96 | |
| 97 | - if(!get_option('xcloner_size_limit_per_request')) |
|
| 97 | + if (!get_option('xcloner_size_limit_per_request')) |
|
| 98 | 98 | update_option('xcloner_size_limit_per_request', 50); |
| 99 | 99 | |
| 100 | - if(!get_option('xcloner_cleanup_retention_limit_days')) |
|
| 100 | + if (!get_option('xcloner_cleanup_retention_limit_days')) |
|
| 101 | 101 | update_option('xcloner_cleanup_retention_limit_days', 60); |
| 102 | 102 | |
| 103 | - if(!get_option('xcloner_cleanup_retention_limit_archives')) |
|
| 103 | + if (!get_option('xcloner_cleanup_retention_limit_archives')) |
|
| 104 | 104 | update_option('xcloner_cleanup_retention_limit_archives', 100); |
| 105 | 105 | |
| 106 | - if(!get_option('xcloner_directories_to_scan_per_request')) |
|
| 106 | + if (!get_option('xcloner_directories_to_scan_per_request')) |
|
| 107 | 107 | update_option('xcloner_directories_to_scan_per_request', 25); |
| 108 | 108 | |
| 109 | - if(!get_option('xcloner_regex_exclude')) |
|
| 109 | + if (!get_option('xcloner_regex_exclude')) |
|
| 110 | 110 | update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$"); |
| 111 | 111 | |
| 112 | 112 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | use splitbrain\PHPArchive\FileInfo; |
| 12 | 12 | |
| 13 | 13 | |
| 14 | -class Xcloner_Api{ |
|
| 14 | +class Xcloner_Api { |
|
| 15 | 15 | |
| 16 | 16 | private $xcloner_database; |
| 17 | 17 | private $xcloner_settings; |
@@ -28,26 +28,26 @@ discard block |
||
| 28 | 28 | global $wpdb; |
| 29 | 29 | |
| 30 | 30 | error_reporting(0); |
| 31 | - if( ob_get_length() ) |
|
| 31 | + if (ob_get_length()) |
|
| 32 | 32 | ob_end_clean(); |
| 33 | 33 | ob_start(); |
| 34 | 34 | |
| 35 | - $wpdb->show_errors = false; |
|
| 35 | + $wpdb->show_errors = false; |
|
| 36 | 36 | |
| 37 | 37 | $this->xcloner_container = $xcloner_container; |
| 38 | 38 | |
| 39 | 39 | $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
| 40 | - $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_api"); |
|
| 40 | + $this->logger = $xcloner_container->get_xcloner_logger()->withName("xcloner_api"); |
|
| 41 | 41 | $this->xcloner_file_system = $xcloner_container->get_xcloner_filesystem(); |
| 42 | 42 | $this->xcloner_sanitization = $xcloner_container->get_xcloner_sanitization(); |
| 43 | 43 | $this->xcloner_requirements = $xcloner_container->get_xcloner_requirements(); |
| 44 | - $this->archive_system = $xcloner_container->get_archive_system(); |
|
| 45 | - $this->xcloner_database = $xcloner_container->get_xcloner_database(); |
|
| 46 | - $this->xcloner_scheduler = $xcloner_container->get_xcloner_scheduler(); |
|
| 44 | + $this->archive_system = $xcloner_container->get_archive_system(); |
|
| 45 | + $this->xcloner_database = $xcloner_container->get_xcloner_database(); |
|
| 46 | + $this->xcloner_scheduler = $xcloner_container->get_xcloner_scheduler(); |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | - if(isset($_POST['API_ID'])){ |
|
| 50 | - $this->logger->info("Processing ajax request ID ".substr($this->xcloner_sanitization->sanitize_input_as_string($_POST['API_ID']), 0 , 15)); |
|
| 49 | + if (isset($_POST['API_ID'])) { |
|
| 50 | + $this->logger->info("Processing ajax request ID ".substr($this->xcloner_sanitization->sanitize_input_as_string($_POST['API_ID']), 0, 15)); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | } |
@@ -75,15 +75,15 @@ discard block |
||
| 75 | 75 | $data['dbDatabase'] = $this->xcloner_settings->get_db_database(); |
| 76 | 76 | |
| 77 | 77 | |
| 78 | - $data['recordsPerSession'] = $this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request'); |
|
| 79 | - $data['TEMP_DBPROCESS_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path().DS.".database"; |
|
| 80 | - $data['TEMP_DUMP_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path().DS."database-sql.sql"; |
|
| 78 | + $data['recordsPerSession'] = $this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request'); |
|
| 79 | + $data['TEMP_DBPROCESS_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path().DS.".database"; |
|
| 80 | + $data['TEMP_DUMP_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path().DS."database-sql.sql"; |
|
| 81 | 81 | |
| 82 | 82 | try |
| 83 | 83 | { |
| 84 | 84 | $this->xcloner_database->init($data); |
| 85 | 85 | |
| 86 | - }catch(Exception $e){ |
|
| 86 | + }catch (Exception $e) { |
|
| 87 | 87 | |
| 88 | 88 | $this->send_response($e->getMessage()); |
| 89 | 89 | $this->logger->error($e->getMessage()); |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | $schedule = array(); |
| 111 | 111 | $response = array(); |
| 112 | 112 | |
| 113 | - if(isset($_POST['data'])) |
|
| 113 | + if (isset($_POST['data'])) |
|
| 114 | 114 | $params = json_decode(stripslashes($_POST['data'])); |
| 115 | 115 | |
| 116 | 116 | $this->process_params($params); |
| 117 | 117 | |
| 118 | - if(isset($_POST['id'])) |
|
| 118 | + if (isset($_POST['id'])) |
|
| 119 | 119 | { |
| 120 | 120 | |
| 121 | 121 | $this->form_params['backup_params']['backup_name'] = $this->xcloner_sanitization->sanitize_input_as_string($_POST['backup_name']); |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | $tables = explode(PHP_EOL, $this->form_params['database']); |
| 131 | 131 | $return = array(); |
| 132 | 132 | |
| 133 | - foreach($tables as $table) |
|
| 133 | + foreach ($tables as $table) |
|
| 134 | 134 | { |
| 135 | - $table = str_replace("\r","", $table); |
|
| 135 | + $table = str_replace("\r", "", $table); |
|
| 136 | 136 | $data = explode(".", $table); |
| 137 | - if(isset($data[1])) |
|
| 137 | + if (isset($data[1])) |
|
| 138 | 138 | $return[$data[0]][] = $data[1]; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | $excluded_files = explode(PHP_EOL, $this->form_params['excluded_files']); |
| 144 | 144 | $return = array(); |
| 145 | 145 | |
| 146 | - foreach($excluded_files as $file) |
|
| 146 | + foreach ($excluded_files as $file) |
|
| 147 | 147 | { |
| 148 | - $file = str_replace("\r","", $file); |
|
| 149 | - if($file) |
|
| 148 | + $file = str_replace("\r", "", $file); |
|
| 149 | + if ($file) |
|
| 150 | 150 | $return[] = $file; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -154,22 +154,22 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $schedule['start_at'] = $this->form_params['backup_params']['start_at']; |
| 156 | 156 | |
| 157 | - if(!isset($_POST['status'])) |
|
| 157 | + if (!isset($_POST['status'])) |
|
| 158 | 158 | $schedule['status'] = 0; |
| 159 | 159 | else |
| 160 | 160 | $schedule['status'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['status']); |
| 161 | - }else{ |
|
| 161 | + } else { |
|
| 162 | 162 | |
| 163 | 163 | $schedule['status'] = 1; |
| 164 | - $schedule['start_at'] = strtotime($this->form_params['backup_params']['schedule_start_date'] . |
|
| 164 | + $schedule['start_at'] = strtotime($this->form_params['backup_params']['schedule_start_date']. |
|
| 165 | 165 | " ".$this->form_params['backup_params']['schedule_start_time']); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if(!$schedule['start_at']) |
|
| 168 | + if (!$schedule['start_at']) |
|
| 169 | 169 | { |
| 170 | 170 | $schedule['start_at'] = date('Y-m-d H:i:s', time()); |
| 171 | - }else{ |
|
| 172 | - $schedule['start_at'] = date('Y-m-d H:i:s', $schedule['start_at'] - (get_option( 'gmt_offset' ) * HOUR_IN_SECONDS) ); |
|
| 171 | + } else { |
|
| 172 | + $schedule['start_at'] = date('Y-m-d H:i:s', $schedule['start_at'] - (get_option('gmt_offset') * HOUR_IN_SECONDS)); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $schedule['name'] = $this->form_params['backup_params']['schedule_name']; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $schedule['params'] = json_encode($this->form_params); |
| 180 | 180 | |
| 181 | - if(!isset($_POST['id'])) |
|
| 181 | + if (!isset($_POST['id'])) |
|
| 182 | 182 | { |
| 183 | 183 | $wpdb->insert( |
| 184 | 184 | $wpdb->prefix.'xcloner_scheduler', |
@@ -188,21 +188,21 @@ discard block |
||
| 188 | 188 | '%s' |
| 189 | 189 | ) |
| 190 | 190 | ); |
| 191 | - }else { |
|
| 191 | + } else { |
|
| 192 | 192 | $wpdb->update( |
| 193 | 193 | $wpdb->prefix.'xcloner_scheduler', |
| 194 | 194 | $schedule, |
| 195 | - array( 'id' => $_POST['id'] ), |
|
| 195 | + array('id' => $_POST['id']), |
|
| 196 | 196 | array( |
| 197 | 197 | '%s', |
| 198 | 198 | '%s' |
| 199 | 199 | ) |
| 200 | 200 | ); |
| 201 | 201 | } |
| 202 | - if(isset($_POST['id'])) |
|
| 202 | + if (isset($_POST['id'])) |
|
| 203 | 203 | $scheduler->update_cron_hook($_POST['id']); |
| 204 | 204 | |
| 205 | - if( $wpdb->last_error ) { |
|
| 205 | + if ($wpdb->last_error) { |
|
| 206 | 206 | $response['error'] = 1; |
| 207 | 207 | $response['error_message'] = $wpdb->last_error/*."--".$wpdb->last_query*/; |
| 208 | 208 | |
@@ -225,19 +225,19 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | $params = json_decode(stripslashes($_POST['data'])); |
| 227 | 227 | |
| 228 | - $init = (int)$_POST['init']; |
|
| 228 | + $init = (int)$_POST['init']; |
|
| 229 | 229 | |
| 230 | - if($params === NULL) |
|
| 231 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
| 230 | + if ($params === NULL) |
|
| 231 | + die('{"status":false,"msg":"The post_data parameter must be valid JSON"}'); |
|
| 232 | 232 | |
| 233 | 233 | $this->process_params($params); |
| 234 | 234 | |
| 235 | 235 | $return['finished'] = 1; |
| 236 | 236 | |
| 237 | 237 | //$return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'], $this->form_params['extra'], $init); |
| 238 | - try{ |
|
| 238 | + try { |
|
| 239 | 239 | $return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'], $this->form_params['extra'], $init); |
| 240 | - }catch(Exception $e) |
|
| 240 | + }catch (Exception $e) |
|
| 241 | 241 | { |
| 242 | 242 | $return = array(); |
| 243 | 243 | $return['error'] = true; |
@@ -246,26 +246,26 @@ discard block |
||
| 246 | 246 | return $this->send_response($return, $hash = 1); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if($return['finished']) |
|
| 249 | + if ($return['finished']) |
|
| 250 | 250 | { |
| 251 | 251 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 252 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 252 | + if ($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 253 | 253 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | $data = $return; |
| 257 | 257 | |
| 258 | 258 | //check if backup is finished |
| 259 | - if($return['finished'] ) |
|
| 259 | + if ($return['finished']) |
|
| 260 | 260 | { |
| 261 | - if(isset($this->form_params['backup_params']['email_notification']) and $to=$this->form_params['backup_params']['email_notification']) |
|
| 261 | + if (isset($this->form_params['backup_params']['email_notification']) and $to = $this->form_params['backup_params']['email_notification']) |
|
| 262 | 262 | { |
| 263 | - try{ |
|
| 263 | + try { |
|
| 264 | 264 | $from = ""; |
| 265 | 265 | $subject = ""; |
| 266 | 266 | $additional['lines_total'] = $return['extra']['lines_total']; |
| 267 | - $this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $this->form_params,"", $additional); |
|
| 268 | - }catch(Exception $e) |
|
| 267 | + $this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $this->form_params, "", $additional); |
|
| 268 | + }catch (Exception $e) |
|
| 269 | 269 | { |
| 270 | 270 | $this->logger->error($e->getMessage()); |
| 271 | 271 | } |
@@ -287,17 +287,17 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | $params = json_decode(stripslashes($_POST['data'])); |
| 289 | 289 | |
| 290 | - $init = (int)$_POST['init']; |
|
| 290 | + $init = (int)$_POST['init']; |
|
| 291 | 291 | |
| 292 | - if($params === NULL) |
|
| 293 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
| 292 | + if ($params === NULL) |
|
| 293 | + die('{"status":false,"msg":"The post_data parameter must be valid JSON"}'); |
|
| 294 | 294 | |
| 295 | 295 | $this->process_params($params); |
| 296 | 296 | |
| 297 | 297 | //$xcloner_database = $this->init_db(); |
| 298 | 298 | $return = $this->xcloner_database->start_database_recursion($this->form_params['database'], $this->form_params['extra'], $init); |
| 299 | 299 | |
| 300 | - if(isset($return['error']) and $return['error']) |
|
| 300 | + if (isset($return['error']) and $return['error']) |
|
| 301 | 301 | $data['finished'] = 1; |
| 302 | 302 | else |
| 303 | 303 | $data['finished'] = $return['finished']; |
@@ -317,10 +317,10 @@ discard block |
||
| 317 | 317 | $this->check_access(); |
| 318 | 318 | |
| 319 | 319 | $params = json_decode(stripslashes($_POST['data'])); |
| 320 | - $init = (int)$_POST['init']; |
|
| 320 | + $init = (int)$_POST['init']; |
|
| 321 | 321 | |
| 322 | - if($params === NULL) |
|
| 323 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
| 322 | + if ($params === NULL) |
|
| 323 | + die('{"status":false,"msg":"The post_data parameter must be valid JSON"}'); |
|
| 324 | 324 | |
| 325 | 325 | $hash = $this->process_params($params); |
| 326 | 326 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $data["finished"] = !$return; |
| 332 | 332 | $data["total_files_num"] = $this->xcloner_file_system->get_scanned_files_num(); |
| 333 | 333 | $data["last_logged_file"] = $this->xcloner_file_system->last_logged_file(); |
| 334 | - $data["total_files_size"] = sprintf("%.2f",$this->xcloner_file_system->get_scanned_files_total_size()/(1024*1024)); |
|
| 334 | + $data["total_files_size"] = sprintf("%.2f", $this->xcloner_file_system->get_scanned_files_total_size() / (1024 * 1024)); |
|
| 335 | 335 | |
| 336 | 336 | return $this->send_response($data, $hash = 1); |
| 337 | 337 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | private function process_params($params) |
| 345 | 345 | { |
| 346 | - if(isset($params->hash)) |
|
| 346 | + if (isset($params->hash)) |
|
| 347 | 347 | $this->xcloner_settings->set_hash($params->hash); |
| 348 | 348 | |
| 349 | 349 | $this->form_params['extra'] = array(); |
@@ -351,9 +351,9 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | $this->form_params['database'] = array(); |
| 353 | 353 | |
| 354 | - if(isset($params->backup_params)) |
|
| 354 | + if (isset($params->backup_params)) |
|
| 355 | 355 | { |
| 356 | - foreach($params->backup_params as $param) |
|
| 356 | + foreach ($params->backup_params as $param) |
|
| 357 | 357 | { |
| 358 | 358 | $this->form_params['backup_params'][$param->name] = $this->xcloner_sanitization->sanitize_input_as_string($param->value); |
| 359 | 359 | $this->logger->debug("Adding form parameter ".$param->name.".".$param->value."\n", array('POST', 'fields filter')); |
@@ -362,28 +362,28 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | $this->form_params['database'] = array(); |
| 364 | 364 | |
| 365 | - if(isset($params->table_params)) |
|
| 365 | + if (isset($params->table_params)) |
|
| 366 | 366 | { |
| 367 | - foreach($params->table_params as $param) |
|
| 367 | + foreach ($params->table_params as $param) |
|
| 368 | 368 | { |
| 369 | 369 | $this->form_params['database'][$param->parent][] = $this->xcloner_sanitization->sanitize_input_as_raw($param->id); |
| 370 | 370 | $this->logger->debug("Adding database filter ".$param->parent.".".$param->id."\n", array('POST', 'database filter')); |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - $this->form_params['excluded_files'] = array(); |
|
| 375 | - if(isset($params->files_params)) |
|
| 374 | + $this->form_params['excluded_files'] = array(); |
|
| 375 | + if (isset($params->files_params)) |
|
| 376 | 376 | { |
| 377 | - foreach($params->files_params as $param) |
|
| 377 | + foreach ($params->files_params as $param) |
|
| 378 | 378 | { |
| 379 | 379 | $this->form_params['excluded_files'][] = $this->xcloner_sanitization->sanitize_input_as_relative_path($param->id); |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | $unique_exclude_files = array(); |
| 383 | 383 | |
| 384 | - foreach($params->files_params as $key=>$param) |
|
| 384 | + foreach ($params->files_params as $key=>$param) |
|
| 385 | 385 | { |
| 386 | - if(!in_array($param->parent, $this->form_params['excluded_files'])){ |
|
| 386 | + if (!in_array($param->parent, $this->form_params['excluded_files'])) { |
|
| 387 | 387 | //$this->form_params['excluded_files'][] = $this->xcloner_sanitization->sanitize_input_as_relative_path($param->id); |
| 388 | 388 | $unique_exclude_files[] = $param->id; |
| 389 | 389 | $this->logger->debug("Adding file filter ".$param->id."\n", array('POST', 'exclude files filter')); |
@@ -395,9 +395,9 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | //$this->form_params['excluded_files'] = array_merge($this->form_params['excluded_files'], $this->exclude_files_by_default); |
| 397 | 397 | |
| 398 | - if(isset($params->extra)) |
|
| 398 | + if (isset($params->extra)) |
|
| 399 | 399 | { |
| 400 | - foreach($params->extra as $key=>$value) |
|
| 400 | + foreach ($params->extra as $key=>$value) |
|
| 401 | 401 | $this->form_params['extra'][$key] = $this->xcloner_sanitization->sanitize_input_as_raw($value); |
| 402 | 402 | } |
| 403 | 403 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | $data = array(); |
| 419 | 419 | |
| 420 | - if($folder == "#"){ |
|
| 420 | + if ($folder == "#") { |
|
| 421 | 421 | |
| 422 | 422 | $folder = "/"; |
| 423 | 423 | $data[] = array( |
@@ -430,9 +430,9 @@ discard block |
||
| 430 | 430 | ); |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - try{ |
|
| 433 | + try { |
|
| 434 | 434 | $files = $this->xcloner_file_system->list_directory($folder); |
| 435 | - }catch(Exception $e){ |
|
| 435 | + }catch (Exception $e) { |
|
| 436 | 436 | |
| 437 | 437 | print $e->getMessage(); |
| 438 | 438 | $this->logger->error($e->getMessage()); |
@@ -447,17 +447,17 @@ discard block |
||
| 447 | 447 | } |
| 448 | 448 | array_multisort($type, SORT_ASC, $files); |
| 449 | 449 | |
| 450 | - foreach($files as $file) |
|
| 450 | + foreach ($files as $file) |
|
| 451 | 451 | { |
| 452 | 452 | $children = false; |
| 453 | 453 | $text = $file['basename']; |
| 454 | 454 | |
| 455 | - if($file['type'] == "dir") |
|
| 455 | + if ($file['type'] == "dir") |
|
| 456 | 456 | $children = true; |
| 457 | 457 | else |
| 458 | - $text .= " (". $this->xcloner_requirements->file_format_size($file['size']).")"; |
|
| 458 | + $text .= " (".$this->xcloner_requirements->file_format_size($file['size']).")"; |
|
| 459 | 459 | |
| 460 | - if($this->xcloner_file_system->is_excluded($file)) |
|
| 460 | + if ($this->xcloner_file_system->is_excluded($file)) |
|
| 461 | 461 | $selected = true; |
| 462 | 462 | else |
| 463 | 463 | $selected = false; |
@@ -492,25 +492,25 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | $xcloner_backup_only_wp_tables = $this->xcloner_settings->get_xcloner_option('xcloner_backup_only_wp_tables'); |
| 494 | 494 | |
| 495 | - if($database == "#") |
|
| 495 | + if ($database == "#") |
|
| 496 | 496 | { |
| 497 | - try{ |
|
| 497 | + try { |
|
| 498 | 498 | $return = $this->xcloner_database->get_all_databases(); |
| 499 | - }catch(Exception $e){ |
|
| 499 | + }catch (Exception $e) { |
|
| 500 | 500 | $this->logger->error($e->getMessage()); |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - foreach($return as $database) |
|
| 503 | + foreach ($return as $database) |
|
| 504 | 504 | { |
| 505 | - if($xcloner_backup_only_wp_tables and $database['name'] != $this->xcloner_settings->get_db_database()) |
|
| 505 | + if ($xcloner_backup_only_wp_tables and $database['name'] != $this->xcloner_settings->get_db_database()) |
|
| 506 | 506 | continue; |
| 507 | 507 | |
| 508 | 508 | $state = array(); |
| 509 | 509 | |
| 510 | - if($database['name'] == $this->xcloner_settings->get_db_database()) |
|
| 510 | + if ($database['name'] == $this->xcloner_settings->get_db_database()) |
|
| 511 | 511 | { |
| 512 | 512 | $state['selected'] = true; |
| 513 | - if($database['num_tables'] < 25) |
|
| 513 | + if ($database['num_tables'] < 25) |
|
| 514 | 514 | $state['opened'] = false; |
| 515 | 515 | } |
| 516 | 516 | |
@@ -526,22 +526,22 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - else{ |
|
| 529 | + else { |
|
| 530 | 530 | |
| 531 | - try{ |
|
| 531 | + try { |
|
| 532 | 532 | $return = $this->xcloner_database->list_tables($database, "", 1); |
| 533 | - }catch(Exception $e){ |
|
| 533 | + }catch (Exception $e) { |
|
| 534 | 534 | $this->logger->error($e->getMessage()); |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - foreach($return as $table) |
|
| 537 | + foreach ($return as $table) |
|
| 538 | 538 | { |
| 539 | 539 | $state = array(); |
| 540 | 540 | |
| 541 | - if($xcloner_backup_only_wp_tables and !stristr($table['name'], $this->xcloner_settings->get_table_prefix())) |
|
| 541 | + if ($xcloner_backup_only_wp_tables and !stristr($table['name'], $this->xcloner_settings->get_table_prefix())) |
|
| 542 | 542 | continue; |
| 543 | 543 | |
| 544 | - if(isset($database['name']) and $database['name'] == $this->xcloner_settings->get_db_database()) |
|
| 544 | + if (isset($database['name']) and $database['name'] == $this->xcloner_settings->get_db_database()) |
|
| 545 | 545 | $state = array('selected' => true); |
| 546 | 546 | |
| 547 | 547 | $data[] = array( |
@@ -569,9 +569,9 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | $schedule_id = $this->xcloner_sanitization->sanitize_input_as_int($_GET['id']); |
| 571 | 571 | $scheduler = $this->xcloner_scheduler; |
| 572 | - $data = $scheduler->get_schedule_by_id($schedule_id); |
|
| 572 | + $data = $scheduler->get_schedule_by_id($schedule_id); |
|
| 573 | 573 | |
| 574 | - $data['start_at'] = date("Y-m-d H:i", strtotime($data['start_at']) + (get_option( 'gmt_offset' ) * HOUR_IN_SECONDS)); |
|
| 574 | + $data['start_at'] = date("Y-m-d H:i", strtotime($data['start_at']) + (get_option('gmt_offset') * HOUR_IN_SECONDS)); |
|
| 575 | 575 | |
| 576 | 576 | return $this->send_response($data); |
| 577 | 577 | } |
@@ -586,14 +586,14 @@ discard block |
||
| 586 | 586 | $this->check_access(); |
| 587 | 587 | |
| 588 | 588 | $scheduler = $this->xcloner_scheduler; |
| 589 | - $data = $scheduler->get_scheduler_list(); |
|
| 589 | + $data = $scheduler->get_scheduler_list(); |
|
| 590 | 590 | $return['data'] = array(); |
| 591 | 591 | |
| 592 | - foreach($data as $res) |
|
| 592 | + foreach ($data as $res) |
|
| 593 | 593 | { |
| 594 | 594 | $action = "<a href=\"#".$res->id."\" class=\"edit\" title='Edit'> <i class=\"material-icons \">edit</i></a> |
| 595 | 595 | <a href=\"#".$res->id."\" class=\"delete\" title='Delete'><i class=\"material-icons \">delete</i></a>"; |
| 596 | - if($res->status) |
|
| 596 | + if ($res->status) |
|
| 597 | 597 | $status = '<i class="material-icons active status">timer</i>'; |
| 598 | 598 | else |
| 599 | 599 | $status = '<i class="material-icons status inactive">timer_off</i>'; |
@@ -604,14 +604,14 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | $remote_storage = $res->remote_storage; |
| 606 | 606 | |
| 607 | - if(!$next_run_time >= time()) |
|
| 607 | + if (!$next_run_time >= time()) |
|
| 608 | 608 | $next_run = " "; |
| 609 | 609 | |
| 610 | - if(trim($next_run)) |
|
| 610 | + if (trim($next_run)) |
|
| 611 | 611 | { |
| 612 | - $date_text = date(get_option('date_format')." ".get_option('time_format'), $next_run_time + (get_option( 'gmt_offset' ) * HOUR_IN_SECONDS)); |
|
| 612 | + $date_text = date(get_option('date_format')." ".get_option('time_format'), $next_run_time + (get_option('gmt_offset') * HOUR_IN_SECONDS)); |
|
| 613 | 613 | |
| 614 | - if($next_run_time >= time()) |
|
| 614 | + if ($next_run_time >= time()) |
|
| 615 | 615 | $next_run = "in ".human_time_diff($next_run_time, time()); |
| 616 | 616 | else |
| 617 | 617 | $next_run = __("executed", 'xcloner-backup-and-restore'); |
@@ -624,19 +624,19 @@ discard block |
||
| 624 | 624 | $backup_size = ""; |
| 625 | 625 | $backup_time = ""; |
| 626 | 626 | |
| 627 | - if($res->last_backup) |
|
| 627 | + if ($res->last_backup) |
|
| 628 | 628 | { |
| 629 | - if( $this->xcloner_file_system->get_storage_filesystem()->has($res->last_backup)) |
|
| 629 | + if ($this->xcloner_file_system->get_storage_filesystem()->has($res->last_backup)) |
|
| 630 | 630 | { |
| 631 | 631 | $metadata = $this->xcloner_file_system->get_storage_filesystem()->getMetadata($res->last_backup); |
| 632 | 632 | $backup_size = size_format($this->xcloner_file_system->get_backup_size($res->last_backup)); |
| 633 | - $backup_time = date(get_option('date_format')." ".get_option('time_format'), $metadata['timestamp']+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS)); |
|
| 633 | + $backup_time = date(get_option('date_format')." ".get_option('time_format'), $metadata['timestamp'] + (get_option('gmt_offset') * HOUR_IN_SECONDS)); |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | $backup_text = "<span title='".$backup_time."' class='shorten_string'>".$res->last_backup." (".$backup_size.")</span>"; |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - $return['data'][] = array($res->id, $res->name, $res->recurrence,/*$res->start_at,*/ $next_run, $remote_storage, $backup_text, $status, $action); |
|
| 639 | + $return['data'][] = array($res->id, $res->name, $res->recurrence, /*$res->start_at,*/ $next_run, $remote_storage, $backup_text, $status, $action); |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | return $this->send_response($return, 0); |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | |
| 654 | 654 | $schedule_id = $this->xcloner_sanitization->sanitize_input_as_int($_GET['id']); |
| 655 | 655 | $scheduler = $this->xcloner_scheduler; |
| 656 | - $data['finished'] = $scheduler->delete_schedule_by_id($schedule_id); |
|
| 656 | + $data['finished'] = $scheduler->delete_schedule_by_id($schedule_id); |
|
| 657 | 657 | |
| 658 | 658 | return $this->send_response($data); |
| 659 | 659 | } |
@@ -687,32 +687,32 @@ discard block |
||
| 687 | 687 | |
| 688 | 688 | $backup_file = $source_backup_file; |
| 689 | 689 | |
| 690 | - if($this->xcloner_file_system->is_multipart($backup_file)) |
|
| 690 | + if ($this->xcloner_file_system->is_multipart($backup_file)) |
|
| 691 | 691 | { |
| 692 | 692 | $backup_parts = $this->xcloner_file_system->get_multipart_files($backup_file); |
| 693 | 693 | $backup_file = $backup_parts[$return['part']]; |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | - try{ |
|
| 696 | + try { |
|
| 697 | 697 | $tar = new Tar(); |
| 698 | 698 | $tar->open($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file, $start); |
| 699 | 699 | |
| 700 | 700 | $data = $tar->contents(get_option('xcloner_files_to_process_per_request')); |
| 701 | - }catch(Exception $e) |
|
| 701 | + }catch (Exception $e) |
|
| 702 | 702 | { |
| 703 | 703 | $return['error'] = true; |
| 704 | 704 | $return['message'] = $e->getMessage(); |
| 705 | 705 | $this->send_response($return, 0); |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | - $return['files'] = array(); |
|
| 709 | - $return['finished'] = 1; |
|
| 710 | - $return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file); |
|
| 708 | + $return['files'] = array(); |
|
| 709 | + $return['finished'] = 1; |
|
| 710 | + $return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file); |
|
| 711 | 711 | $i = 0; |
| 712 | 712 | |
| 713 | - if(isset($data['extracted_files']) and is_array($data['extracted_files'])) |
|
| 713 | + if (isset($data['extracted_files']) and is_array($data['extracted_files'])) |
|
| 714 | 714 | { |
| 715 | - foreach($data['extracted_files'] as $file) |
|
| 715 | + foreach ($data['extracted_files'] as $file) |
|
| 716 | 716 | { |
| 717 | 717 | $return['files'][$i]['path'] = $file->getPath(); |
| 718 | 718 | $return['files'][$i]['size'] = $file->getSize(); |
@@ -722,18 +722,18 @@ discard block |
||
| 722 | 722 | } |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | - if(isset($data['start'])) |
|
| 725 | + if (isset($data['start'])) |
|
| 726 | 726 | { |
| 727 | 727 | $return['start'] = $data['start']; |
| 728 | 728 | $return['finished'] = 0; |
| 729 | - }else{ |
|
| 730 | - if($this->xcloner_file_system->is_multipart($source_backup_file)) |
|
| 729 | + } else { |
|
| 730 | + if ($this->xcloner_file_system->is_multipart($source_backup_file)) |
|
| 731 | 731 | { |
| 732 | 732 | $return['start'] = 0; |
| 733 | 733 | |
| 734 | 734 | ++$return['part']; |
| 735 | 735 | |
| 736 | - if($return['part'] < sizeof($backup_parts)) |
|
| 736 | + if ($return['part'] < sizeof($backup_parts)) |
|
| 737 | 737 | $return['finished'] = 0; |
| 738 | 738 | |
| 739 | 739 | } |
@@ -756,17 +756,17 @@ discard block |
||
| 756 | 756 | |
| 757 | 757 | try |
| 758 | 758 | { |
| 759 | - if(method_exists($xcloner_remote_storage, "copy_backup_remote_to_local")) |
|
| 759 | + if (method_exists($xcloner_remote_storage, "copy_backup_remote_to_local")) |
|
| 760 | 760 | { |
| 761 | 761 | $return = call_user_func_array(array($xcloner_remote_storage, "copy_backup_remote_to_local"), array($backup_file, $storage_type)); |
| 762 | 762 | } |
| 763 | - }catch(Exception $e){ |
|
| 763 | + }catch (Exception $e) { |
|
| 764 | 764 | |
| 765 | 765 | $return['error'] = 1; |
| 766 | 766 | $return['message'] = $e->getMessage(); |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | - if(!$return) |
|
| 769 | + if (!$return) |
|
| 770 | 770 | { |
| 771 | 771 | $return['error'] = 1; |
| 772 | 772 | $return['message'] = "Upload failed, please check the error log for more information!"; |
@@ -795,17 +795,17 @@ discard block |
||
| 795 | 795 | |
| 796 | 796 | try |
| 797 | 797 | { |
| 798 | - if(method_exists($xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 798 | + if (method_exists($xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 799 | 799 | { |
| 800 | 800 | $return = call_user_func_array(array($xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $storage_type)); |
| 801 | 801 | } |
| 802 | - }catch(Exception $e){ |
|
| 802 | + }catch (Exception $e) { |
|
| 803 | 803 | |
| 804 | 804 | $return['error'] = 1; |
| 805 | 805 | $return['message'] = $e->getMessage(); |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | - if(!$return) |
|
| 808 | + if (!$return) |
|
| 809 | 809 | { |
| 810 | 810 | $return['error'] = 1; |
| 811 | 811 | $return['message'] = "Upload failed, please check the error log for more information!"; |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | |
| 840 | 840 | @ob_end_clean(); |
| 841 | 841 | |
| 842 | - $adapter = new Local(dirname(__DIR__) ,LOCK_EX, 'SKIP_LINKS'); |
|
| 842 | + $adapter = new Local(dirname(__DIR__), LOCK_EX, 'SKIP_LINKS'); |
|
| 843 | 843 | $xcloner_plugin_filesystem = new Filesystem($adapter, new Config([ |
| 844 | 844 | 'disable_asserts' => true, |
| 845 | 845 | ])); |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | //$tar->addFile(dirname(__DIR__)."/restore/vendor.tgz", "vendor.tgz"); |
| 870 | 870 | |
| 871 | 871 | $files = $xcloner_plugin_filesystem->listContents("vendor/", true); |
| 872 | - foreach($files as $file) |
|
| 872 | + foreach ($files as $file) |
|
| 873 | 873 | { |
| 874 | 874 | $tar->addFile(dirname(__DIR__).DS.$file['path'], $file['path']); |
| 875 | 875 | } |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | header('Expires: 0'); |
| 889 | 889 | header('Cache-Control: must-revalidate'); |
| 890 | 890 | header('Pragma: public'); |
| 891 | - header('Content-Length: ' . filesize($tmp_file)); |
|
| 891 | + header('Content-Length: '.filesize($tmp_file)); |
|
| 892 | 892 | readfile($tmp_file); |
| 893 | 893 | |
| 894 | 894 | } |
@@ -911,8 +911,8 @@ discard block |
||
| 911 | 911 | $backup_name = $this->xcloner_sanitization->sanitize_input_as_string($_GET['name']); |
| 912 | 912 | |
| 913 | 913 | |
| 914 | - $metadata = $this->xcloner_file_system->get_storage_filesystem()->getMetadata($backup_name); |
|
| 915 | - $read_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($backup_name); |
|
| 914 | + $metadata = $this->xcloner_file_system->get_storage_filesystem()->getMetadata($backup_name); |
|
| 915 | + $read_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($backup_name); |
|
| 916 | 916 | |
| 917 | 917 | |
| 918 | 918 | header('Pragma: public'); |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | header('Content-Transfer-Encoding: binary'); |
| 923 | 923 | header('Content-Disposition: attachment; filename="'.$metadata['path'].'";'); |
| 924 | 924 | header('Content-Type: application/octet-stream'); |
| 925 | - header('Content-Length: ' . $metadata['size']); |
|
| 925 | + header('Content-Length: '.$metadata['size']); |
|
| 926 | 926 | |
| 927 | 927 | @ob_end_clean(); |
| 928 | 928 | |
@@ -950,10 +950,10 @@ discard block |
||
| 950 | 950 | $file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']); |
| 951 | 951 | $hash = $this->xcloner_sanitization->sanitize_input_as_string($_POST['hash']); |
| 952 | 952 | |
| 953 | - if(isset($_POST['part'])) |
|
| 953 | + if (isset($_POST['part'])) |
|
| 954 | 954 | $return['part'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['part']); |
| 955 | 955 | |
| 956 | - if(isset($_POST['uploaded_size'])) |
|
| 956 | + if (isset($_POST['uploaded_size'])) |
|
| 957 | 957 | $return['uploaded_size'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['uploaded_size']); |
| 958 | 958 | |
| 959 | 959 | $start = $this->xcloner_sanitization->sanitize_input_as_string($_POST['start']); |
@@ -961,46 +961,46 @@ discard block |
||
| 961 | 961 | |
| 962 | 962 | $return['total_size'] = $this->xcloner_file_system->get_backup_size($file); |
| 963 | 963 | |
| 964 | - if($this->xcloner_file_system->is_multipart($file)) |
|
| 964 | + if ($this->xcloner_file_system->is_multipart($file)) |
|
| 965 | 965 | { |
| 966 | 966 | $backup_parts = $this->xcloner_file_system->get_multipart_files($file); |
| 967 | 967 | |
| 968 | - $return['total_parts'] = sizeof($backup_parts)+1; |
|
| 968 | + $return['total_parts'] = sizeof($backup_parts) + 1; |
|
| 969 | 969 | |
| 970 | - if($return['part'] and isset($backup_parts[$return['part']-1])) |
|
| 970 | + if ($return['part'] and isset($backup_parts[$return['part'] - 1])) |
|
| 971 | 971 | { |
| 972 | - $file = $backup_parts[$return['part']-1]; |
|
| 972 | + $file = $backup_parts[$return['part'] - 1]; |
|
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | $is_multipart = 1; |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | - try{ |
|
| 978 | + try { |
|
| 979 | 979 | |
| 980 | 980 | $xcloner_file_transfer = $this->get_xcloner_container()->get_xcloner_file_transfer(); |
| 981 | 981 | $xcloner_file_transfer->set_target($target_url); |
| 982 | 982 | $return['start'] = $xcloner_file_transfer->transfer_file($file, $start, $hash); |
| 983 | 983 | |
| 984 | - }catch(Exception $e){ |
|
| 984 | + }catch (Exception $e) { |
|
| 985 | 985 | |
| 986 | 986 | $return = array(); |
| 987 | 987 | $return['error'] = true; |
| 988 | 988 | $return['status'] = 500; |
| 989 | 989 | $return['message'] = "CURL communication error with the restore host. ".$e->getMessage(); |
| 990 | - $this->send_response( $return, 0); |
|
| 990 | + $this->send_response($return, 0); |
|
| 991 | 991 | |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | $return['status'] = 200; |
| 995 | 995 | |
| 996 | 996 | //we have finished the upload |
| 997 | - if(!$return['start'] and $is_multipart) |
|
| 997 | + if (!$return['start'] and $is_multipart) |
|
| 998 | 998 | { |
| 999 | 999 | $return['part']++; |
| 1000 | 1000 | $return['uploaded_size'] += $this->xcloner_file_system->get_storage_filesystem()->getSize($file); |
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | - $this->send_response( $return, 0); |
|
| 1003 | + $this->send_response($return, 0); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | /* |
| 1006 | 1006 | * |
@@ -1010,12 +1010,12 @@ discard block |
||
| 1010 | 1010 | private function send_response($data, $attach_hash = 1) |
| 1011 | 1011 | { |
| 1012 | 1012 | |
| 1013 | - if($attach_hash and null !== $this->xcloner_settings->get_hash()) |
|
| 1013 | + if ($attach_hash and null !== $this->xcloner_settings->get_hash()) |
|
| 1014 | 1014 | { |
| 1015 | 1015 | $data['hash'] = $this->xcloner_settings->get_hash(); |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | - if( ob_get_length() ) |
|
| 1018 | + if (ob_get_length()) |
|
| 1019 | 1019 | ob_clean(); |
| 1020 | 1020 | wp_send_json($data); |
| 1021 | 1021 | |
@@ -28,8 +28,9 @@ discard block |
||
| 28 | 28 | global $wpdb; |
| 29 | 29 | |
| 30 | 30 | error_reporting(0); |
| 31 | - if( ob_get_length() ) |
|
| 32 | - ob_end_clean(); |
|
| 31 | + if( ob_get_length() ) { |
|
| 32 | + ob_end_clean(); |
|
| 33 | + } |
|
| 33 | 34 | ob_start(); |
| 34 | 35 | |
| 35 | 36 | $wpdb->show_errors = false; |
@@ -83,7 +84,7 @@ discard block |
||
| 83 | 84 | { |
| 84 | 85 | $this->xcloner_database->init($data); |
| 85 | 86 | |
| 86 | - }catch(Exception $e){ |
|
| 87 | + } catch(Exception $e){ |
|
| 87 | 88 | |
| 88 | 89 | $this->send_response($e->getMessage()); |
| 89 | 90 | $this->logger->error($e->getMessage()); |
@@ -110,8 +111,9 @@ discard block |
||
| 110 | 111 | $schedule = array(); |
| 111 | 112 | $response = array(); |
| 112 | 113 | |
| 113 | - if(isset($_POST['data'])) |
|
| 114 | - $params = json_decode(stripslashes($_POST['data'])); |
|
| 114 | + if(isset($_POST['data'])) { |
|
| 115 | + $params = json_decode(stripslashes($_POST['data'])); |
|
| 116 | + } |
|
| 115 | 117 | |
| 116 | 118 | $this->process_params($params); |
| 117 | 119 | |
@@ -134,8 +136,9 @@ discard block |
||
| 134 | 136 | { |
| 135 | 137 | $table = str_replace("\r","", $table); |
| 136 | 138 | $data = explode(".", $table); |
| 137 | - if(isset($data[1])) |
|
| 138 | - $return[$data[0]][] = $data[1]; |
|
| 139 | + if(isset($data[1])) { |
|
| 140 | + $return[$data[0]][] = $data[1]; |
|
| 141 | + } |
|
| 139 | 142 | } |
| 140 | 143 | |
| 141 | 144 | $this->form_params['database'] = ($return); |
@@ -146,19 +149,21 @@ discard block |
||
| 146 | 149 | foreach($excluded_files as $file) |
| 147 | 150 | { |
| 148 | 151 | $file = str_replace("\r","", $file); |
| 149 | - if($file) |
|
| 150 | - $return[] = $file; |
|
| 152 | + if($file) { |
|
| 153 | + $return[] = $file; |
|
| 154 | + } |
|
| 151 | 155 | } |
| 152 | 156 | |
| 153 | 157 | $this->form_params['excluded_files'] = ($return); |
| 154 | 158 | |
| 155 | 159 | $schedule['start_at'] = $this->form_params['backup_params']['start_at']; |
| 156 | 160 | |
| 157 | - if(!isset($_POST['status'])) |
|
| 158 | - $schedule['status'] = 0; |
|
| 159 | - else |
|
| 160 | - $schedule['status'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['status']); |
|
| 161 | - }else{ |
|
| 161 | + if(!isset($_POST['status'])) { |
|
| 162 | + $schedule['status'] = 0; |
|
| 163 | + } else { |
|
| 164 | + $schedule['status'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['status']); |
|
| 165 | + } |
|
| 166 | + } else{ |
|
| 162 | 167 | |
| 163 | 168 | $schedule['status'] = 1; |
| 164 | 169 | $schedule['start_at'] = strtotime($this->form_params['backup_params']['schedule_start_date'] . |
@@ -168,7 +173,7 @@ discard block |
||
| 168 | 173 | if(!$schedule['start_at']) |
| 169 | 174 | { |
| 170 | 175 | $schedule['start_at'] = date('Y-m-d H:i:s', time()); |
| 171 | - }else{ |
|
| 176 | + } else{ |
|
| 172 | 177 | $schedule['start_at'] = date('Y-m-d H:i:s', $schedule['start_at'] - (get_option( 'gmt_offset' ) * HOUR_IN_SECONDS) ); |
| 173 | 178 | } |
| 174 | 179 | |
@@ -188,7 +193,7 @@ discard block |
||
| 188 | 193 | '%s' |
| 189 | 194 | ) |
| 190 | 195 | ); |
| 191 | - }else { |
|
| 196 | + } else { |
|
| 192 | 197 | $wpdb->update( |
| 193 | 198 | $wpdb->prefix.'xcloner_scheduler', |
| 194 | 199 | $schedule, |
@@ -199,8 +204,9 @@ discard block |
||
| 199 | 204 | ) |
| 200 | 205 | ); |
| 201 | 206 | } |
| 202 | - if(isset($_POST['id'])) |
|
| 203 | - $scheduler->update_cron_hook($_POST['id']); |
|
| 207 | + if(isset($_POST['id'])) { |
|
| 208 | + $scheduler->update_cron_hook($_POST['id']); |
|
| 209 | + } |
|
| 204 | 210 | |
| 205 | 211 | if( $wpdb->last_error ) { |
| 206 | 212 | $response['error'] = 1; |
@@ -227,8 +233,9 @@ discard block |
||
| 227 | 233 | |
| 228 | 234 | $init = (int)$_POST['init']; |
| 229 | 235 | |
| 230 | - if($params === NULL) |
|
| 231 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
| 236 | + if($params === NULL) { |
|
| 237 | + die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
| 238 | + } |
|
| 232 | 239 | |
| 233 | 240 | $this->process_params($params); |
| 234 | 241 | |
@@ -237,7 +244,7 @@ discard block |
||
| 237 | 244 | //$return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'], $this->form_params['extra'], $init); |
| 238 | 245 | try{ |
| 239 | 246 | $return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'], $this->form_params['extra'], $init); |
| 240 | - }catch(Exception $e) |
|
| 247 | + } catch(Exception $e) |
|
| 241 | 248 | { |
| 242 | 249 | $return = array(); |
| 243 | 250 | $return['error'] = true; |
@@ -249,8 +256,9 @@ discard block |
||
| 249 | 256 | if($return['finished']) |
| 250 | 257 | { |
| 251 | 258 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 252 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 253 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 259 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
| 260 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 261 | + } |
|
| 254 | 262 | } |
| 255 | 263 | |
| 256 | 264 | $data = $return; |
@@ -265,7 +273,7 @@ discard block |
||
| 265 | 273 | $subject = ""; |
| 266 | 274 | $additional['lines_total'] = $return['extra']['lines_total']; |
| 267 | 275 | $this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $this->form_params,"", $additional); |
| 268 | - }catch(Exception $e) |
|
| 276 | + } catch(Exception $e) |
|
| 269 | 277 | { |
| 270 | 278 | $this->logger->error($e->getMessage()); |
| 271 | 279 | } |
@@ -289,18 +297,20 @@ discard block |
||
| 289 | 297 | |
| 290 | 298 | $init = (int)$_POST['init']; |
| 291 | 299 | |
| 292 | - if($params === NULL) |
|
| 293 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
| 300 | + if($params === NULL) { |
|
| 301 | + die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
| 302 | + } |
|
| 294 | 303 | |
| 295 | 304 | $this->process_params($params); |
| 296 | 305 | |
| 297 | 306 | //$xcloner_database = $this->init_db(); |
| 298 | 307 | $return = $this->xcloner_database->start_database_recursion($this->form_params['database'], $this->form_params['extra'], $init); |
| 299 | 308 | |
| 300 | - if(isset($return['error']) and $return['error']) |
|
| 301 | - $data['finished'] = 1; |
|
| 302 | - else |
|
| 303 | - $data['finished'] = $return['finished']; |
|
| 309 | + if(isset($return['error']) and $return['error']) { |
|
| 310 | + $data['finished'] = 1; |
|
| 311 | + } else { |
|
| 312 | + $data['finished'] = $return['finished']; |
|
| 313 | + } |
|
| 304 | 314 | |
| 305 | 315 | $data['extra'] = $return; |
| 306 | 316 | |
@@ -319,8 +329,9 @@ discard block |
||
| 319 | 329 | $params = json_decode(stripslashes($_POST['data'])); |
| 320 | 330 | $init = (int)$_POST['init']; |
| 321 | 331 | |
| 322 | - if($params === NULL) |
|
| 323 | - die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
| 332 | + if($params === NULL) { |
|
| 333 | + die( '{"status":false,"msg":"The post_data parameter must be valid JSON"}' ); |
|
| 334 | + } |
|
| 324 | 335 | |
| 325 | 336 | $hash = $this->process_params($params); |
| 326 | 337 | |
@@ -343,8 +354,9 @@ discard block |
||
| 343 | 354 | */ |
| 344 | 355 | private function process_params($params) |
| 345 | 356 | { |
| 346 | - if(isset($params->hash)) |
|
| 347 | - $this->xcloner_settings->set_hash($params->hash); |
|
| 357 | + if(isset($params->hash)) { |
|
| 358 | + $this->xcloner_settings->set_hash($params->hash); |
|
| 359 | + } |
|
| 348 | 360 | |
| 349 | 361 | $this->form_params['extra'] = array(); |
| 350 | 362 | $this->form_params['backup_params'] = array(); |
@@ -397,8 +409,9 @@ discard block |
||
| 397 | 409 | |
| 398 | 410 | if(isset($params->extra)) |
| 399 | 411 | { |
| 400 | - foreach($params->extra as $key=>$value) |
|
| 401 | - $this->form_params['extra'][$key] = $this->xcloner_sanitization->sanitize_input_as_raw($value); |
|
| 412 | + foreach($params->extra as $key=>$value) { |
|
| 413 | + $this->form_params['extra'][$key] = $this->xcloner_sanitization->sanitize_input_as_raw($value); |
|
| 414 | + } |
|
| 402 | 415 | } |
| 403 | 416 | |
| 404 | 417 | return $this->xcloner_settings->get_hash(); |
@@ -432,7 +445,7 @@ discard block |
||
| 432 | 445 | |
| 433 | 446 | try{ |
| 434 | 447 | $files = $this->xcloner_file_system->list_directory($folder); |
| 435 | - }catch(Exception $e){ |
|
| 448 | + } catch(Exception $e){ |
|
| 436 | 449 | |
| 437 | 450 | print $e->getMessage(); |
| 438 | 451 | $this->logger->error($e->getMessage()); |
@@ -452,15 +465,17 @@ discard block |
||
| 452 | 465 | $children = false; |
| 453 | 466 | $text = $file['basename']; |
| 454 | 467 | |
| 455 | - if($file['type'] == "dir") |
|
| 456 | - $children = true; |
|
| 457 | - else |
|
| 458 | - $text .= " (". $this->xcloner_requirements->file_format_size($file['size']).")"; |
|
| 468 | + if($file['type'] == "dir") { |
|
| 469 | + $children = true; |
|
| 470 | + } else { |
|
| 471 | + $text .= " (". $this->xcloner_requirements->file_format_size($file['size']).")"; |
|
| 472 | + } |
|
| 459 | 473 | |
| 460 | - if($this->xcloner_file_system->is_excluded($file)) |
|
| 461 | - $selected = true; |
|
| 462 | - else |
|
| 463 | - $selected = false; |
|
| 474 | + if($this->xcloner_file_system->is_excluded($file)) { |
|
| 475 | + $selected = true; |
|
| 476 | + } else { |
|
| 477 | + $selected = false; |
|
| 478 | + } |
|
| 464 | 479 | |
| 465 | 480 | $data[] = array( |
| 466 | 481 | 'id' => $file['path'], |
@@ -496,22 +511,24 @@ discard block |
||
| 496 | 511 | { |
| 497 | 512 | try{ |
| 498 | 513 | $return = $this->xcloner_database->get_all_databases(); |
| 499 | - }catch(Exception $e){ |
|
| 514 | + } catch(Exception $e){ |
|
| 500 | 515 | $this->logger->error($e->getMessage()); |
| 501 | 516 | } |
| 502 | 517 | |
| 503 | 518 | foreach($return as $database) |
| 504 | 519 | { |
| 505 | - if($xcloner_backup_only_wp_tables and $database['name'] != $this->xcloner_settings->get_db_database()) |
|
| 506 | - continue; |
|
| 520 | + if($xcloner_backup_only_wp_tables and $database['name'] != $this->xcloner_settings->get_db_database()) { |
|
| 521 | + continue; |
|
| 522 | + } |
|
| 507 | 523 | |
| 508 | 524 | $state = array(); |
| 509 | 525 | |
| 510 | 526 | if($database['name'] == $this->xcloner_settings->get_db_database()) |
| 511 | 527 | { |
| 512 | 528 | $state['selected'] = true; |
| 513 | - if($database['num_tables'] < 25) |
|
| 514 | - $state['opened'] = false; |
|
| 529 | + if($database['num_tables'] < 25) { |
|
| 530 | + $state['opened'] = false; |
|
| 531 | + } |
|
| 515 | 532 | } |
| 516 | 533 | |
| 517 | 534 | $data[] = array( |
@@ -524,13 +541,11 @@ discard block |
||
| 524 | 541 | ); |
| 525 | 542 | } |
| 526 | 543 | |
| 527 | - } |
|
| 528 | - |
|
| 529 | - else{ |
|
| 544 | + } else{ |
|
| 530 | 545 | |
| 531 | 546 | try{ |
| 532 | 547 | $return = $this->xcloner_database->list_tables($database, "", 1); |
| 533 | - }catch(Exception $e){ |
|
| 548 | + } catch(Exception $e){ |
|
| 534 | 549 | $this->logger->error($e->getMessage()); |
| 535 | 550 | } |
| 536 | 551 | |
@@ -538,11 +553,13 @@ discard block |
||
| 538 | 553 | { |
| 539 | 554 | $state = array(); |
| 540 | 555 | |
| 541 | - if($xcloner_backup_only_wp_tables and !stristr($table['name'], $this->xcloner_settings->get_table_prefix())) |
|
| 542 | - continue; |
|
| 556 | + if($xcloner_backup_only_wp_tables and !stristr($table['name'], $this->xcloner_settings->get_table_prefix())) { |
|
| 557 | + continue; |
|
| 558 | + } |
|
| 543 | 559 | |
| 544 | - if(isset($database['name']) and $database['name'] == $this->xcloner_settings->get_db_database()) |
|
| 545 | - $state = array('selected' => true); |
|
| 560 | + if(isset($database['name']) and $database['name'] == $this->xcloner_settings->get_db_database()) { |
|
| 561 | + $state = array('selected' => true); |
|
| 562 | + } |
|
| 546 | 563 | |
| 547 | 564 | $data[] = array( |
| 548 | 565 | 'id' => $table['name'], |
@@ -593,10 +610,11 @@ discard block |
||
| 593 | 610 | { |
| 594 | 611 | $action = "<a href=\"#".$res->id."\" class=\"edit\" title='Edit'> <i class=\"material-icons \">edit</i></a> |
| 595 | 612 | <a href=\"#".$res->id."\" class=\"delete\" title='Delete'><i class=\"material-icons \">delete</i></a>"; |
| 596 | - if($res->status) |
|
| 597 | - $status = '<i class="material-icons active status">timer</i>'; |
|
| 598 | - else |
|
| 599 | - $status = '<i class="material-icons status inactive">timer_off</i>'; |
|
| 613 | + if($res->status) { |
|
| 614 | + $status = '<i class="material-icons active status">timer</i>'; |
|
| 615 | + } else { |
|
| 616 | + $status = '<i class="material-icons status inactive">timer_off</i>'; |
|
| 617 | + } |
|
| 600 | 618 | |
| 601 | 619 | $next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)); |
| 602 | 620 | |
@@ -604,17 +622,19 @@ discard block |
||
| 604 | 622 | |
| 605 | 623 | $remote_storage = $res->remote_storage; |
| 606 | 624 | |
| 607 | - if(!$next_run_time >= time()) |
|
| 608 | - $next_run = " "; |
|
| 625 | + if(!$next_run_time >= time()) { |
|
| 626 | + $next_run = " "; |
|
| 627 | + } |
|
| 609 | 628 | |
| 610 | 629 | if(trim($next_run)) |
| 611 | 630 | { |
| 612 | 631 | $date_text = date(get_option('date_format')." ".get_option('time_format'), $next_run_time + (get_option( 'gmt_offset' ) * HOUR_IN_SECONDS)); |
| 613 | 632 | |
| 614 | - if($next_run_time >= time()) |
|
| 615 | - $next_run = "in ".human_time_diff($next_run_time, time()); |
|
| 616 | - else |
|
| 617 | - $next_run = __("executed", 'xcloner-backup-and-restore'); |
|
| 633 | + if($next_run_time >= time()) { |
|
| 634 | + $next_run = "in ".human_time_diff($next_run_time, time()); |
|
| 635 | + } else { |
|
| 636 | + $next_run = __("executed", 'xcloner-backup-and-restore'); |
|
| 637 | + } |
|
| 618 | 638 | |
| 619 | 639 | $next_run = "<a href='#' title='".$date_text."'>".$next_run."</a>"; |
| 620 | 640 | //$next_run .=" ($date_text)"; |
@@ -698,7 +718,7 @@ discard block |
||
| 698 | 718 | $tar->open($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file, $start); |
| 699 | 719 | |
| 700 | 720 | $data = $tar->contents(get_option('xcloner_files_to_process_per_request')); |
| 701 | - }catch(Exception $e) |
|
| 721 | + } catch(Exception $e) |
|
| 702 | 722 | { |
| 703 | 723 | $return['error'] = true; |
| 704 | 724 | $return['message'] = $e->getMessage(); |
@@ -726,15 +746,16 @@ discard block |
||
| 726 | 746 | { |
| 727 | 747 | $return['start'] = $data['start']; |
| 728 | 748 | $return['finished'] = 0; |
| 729 | - }else{ |
|
| 749 | + } else{ |
|
| 730 | 750 | if($this->xcloner_file_system->is_multipart($source_backup_file)) |
| 731 | 751 | { |
| 732 | 752 | $return['start'] = 0; |
| 733 | 753 | |
| 734 | 754 | ++$return['part']; |
| 735 | 755 | |
| 736 | - if($return['part'] < sizeof($backup_parts)) |
|
| 737 | - $return['finished'] = 0; |
|
| 756 | + if($return['part'] < sizeof($backup_parts)) { |
|
| 757 | + $return['finished'] = 0; |
|
| 758 | + } |
|
| 738 | 759 | |
| 739 | 760 | } |
| 740 | 761 | } |
@@ -760,7 +781,7 @@ discard block |
||
| 760 | 781 | { |
| 761 | 782 | $return = call_user_func_array(array($xcloner_remote_storage, "copy_backup_remote_to_local"), array($backup_file, $storage_type)); |
| 762 | 783 | } |
| 763 | - }catch(Exception $e){ |
|
| 784 | + } catch(Exception $e){ |
|
| 764 | 785 | |
| 765 | 786 | $return['error'] = 1; |
| 766 | 787 | $return['message'] = $e->getMessage(); |
@@ -799,7 +820,7 @@ discard block |
||
| 799 | 820 | { |
| 800 | 821 | $return = call_user_func_array(array($xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $storage_type)); |
| 801 | 822 | } |
| 802 | - }catch(Exception $e){ |
|
| 823 | + } catch(Exception $e){ |
|
| 803 | 824 | |
| 804 | 825 | $return['error'] = 1; |
| 805 | 826 | $return['message'] = $e->getMessage(); |
@@ -950,11 +971,13 @@ discard block |
||
| 950 | 971 | $file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']); |
| 951 | 972 | $hash = $this->xcloner_sanitization->sanitize_input_as_string($_POST['hash']); |
| 952 | 973 | |
| 953 | - if(isset($_POST['part'])) |
|
| 954 | - $return['part'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['part']); |
|
| 974 | + if(isset($_POST['part'])) { |
|
| 975 | + $return['part'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['part']); |
|
| 976 | + } |
|
| 955 | 977 | |
| 956 | - if(isset($_POST['uploaded_size'])) |
|
| 957 | - $return['uploaded_size'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['uploaded_size']); |
|
| 978 | + if(isset($_POST['uploaded_size'])) { |
|
| 979 | + $return['uploaded_size'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['uploaded_size']); |
|
| 980 | + } |
|
| 958 | 981 | |
| 959 | 982 | $start = $this->xcloner_sanitization->sanitize_input_as_string($_POST['start']); |
| 960 | 983 | $target_url = $this->xcloner_sanitization->sanitize_input_as_string($_POST['target_url']); |
@@ -981,7 +1004,7 @@ discard block |
||
| 981 | 1004 | $xcloner_file_transfer->set_target($target_url); |
| 982 | 1005 | $return['start'] = $xcloner_file_transfer->transfer_file($file, $start, $hash); |
| 983 | 1006 | |
| 984 | - }catch(Exception $e){ |
|
| 1007 | + } catch(Exception $e){ |
|
| 985 | 1008 | |
| 986 | 1009 | $return = array(); |
| 987 | 1010 | $return['error'] = true; |
@@ -1015,8 +1038,9 @@ discard block |
||
| 1015 | 1038 | $data['hash'] = $this->xcloner_settings->get_hash(); |
| 1016 | 1039 | } |
| 1017 | 1040 | |
| 1018 | - if( ob_get_length() ) |
|
| 1019 | - ob_clean(); |
|
| 1041 | + if( ob_get_length() ) { |
|
| 1042 | + ob_clean(); |
|
| 1043 | + } |
|
| 1020 | 1044 | wp_send_json($data); |
| 1021 | 1045 | |
| 1022 | 1046 | die(); |