@@ -11,8 +11,8 @@ |
||
| 11 | 11 | |
| 12 | 12 | // add all files in the project, only include php files |
| 13 | 13 | $phar2->buildFromIterator( |
| 14 | - new RecursiveIteratorIterator( |
|
| 15 | - new RecursiveDirectoryIterator(__DIR__.'/vendor/')), |
|
| 16 | - __DIR__); |
|
| 14 | + new RecursiveIteratorIterator( |
|
| 15 | + new RecursiveDirectoryIterator(__DIR__.'/vendor/')), |
|
| 16 | + __DIR__); |
|
| 17 | 17 | |
| 18 | 18 | $phar2->setStub($phar2->createDefaultStub('vendor/autoload.php', 'vendor/autoload.php')); |
@@ -194,348 +194,348 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | public function settings_init() |
| 196 | 196 | { |
| 197 | - global $wpdb; |
|
| 198 | - $this->xcloner_sanitization = new Xcloner_Sanitization(); |
|
| 197 | + global $wpdb; |
|
| 198 | + $this->xcloner_sanitization = new Xcloner_Sanitization(); |
|
| 199 | 199 | |
| 200 | - //ADDING MISSING OPTIONS |
|
| 201 | - if( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
|
| 200 | + //ADDING MISSING OPTIONS |
|
| 201 | + if( false == get_option( 'xcloner_mysql_settings_page' ) ) { |
|
| 202 | 202 | add_option( 'xcloner_mysql_settings_page' ); |
| 203 | 203 | } // end if |
| 204 | 204 | |
| 205 | - if( false == get_option( 'xcloner_cron_settings_page' ) ) { |
|
| 205 | + if( false == get_option( 'xcloner_cron_settings_page' ) ) { |
|
| 206 | 206 | add_option( 'xcloner_cron_settings_page' ); |
| 207 | 207 | } // end if |
| 208 | 208 | |
| 209 | - if( false == get_option( 'xcloner_system_settings_page' ) ) { |
|
| 209 | + if( false == get_option( 'xcloner_system_settings_page' ) ) { |
|
| 210 | 210 | add_option( 'xcloner_system_settings_page' ); |
| 211 | 211 | } // end if |
| 212 | 212 | |
| 213 | - if( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
|
| 213 | + if( false == get_option( 'xcloner_cleanup_settings_page' ) ) { |
|
| 214 | 214 | add_option( 'xcloner_cleanup_settings_page' ); |
| 215 | 215 | } // end if |
| 216 | 216 | |
| 217 | 217 | |
| 218 | - //ADDING SETTING SECTIONS |
|
| 219 | - //GENERAL section |
|
| 220 | - add_settings_section( |
|
| 221 | - 'xcloner_general_settings_group', |
|
| 222 | - __(' '), |
|
| 223 | - array($this, 'xcloner_settings_section_cb'), |
|
| 224 | - 'xcloner_settings_page' |
|
| 225 | - ); |
|
| 226 | - //MYSQL section |
|
| 227 | - add_settings_section( |
|
| 228 | - 'xcloner_mysql_settings_group', |
|
| 229 | - __(' '), |
|
| 230 | - array($this, 'xcloner_settings_section_cb'), |
|
| 231 | - 'xcloner_mysql_settings_page' |
|
| 232 | - ); |
|
| 218 | + //ADDING SETTING SECTIONS |
|
| 219 | + //GENERAL section |
|
| 220 | + add_settings_section( |
|
| 221 | + 'xcloner_general_settings_group', |
|
| 222 | + __(' '), |
|
| 223 | + array($this, 'xcloner_settings_section_cb'), |
|
| 224 | + 'xcloner_settings_page' |
|
| 225 | + ); |
|
| 226 | + //MYSQL section |
|
| 227 | + add_settings_section( |
|
| 228 | + 'xcloner_mysql_settings_group', |
|
| 229 | + __(' '), |
|
| 230 | + array($this, 'xcloner_settings_section_cb'), |
|
| 231 | + 'xcloner_mysql_settings_page' |
|
| 232 | + ); |
|
| 233 | 233 | |
| 234 | - //SYSTEM section |
|
| 235 | - add_settings_section( |
|
| 236 | - 'xcloner_system_settings_group', |
|
| 237 | - __('These are advanced options recommended for developers!','xcloner-backup-and-restore'), |
|
| 238 | - array($this, 'xcloner_settings_section_cb'), |
|
| 239 | - 'xcloner_system_settings_page' |
|
| 240 | - ); |
|
| 234 | + //SYSTEM section |
|
| 235 | + add_settings_section( |
|
| 236 | + 'xcloner_system_settings_group', |
|
| 237 | + __('These are advanced options recommended for developers!','xcloner-backup-and-restore'), |
|
| 238 | + array($this, 'xcloner_settings_section_cb'), |
|
| 239 | + 'xcloner_system_settings_page' |
|
| 240 | + ); |
|
| 241 | 241 | |
| 242 | - //CLEANUP section |
|
| 243 | - add_settings_section( |
|
| 244 | - 'xcloner_cleanup_settings_group', |
|
| 245 | - __(' '), |
|
| 246 | - array($this, 'xcloner_settings_section_cb'), |
|
| 247 | - 'xcloner_cleanup_settings_page' |
|
| 248 | - ); |
|
| 242 | + //CLEANUP section |
|
| 243 | + add_settings_section( |
|
| 244 | + 'xcloner_cleanup_settings_group', |
|
| 245 | + __(' '), |
|
| 246 | + array($this, 'xcloner_settings_section_cb'), |
|
| 247 | + 'xcloner_cleanup_settings_page' |
|
| 248 | + ); |
|
| 249 | 249 | |
| 250 | 250 | |
| 251 | 251 | //CRON section |
| 252 | - add_settings_section( |
|
| 253 | - 'xcloner_cron_settings_group', |
|
| 254 | - __(' '), |
|
| 255 | - array($this, 'xcloner_settings_section_cb'), |
|
| 256 | - 'xcloner_cron_settings_page' |
|
| 257 | - ); |
|
| 252 | + add_settings_section( |
|
| 253 | + 'xcloner_cron_settings_group', |
|
| 254 | + __(' '), |
|
| 255 | + array($this, 'xcloner_settings_section_cb'), |
|
| 256 | + 'xcloner_cron_settings_page' |
|
| 257 | + ); |
|
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | |
| 261 | 261 | //REGISTERING THE 'GENERAL SECTION' FIELDS |
| 262 | 262 | register_setting('xcloner_general_settings_group', 'xcloner_backup_compression_level', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 263 | - add_settings_field( |
|
| 264 | - 'xcloner_backup_compression_level', |
|
| 265 | - __('Backup Compression Level','xcloner-backup-and-restore'), |
|
| 266 | - array($this, 'do_form_range_field'), |
|
| 267 | - 'xcloner_settings_page', |
|
| 268 | - 'xcloner_general_settings_group', |
|
| 269 | - array('xcloner_backup_compression_level', |
|
| 270 | - __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load','xcloner-backup-and-restore'), |
|
| 271 | - 0, |
|
| 272 | - 9 |
|
| 273 | - ) |
|
| 274 | - ); |
|
| 263 | + add_settings_field( |
|
| 264 | + 'xcloner_backup_compression_level', |
|
| 265 | + __('Backup Compression Level','xcloner-backup-and-restore'), |
|
| 266 | + array($this, 'do_form_range_field'), |
|
| 267 | + 'xcloner_settings_page', |
|
| 268 | + 'xcloner_general_settings_group', |
|
| 269 | + array('xcloner_backup_compression_level', |
|
| 270 | + __('Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load','xcloner-backup-and-restore'), |
|
| 271 | + 0, |
|
| 272 | + 9 |
|
| 273 | + ) |
|
| 274 | + ); |
|
| 275 | 275 | |
| 276 | - register_setting('xcloner_general_settings_group', 'xcloner_start_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 277 | - add_settings_field( |
|
| 278 | - 'xcloner_start_path', |
|
| 279 | - __('Backup Start Location','xcloner-backup-and-restore'), |
|
| 280 | - array($this, 'do_form_text_field'), |
|
| 281 | - 'xcloner_settings_page', |
|
| 282 | - 'xcloner_general_settings_group', |
|
| 283 | - array('xcloner_start_path', |
|
| 276 | + register_setting('xcloner_general_settings_group', 'xcloner_start_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 277 | + add_settings_field( |
|
| 278 | + 'xcloner_start_path', |
|
| 279 | + __('Backup Start Location','xcloner-backup-and-restore'), |
|
| 280 | + array($this, 'do_form_text_field'), |
|
| 281 | + 'xcloner_settings_page', |
|
| 282 | + 'xcloner_general_settings_group', |
|
| 283 | + array('xcloner_start_path', |
|
| 284 | 284 | __('Base path location from where XCloner can start the Backup.','xcloner-backup-and-restore'), |
| 285 | 285 | $this->get_xcloner_start_path(), |
| 286 | 286 | //'disabled' |
| 287 | 287 | ) |
| 288 | - ); |
|
| 288 | + ); |
|
| 289 | 289 | |
| 290 | - register_setting('xcloner_general_settings_group', 'xcloner_store_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 291 | - add_settings_field( |
|
| 292 | - 'xcloner_store_path', |
|
| 293 | - __('Backup Storage Location','xcloner-backup-and-restore'), |
|
| 294 | - array($this, 'do_form_text_field'), |
|
| 295 | - 'xcloner_settings_page', |
|
| 296 | - 'xcloner_general_settings_group', |
|
| 297 | - array('xcloner_store_path', |
|
| 290 | + register_setting('xcloner_general_settings_group', 'xcloner_store_path', array($this->xcloner_sanitization, "sanitize_input_as_absolute_path")); |
|
| 291 | + add_settings_field( |
|
| 292 | + 'xcloner_store_path', |
|
| 293 | + __('Backup Storage Location','xcloner-backup-and-restore'), |
|
| 294 | + array($this, 'do_form_text_field'), |
|
| 295 | + 'xcloner_settings_page', |
|
| 296 | + 'xcloner_general_settings_group', |
|
| 297 | + array('xcloner_store_path', |
|
| 298 | 298 | __('Location where XCloner will store the Backup archives.','xcloner-backup-and-restore'), |
| 299 | 299 | $this->get_xcloner_store_path(), |
| 300 | 300 | //'disabled' |
| 301 | 301 | ) |
| 302 | - ); |
|
| 302 | + ); |
|
| 303 | 303 | |
| 304 | - register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 305 | - add_settings_field( |
|
| 306 | - 'xcloner_enable_log', |
|
| 307 | - __('Enable XCloner Backup Log','xcloner-backup-and-restore'), |
|
| 308 | - array($this, 'do_form_switch_field'), |
|
| 309 | - 'xcloner_settings_page', |
|
| 310 | - 'xcloner_general_settings_group', |
|
| 311 | - array('xcloner_enable_log', |
|
| 304 | + register_setting('xcloner_general_settings_group', 'xcloner_enable_log', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 305 | + add_settings_field( |
|
| 306 | + 'xcloner_enable_log', |
|
| 307 | + __('Enable XCloner Backup Log','xcloner-backup-and-restore'), |
|
| 308 | + array($this, 'do_form_switch_field'), |
|
| 309 | + 'xcloner_settings_page', |
|
| 310 | + 'xcloner_general_settings_group', |
|
| 311 | + array('xcloner_enable_log', |
|
| 312 | 312 | sprintf(__('Enable the XCloner Backup log. You will find it stored unde the Backup Storage Location, file %s','xcloner-backup-and-restore'), $this->get_logger_filename()) |
| 313 | 313 | ) |
| 314 | 314 | ); |
| 315 | 315 | |
| 316 | 316 | register_setting('xcloner_general_settings_group', 'xcloner_regex_exclude', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
| 317 | - add_settings_field( |
|
| 318 | - 'xcloner_regex_exclude', |
|
| 319 | - __('Regex Exclude Files','xcloner-backup-and-restore'), |
|
| 320 | - array($this, 'do_form_textarea_field'), |
|
| 321 | - 'xcloner_settings_page', |
|
| 322 | - 'xcloner_general_settings_group', |
|
| 323 | - array('xcloner_regex_exclude', |
|
| 317 | + add_settings_field( |
|
| 318 | + 'xcloner_regex_exclude', |
|
| 319 | + __('Regex Exclude Files','xcloner-backup-and-restore'), |
|
| 320 | + array($this, 'do_form_textarea_field'), |
|
| 321 | + 'xcloner_settings_page', |
|
| 322 | + 'xcloner_general_settings_group', |
|
| 323 | + array('xcloner_regex_exclude', |
|
| 324 | 324 | __('Regular expression match to exclude files and folders, example patterns provided below, one pattern per line','xcloner-backup-and-restore'), |
| 325 | 325 | //$this->get_xcloner_store_path(), |
| 326 | 326 | //'disabled' |
| 327 | 327 | ) |
| 328 | - ); |
|
| 328 | + ); |
|
| 329 | 329 | |
| 330 | 330 | //REGISTERING THE 'MYSQL SECTION' FIELDS |
| 331 | 331 | register_setting('xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 332 | - add_settings_field( |
|
| 333 | - 'xcloner_enable_mysql_backup', |
|
| 334 | - __('Enable Mysql Backup','xcloner-backup-and-restore'), |
|
| 335 | - array($this, 'do_form_switch_field'), |
|
| 336 | - 'xcloner_mysql_settings_page', |
|
| 337 | - 'xcloner_mysql_settings_group', |
|
| 338 | - array('xcloner_enable_mysql_backup', |
|
| 332 | + add_settings_field( |
|
| 333 | + 'xcloner_enable_mysql_backup', |
|
| 334 | + __('Enable Mysql Backup','xcloner-backup-and-restore'), |
|
| 335 | + array($this, 'do_form_switch_field'), |
|
| 336 | + 'xcloner_mysql_settings_page', |
|
| 337 | + 'xcloner_mysql_settings_group', |
|
| 338 | + array('xcloner_enable_mysql_backup', |
|
| 339 | 339 | __('Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.','xcloner-backup-and-restore') |
| 340 | 340 | ) |
| 341 | - ); |
|
| 341 | + ); |
|
| 342 | 342 | |
| 343 | - register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables'); |
|
| 344 | - add_settings_field( |
|
| 345 | - 'xcloner_backup_only_wp_tables', |
|
| 346 | - __('Backup only WP tables','xcloner-backup-and-restore'), |
|
| 347 | - array($this, 'do_form_switch_field'), |
|
| 348 | - 'xcloner_mysql_settings_page', |
|
| 349 | - 'xcloner_mysql_settings_group', |
|
| 350 | - array('xcloner_backup_only_wp_tables', |
|
| 343 | + register_setting('xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables'); |
|
| 344 | + add_settings_field( |
|
| 345 | + 'xcloner_backup_only_wp_tables', |
|
| 346 | + __('Backup only WP tables','xcloner-backup-and-restore'), |
|
| 347 | + array($this, 'do_form_switch_field'), |
|
| 348 | + 'xcloner_mysql_settings_page', |
|
| 349 | + 'xcloner_mysql_settings_group', |
|
| 350 | + array('xcloner_backup_only_wp_tables', |
|
| 351 | 351 | sprintf(__('Enable this if you only want to Backup only tables starting with \'%s\' prefix','xcloner-backup-and-restore'), $this->get_table_prefix()) |
| 352 | 352 | ) |
| 353 | - ); |
|
| 353 | + ); |
|
| 354 | 354 | |
| 355 | - register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 356 | - add_settings_field( |
|
| 357 | - 'xcloner_mysql_hostname', |
|
| 358 | - __('Mysql Hostname','xcloner-backup-and-restore'), |
|
| 359 | - array($this, 'do_form_text_field'), |
|
| 360 | - 'xcloner_mysql_settings_page', |
|
| 361 | - 'xcloner_mysql_settings_group', |
|
| 362 | - array('xcloner_mysql_hostname', |
|
| 355 | + register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 356 | + add_settings_field( |
|
| 357 | + 'xcloner_mysql_hostname', |
|
| 358 | + __('Mysql Hostname','xcloner-backup-and-restore'), |
|
| 359 | + array($this, 'do_form_text_field'), |
|
| 360 | + 'xcloner_mysql_settings_page', |
|
| 361 | + 'xcloner_mysql_settings_group', |
|
| 362 | + array('xcloner_mysql_hostname', |
|
| 363 | 363 | __('Wordpress mysql hostname','xcloner-backup-and-restore'), |
| 364 | 364 | $this->get_db_hostname(), |
| 365 | 365 | 'disabled' |
| 366 | 366 | ) |
| 367 | - ); |
|
| 367 | + ); |
|
| 368 | 368 | |
| 369 | - register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 370 | - add_settings_field( |
|
| 371 | - 'xcloner_mysql_username', |
|
| 372 | - __('Mysql Username','xcloner-backup-and-restore'), |
|
| 373 | - array($this, 'do_form_text_field'), |
|
| 374 | - 'xcloner_mysql_settings_page', |
|
| 375 | - 'xcloner_mysql_settings_group', |
|
| 376 | - array('xcloner_mysql_username', |
|
| 369 | + register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_username', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 370 | + add_settings_field( |
|
| 371 | + 'xcloner_mysql_username', |
|
| 372 | + __('Mysql Username','xcloner-backup-and-restore'), |
|
| 373 | + array($this, 'do_form_text_field'), |
|
| 374 | + 'xcloner_mysql_settings_page', |
|
| 375 | + 'xcloner_mysql_settings_group', |
|
| 376 | + array('xcloner_mysql_username', |
|
| 377 | 377 | __('Wordpress mysql username','xcloner-backup-and-restore'), |
| 378 | 378 | $this->get_db_username(), |
| 379 | 379 | 'disabled' |
| 380 | 380 | ) |
| 381 | - ); |
|
| 381 | + ); |
|
| 382 | 382 | |
| 383 | - register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 384 | - add_settings_field( |
|
| 385 | - 'xcloner_mysql_database', |
|
| 386 | - __('Mysql Database','xcloner-backup-and-restore'), |
|
| 387 | - array($this, 'do_form_text_field'), |
|
| 388 | - 'xcloner_mysql_settings_page', |
|
| 389 | - 'xcloner_mysql_settings_group', |
|
| 390 | - array('xcloner_mysql_database', |
|
| 383 | + register_setting('xcloner_mysql_settings_group', 'xcloner_mysql_database', array($this->xcloner_sanitization, "sanitize_input_as_raw")); |
|
| 384 | + add_settings_field( |
|
| 385 | + 'xcloner_mysql_database', |
|
| 386 | + __('Mysql Database','xcloner-backup-and-restore'), |
|
| 387 | + array($this, 'do_form_text_field'), |
|
| 388 | + 'xcloner_mysql_settings_page', |
|
| 389 | + 'xcloner_mysql_settings_group', |
|
| 390 | + array('xcloner_mysql_database', |
|
| 391 | 391 | __('Wordpress mysql database','xcloner-backup-and-restore'), |
| 392 | 392 | $this->get_db_database(), |
| 393 | 393 | 'disabled' |
| 394 | 394 | ) |
| 395 | - ); |
|
| 395 | + ); |
|
| 396 | 396 | |
| 397 | - //REGISTERING THE 'SYSTEM SECTION' FIELDS |
|
| 398 | - register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 399 | - add_settings_field( |
|
| 400 | - 'xcloner_size_limit_per_request', |
|
| 401 | - __('Data Size Limit Per Request','xcloner-backup-and-restore'), |
|
| 402 | - array($this, 'do_form_range_field'), |
|
| 403 | - 'xcloner_system_settings_page', |
|
| 404 | - 'xcloner_system_settings_group', |
|
| 405 | - array('xcloner_size_limit_per_request', |
|
| 406 | - __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB','xcloner-backup-and-restore'), |
|
| 407 | - 0, |
|
| 408 | - 1024 |
|
| 409 | - ) |
|
| 410 | - ); |
|
| 397 | + //REGISTERING THE 'SYSTEM SECTION' FIELDS |
|
| 398 | + register_setting('xcloner_system_settings_group', 'xcloner_size_limit_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
|
| 399 | + add_settings_field( |
|
| 400 | + 'xcloner_size_limit_per_request', |
|
| 401 | + __('Data Size Limit Per Request','xcloner-backup-and-restore'), |
|
| 402 | + array($this, 'do_form_range_field'), |
|
| 403 | + 'xcloner_system_settings_page', |
|
| 404 | + 'xcloner_system_settings_group', |
|
| 405 | + array('xcloner_size_limit_per_request', |
|
| 406 | + __('Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB','xcloner-backup-and-restore'), |
|
| 407 | + 0, |
|
| 408 | + 1024 |
|
| 409 | + ) |
|
| 410 | + ); |
|
| 411 | 411 | |
| 412 | 412 | register_setting('xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 413 | - add_settings_field( |
|
| 414 | - 'xcloner_files_to_process_per_request', |
|
| 415 | - __('Files To Process Per Request','xcloner-backup-and-restore'), |
|
| 416 | - array($this, 'do_form_range_field'), |
|
| 417 | - 'xcloner_system_settings_page', |
|
| 418 | - 'xcloner_system_settings_group', |
|
| 419 | - array('xcloner_files_to_process_per_request', |
|
| 420 | - __('Use this option to set how many files XCloner should process at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 421 | - 0, |
|
| 422 | - 1000 |
|
| 423 | - ) |
|
| 424 | - ); |
|
| 413 | + add_settings_field( |
|
| 414 | + 'xcloner_files_to_process_per_request', |
|
| 415 | + __('Files To Process Per Request','xcloner-backup-and-restore'), |
|
| 416 | + array($this, 'do_form_range_field'), |
|
| 417 | + 'xcloner_system_settings_page', |
|
| 418 | + 'xcloner_system_settings_group', |
|
| 419 | + array('xcloner_files_to_process_per_request', |
|
| 420 | + __('Use this option to set how many files XCloner should process at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 421 | + 0, |
|
| 422 | + 1000 |
|
| 423 | + ) |
|
| 424 | + ); |
|
| 425 | 425 | |
| 426 | 426 | register_setting('xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 427 | - add_settings_field( |
|
| 428 | - 'xcloner_directories_to_scan_per_request', |
|
| 429 | - __('Directories To Scan Per Request','xcloner-backup-and-restore'), |
|
| 430 | - array($this, 'do_form_range_field'), |
|
| 431 | - 'xcloner_system_settings_page', |
|
| 432 | - 'xcloner_system_settings_group', |
|
| 433 | - array('xcloner_directories_to_scan_per_request', |
|
| 434 | - __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 435 | - 0, |
|
| 436 | - 1000 |
|
| 437 | - ) |
|
| 438 | - ); |
|
| 427 | + add_settings_field( |
|
| 428 | + 'xcloner_directories_to_scan_per_request', |
|
| 429 | + __('Directories To Scan Per Request','xcloner-backup-and-restore'), |
|
| 430 | + array($this, 'do_form_range_field'), |
|
| 431 | + 'xcloner_system_settings_page', |
|
| 432 | + 'xcloner_system_settings_group', |
|
| 433 | + array('xcloner_directories_to_scan_per_request', |
|
| 434 | + __('Use this option to set how many directories XCloner should scan at one time before doing another AJAX call','xcloner-backup-and-restore'), |
|
| 435 | + 0, |
|
| 436 | + 1000 |
|
| 437 | + ) |
|
| 438 | + ); |
|
| 439 | 439 | |
| 440 | 440 | register_setting('xcloner_system_settings_group', 'xcloner_database_records_per_request', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 441 | - add_settings_field( |
|
| 442 | - 'xcloner_database_records_per_request', |
|
| 443 | - __('Database Records Per Request','xcloner-backup-and-restore'), |
|
| 444 | - array($this, 'do_form_range_field'), |
|
| 445 | - 'xcloner_system_settings_page', |
|
| 446 | - 'xcloner_system_settings_group', |
|
| 447 | - array('xcloner_database_records_per_request', |
|
| 448 | - __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records','xcloner-backup-and-restore'), |
|
| 449 | - 0, |
|
| 450 | - 100000 |
|
| 451 | - ) |
|
| 452 | - ); |
|
| 441 | + add_settings_field( |
|
| 442 | + 'xcloner_database_records_per_request', |
|
| 443 | + __('Database Records Per Request','xcloner-backup-and-restore'), |
|
| 444 | + array($this, 'do_form_range_field'), |
|
| 445 | + 'xcloner_system_settings_page', |
|
| 446 | + 'xcloner_system_settings_group', |
|
| 447 | + array('xcloner_database_records_per_request', |
|
| 448 | + __('Use this option to set how many database table records should be fetched per AJAX request, or set to 0 to fetch all. Range 0-100000 records','xcloner-backup-and-restore'), |
|
| 449 | + 0, |
|
| 450 | + 100000 |
|
| 451 | + ) |
|
| 452 | + ); |
|
| 453 | 453 | |
| 454 | 454 | register_setting('xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 455 | - add_settings_field( |
|
| 456 | - 'xcloner_exclude_files_larger_than_mb', |
|
| 457 | - __('Exclude files larger than (MB)','xcloner-backup-and-restore'), |
|
| 458 | - array($this, 'do_form_number_field'), |
|
| 459 | - 'xcloner_system_settings_page', |
|
| 460 | - 'xcloner_system_settings_group', |
|
| 461 | - array('xcloner_exclude_files_larger_than_mb', |
|
| 462 | - __('Use this option to automatically exclude files larger than a certain size in MB, or set to -1 to include all. Range 0-1000 MB','xcloner-backup-and-restore'), |
|
| 463 | - ) |
|
| 464 | - ); |
|
| 455 | + add_settings_field( |
|
| 456 | + 'xcloner_exclude_files_larger_than_mb', |
|
| 457 | + __('Exclude files larger than (MB)','xcloner-backup-and-restore'), |
|
| 458 | + array($this, 'do_form_number_field'), |
|
| 459 | + 'xcloner_system_settings_page', |
|
| 460 | + 'xcloner_system_settings_group', |
|
| 461 | + array('xcloner_exclude_files_larger_than_mb', |
|
| 462 | + __('Use this option to automatically exclude files larger than a certain size in MB, or set to -1 to include all. Range 0-1000 MB','xcloner-backup-and-restore'), |
|
| 463 | + ) |
|
| 464 | + ); |
|
| 465 | 465 | |
| 466 | 466 | register_setting('xcloner_system_settings_group', 'xcloner_split_backup_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 467 | - add_settings_field( |
|
| 468 | - 'xcloner_split_backup_limit', |
|
| 469 | - __('Split Backup Archive Limit (MB)','xcloner-backup-and-restore'), |
|
| 470 | - array($this, 'do_form_number_field'), |
|
| 471 | - 'xcloner_system_settings_page', |
|
| 472 | - 'xcloner_system_settings_group', |
|
| 473 | - array('xcloner_split_backup_limit', |
|
| 474 | - __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB','xcloner-backup-and-restore'), |
|
| 475 | - ) |
|
| 476 | - ); |
|
| 467 | + add_settings_field( |
|
| 468 | + 'xcloner_split_backup_limit', |
|
| 469 | + __('Split Backup Archive Limit (MB)','xcloner-backup-and-restore'), |
|
| 470 | + array($this, 'do_form_number_field'), |
|
| 471 | + 'xcloner_system_settings_page', |
|
| 472 | + 'xcloner_system_settings_group', |
|
| 473 | + array('xcloner_split_backup_limit', |
|
| 474 | + __('Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB','xcloner-backup-and-restore'), |
|
| 475 | + ) |
|
| 476 | + ); |
|
| 477 | 477 | |
| 478 | - register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root'); |
|
| 479 | - add_settings_field( |
|
| 480 | - 'xcloner_force_tmp_path_site_root', |
|
| 481 | - __('Force Temporary Path Within XCloner Storage','xcloner-backup-and-restore'), |
|
| 482 | - array($this, 'do_form_switch_field'), |
|
| 483 | - 'xcloner_system_settings_page', |
|
| 484 | - 'xcloner_system_settings_group', |
|
| 485 | - array('xcloner_force_tmp_path_site_root', |
|
| 478 | + register_setting('xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root'); |
|
| 479 | + add_settings_field( |
|
| 480 | + 'xcloner_force_tmp_path_site_root', |
|
| 481 | + __('Force Temporary Path Within XCloner Storage','xcloner-backup-and-restore'), |
|
| 482 | + array($this, 'do_form_switch_field'), |
|
| 483 | + 'xcloner_system_settings_page', |
|
| 484 | + 'xcloner_system_settings_group', |
|
| 485 | + array('xcloner_force_tmp_path_site_root', |
|
| 486 | 486 | sprintf(__('Enable this option if you want the XCloner Temporary Path to be within your XCloner Storage Location','xcloner-backup-and-restore'), $this->get_table_prefix()) |
| 487 | 487 | ) |
| 488 | - ); |
|
| 488 | + ); |
|
| 489 | 489 | |
| 490 | 490 | //REGISTERING THE 'CLEANUP SECTION' FIELDS |
| 491 | 491 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 492 | - add_settings_field( |
|
| 493 | - 'xcloner_cleanup_retention_limit_days', |
|
| 494 | - __('Cleanup by Date(days)','xcloner-backup-and-restore'), |
|
| 495 | - array($this, 'do_form_number_field'), |
|
| 496 | - 'xcloner_cleanup_settings_page', |
|
| 497 | - 'xcloner_cleanup_settings_group', |
|
| 498 | - array('xcloner_cleanup_retention_limit_days', |
|
| 492 | + add_settings_field( |
|
| 493 | + 'xcloner_cleanup_retention_limit_days', |
|
| 494 | + __('Cleanup by Date(days)','xcloner-backup-and-restore'), |
|
| 495 | + array($this, 'do_form_number_field'), |
|
| 496 | + 'xcloner_cleanup_settings_page', |
|
| 497 | + 'xcloner_cleanup_settings_group', |
|
| 498 | + array('xcloner_cleanup_retention_limit_days', |
|
| 499 | 499 | __('Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option','xcloner-backup-and-restore') |
| 500 | 500 | ) |
| 501 | - ); |
|
| 501 | + ); |
|
| 502 | 502 | |
| 503 | 503 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 504 | - add_settings_field( |
|
| 505 | - 'xcloner_cleanup_retention_limit_archives', |
|
| 506 | - __('Cleanup by Quantity','xcloner-backup-and-restore'), |
|
| 507 | - array($this, 'do_form_number_field'), |
|
| 508 | - 'xcloner_cleanup_settings_page', |
|
| 509 | - 'xcloner_cleanup_settings_group', |
|
| 510 | - array('xcloner_cleanup_retention_limit_archives', |
|
| 504 | + add_settings_field( |
|
| 505 | + 'xcloner_cleanup_retention_limit_archives', |
|
| 506 | + __('Cleanup by Quantity','xcloner-backup-and-restore'), |
|
| 507 | + array($this, 'do_form_number_field'), |
|
| 508 | + 'xcloner_cleanup_settings_page', |
|
| 509 | + 'xcloner_cleanup_settings_group', |
|
| 510 | + array('xcloner_cleanup_retention_limit_archives', |
|
| 511 | 511 | __('Specify the maximum number of backup archives to keep on the server. 0 disables this option','xcloner-backup-and-restore') |
| 512 | 512 | ) |
| 513 | - ); |
|
| 513 | + ); |
|
| 514 | 514 | |
| 515 | 515 | register_setting('xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
| 516 | - add_settings_field( |
|
| 517 | - 'xcloner_cleanup_capacity_limit', |
|
| 518 | - __('Cleanup by Capacity(MB)','xcloner-backup-and-restore'), |
|
| 519 | - array($this, 'do_form_number_field'), |
|
| 520 | - 'xcloner_cleanup_settings_page', |
|
| 521 | - 'xcloner_cleanup_settings_group', |
|
| 522 | - array('xcloner_cleanup_capacity_limit', |
|
| 516 | + add_settings_field( |
|
| 517 | + 'xcloner_cleanup_capacity_limit', |
|
| 518 | + __('Cleanup by Capacity(MB)','xcloner-backup-and-restore'), |
|
| 519 | + array($this, 'do_form_number_field'), |
|
| 520 | + 'xcloner_cleanup_settings_page', |
|
| 521 | + 'xcloner_cleanup_settings_group', |
|
| 522 | + array('xcloner_cleanup_capacity_limit', |
|
| 523 | 523 | __('Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option','xcloner-backup-and-restore') |
| 524 | 524 | ) |
| 525 | - ); |
|
| 525 | + ); |
|
| 526 | 526 | |
| 527 | 527 | //REGISTERING THE 'CRON SECTION' FIELDS |
| 528 | 528 | register_setting('xcloner_cron_settings_group', 'xcloner_cron_frequency'); |
| 529 | - add_settings_field( |
|
| 530 | - 'xcloner_cron_frequency', |
|
| 531 | - __('Cron frequency','xcloner-backup-and-restore'), |
|
| 532 | - array($this, 'do_form_text_field'), |
|
| 533 | - 'xcloner_cron_settings_page', |
|
| 534 | - 'xcloner_cron_settings_group', |
|
| 535 | - array('xcloner_cron_frequency', |
|
| 529 | + add_settings_field( |
|
| 530 | + 'xcloner_cron_frequency', |
|
| 531 | + __('Cron frequency','xcloner-backup-and-restore'), |
|
| 532 | + array($this, 'do_form_text_field'), |
|
| 533 | + 'xcloner_cron_settings_page', |
|
| 534 | + 'xcloner_cron_settings_group', |
|
| 535 | + array('xcloner_cron_frequency', |
|
| 536 | 536 | __('Cron frequency') |
| 537 | 537 | ) |
| 538 | - ); |
|
| 538 | + ); |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | // section content cb |
| 549 | 549 | public function xcloner_settings_section_cb() |
| 550 | 550 | { |
| 551 | - //echo '<p>WPOrg Section Introduction.</p>'; |
|
| 551 | + //echo '<p>WPOrg Section Introduction.</p>'; |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | // text field content cb |
@@ -563,8 +563,8 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | if(!$value) |
| 565 | 565 | $value = get_option($fieldname); |
| 566 | - // output the field |
|
| 567 | - ?> |
|
| 566 | + // output the field |
|
| 567 | + ?> |
|
| 568 | 568 | <div class="row"> |
| 569 | 569 | <div class="input-field col s10 m10 l8"> |
| 570 | 570 | <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
@@ -590,8 +590,8 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | if(!$value) |
| 592 | 592 | $value = get_option($fieldname); |
| 593 | - // output the field |
|
| 594 | - ?> |
|
| 593 | + // output the field |
|
| 594 | + ?> |
|
| 595 | 595 | <div class="row"> |
| 596 | 596 | <div class="input-field col s10 m10 l8"> |
| 597 | 597 | <textarea class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="text" class="validate" value=""><?php echo isset($value) ? esc_attr($value) : ''; ?></textarea> |
@@ -633,8 +633,8 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | if(!$value) |
| 635 | 635 | $value = get_option($fieldname); |
| 636 | - // output the field |
|
| 637 | - ?> |
|
| 636 | + // output the field |
|
| 637 | + ?> |
|
| 638 | 638 | <div class="row"> |
| 639 | 639 | <div class="input-field col s10 m5 l3"> |
| 640 | 640 | <input class="validate" <?php echo ($disabled)?"disabled":""?> name="<?php echo $fieldname?>" id="<?php echo $fieldname?>" type="number" class="validate" value="<?php echo isset($value) ? esc_attr($value) : ''; ?>"> |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
| 248 | 248 | |
| 249 | 249 | //wp_localize_script( 'ajax-script', 'my_ajax_object', |
| 250 | - // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
| 250 | + // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
| 251 | 251 | |
| 252 | 252 | } |
| 253 | 253 | |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | private function define_plugin_settings(){ |
| 283 | 283 | /** |
| 284 | - * register wporg_settings_init to the admin_init action hook |
|
| 285 | - */ |
|
| 284 | + * register wporg_settings_init to the admin_init action hook |
|
| 285 | + */ |
|
| 286 | 286 | $settings = new Xcloner_Settings(); |
| 287 | 287 | add_action('admin_init', array($settings, 'settings_init')); |
| 288 | 288 | } |
@@ -316,15 +316,15 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | function friendly_error_type($type) { |
| 319 | - static $levels=null; |
|
| 320 | - if ($levels===null) { |
|
| 321 | - $levels=[]; |
|
| 322 | - foreach (get_defined_constants() as $key=>$value) { |
|
| 323 | - if (strpos($key,'E_')!==0) {continue;} |
|
| 319 | + static $levels=null; |
|
| 320 | + if ($levels===null) { |
|
| 321 | + $levels=[]; |
|
| 322 | + foreach (get_defined_constants() as $key=>$value) { |
|
| 323 | + if (strpos($key,'E_')!==0) {continue;} |
|
| 324 | 324 | $levels[$value]= $key; //substr($key,2); |
| 325 | - } |
|
| 326 | - } |
|
| 327 | - return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | + return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | private function define_ajax_hooks() |
@@ -355,20 +355,20 @@ discard block |
||
| 355 | 355 | add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
| 356 | 356 | |
| 357 | 357 | //if (is_admin()) { |
| 358 | - add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2); |
|
| 359 | - } |
|
| 358 | + add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2); |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | function add_plugin_action_links($links, $file) { |
| 364 | - if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
| 364 | + if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
| 365 | 365 | { |
| 366 | 366 | $links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>'; |
| 367 | 367 | $links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>'; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - return $links; |
|
| 371 | - } |
|
| 370 | + return $links; |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | 373 | public function xcloner_error_admin_notices() { |
| 374 | 374 | settings_errors( 'xcloner_error_message' ); |
@@ -200,12 +200,12 @@ discard block |
||
| 200 | 200 | $scheduler->update_cron_hook($_POST['id']); |
| 201 | 201 | |
| 202 | 202 | if( $wpdb->last_error ) { |
| 203 | - $response['error'] = 1; |
|
| 204 | - $response['error_message'] = $wpdb->last_error/*."--".$wpdb->last_query*/; |
|
| 203 | + $response['error'] = 1; |
|
| 204 | + $response['error_message'] = $wpdb->last_error/*."--".$wpdb->last_query*/; |
|
| 205 | 205 | |
| 206 | - } |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | - $scheduler->update_wp_cron_hooks(); |
|
| 208 | + $scheduler->update_wp_cron_hooks(); |
|
| 209 | 209 | $response['finished'] = 1; |
| 210 | 210 | |
| 211 | 211 | $this->send_response($response); |
@@ -851,14 +851,14 @@ discard block |
||
| 851 | 851 | $tar->close(); |
| 852 | 852 | |
| 853 | 853 | if (file_exists($tmp_file)) { |
| 854 | - header('Content-Description: File Transfer'); |
|
| 855 | - header('Content-Type: application/octet-stream'); |
|
| 856 | - header('Content-Disposition: attachment; filename="'.basename($tmp_file).'"'); |
|
| 857 | - header('Expires: 0'); |
|
| 858 | - header('Cache-Control: must-revalidate'); |
|
| 859 | - header('Pragma: public'); |
|
| 860 | - header('Content-Length: ' . filesize($tmp_file)); |
|
| 861 | - readfile($tmp_file); |
|
| 854 | + header('Content-Description: File Transfer'); |
|
| 855 | + header('Content-Type: application/octet-stream'); |
|
| 856 | + header('Content-Disposition: attachment; filename="'.basename($tmp_file).'"'); |
|
| 857 | + header('Expires: 0'); |
|
| 858 | + header('Cache-Control: must-revalidate'); |
|
| 859 | + header('Pragma: public'); |
|
| 860 | + header('Content-Length: ' . filesize($tmp_file)); |
|
| 861 | + readfile($tmp_file); |
|
| 862 | 862 | |
| 863 | 863 | } |
| 864 | 864 | |
@@ -888,25 +888,25 @@ discard block |
||
| 888 | 888 | |
| 889 | 889 | |
| 890 | 890 | header('Pragma: public'); |
| 891 | - header('Expires: 0'); |
|
| 892 | - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
| 893 | - header('Cache-Control: private', false); |
|
| 894 | - header('Content-Transfer-Encoding: binary'); |
|
| 895 | - header('Content-Disposition: attachment; filename="'.$metadata['path'].'";'); |
|
| 896 | - //header('Content-Type: ' . $mimetype); |
|
| 897 | - header('Content-Type: application/octet-stream'); |
|
| 898 | - header('Content-Length: ' . $metadata['size']); |
|
| 891 | + header('Expires: 0'); |
|
| 892 | + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
| 893 | + header('Cache-Control: private', false); |
|
| 894 | + header('Content-Transfer-Encoding: binary'); |
|
| 895 | + header('Content-Disposition: attachment; filename="'.$metadata['path'].'";'); |
|
| 896 | + //header('Content-Type: ' . $mimetype); |
|
| 897 | + header('Content-Type: application/octet-stream'); |
|
| 898 | + header('Content-Length: ' . $metadata['size']); |
|
| 899 | 899 | |
| 900 | - @ob_end_clean(); |
|
| 900 | + @ob_end_clean(); |
|
| 901 | 901 | |
| 902 | - $chunkSize = 1024 * 1024; |
|
| 903 | - while (!feof($read_stream)) |
|
| 904 | - { |
|
| 905 | - $buffer = fread($read_stream, $chunkSize); |
|
| 906 | - echo $buffer; |
|
| 907 | - } |
|
| 908 | - fclose($read_stream); |
|
| 909 | - exit; |
|
| 902 | + $chunkSize = 1024 * 1024; |
|
| 903 | + while (!feof($read_stream)) |
|
| 904 | + { |
|
| 905 | + $buffer = fread($read_stream, $chunkSize); |
|
| 906 | + echo $buffer; |
|
| 907 | + } |
|
| 908 | + fclose($read_stream); |
|
| 909 | + exit; |
|
| 910 | 910 | |
| 911 | 911 | } |
| 912 | 912 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $this->log(sprintf(__("Excluding table %s.%s from backup"), $table, $database)); |
| 280 | 280 | } |
| 281 | 281 | $inc++; |
| 282 | - } |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | 284 | return $tablesList; |
| 285 | 285 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | $buffer = ""; |
| 504 | 504 | $this->countRecords++; |
| 505 | 505 | |
| 506 | - foreach ($arr as $key => $value) { |
|
| 506 | + foreach ($arr as $key => $value) { |
|
| 507 | 507 | $value = $this->_real_escape($value); |
| 508 | 508 | $buffer .= "'".$value."', "; |
| 509 | 509 | } |
@@ -529,8 +529,8 @@ discard block |
||
| 529 | 529 | $line = ("\n#\n# Table structure for table `$tableName`\n#\n\n"); |
| 530 | 530 | $this->fs->get_tmp_filesystem_append()->write($dumpfile, $line); |
| 531 | 531 | |
| 532 | - if ($this->dbDropSyntax) |
|
| 533 | - { |
|
| 532 | + if ($this->dbDropSyntax) |
|
| 533 | + { |
|
| 534 | 534 | $line = ("\nDROP table IF EXISTS `$tableName`;\n"); |
| 535 | 535 | $this->fs->get_tmp_filesystem_append()->write($dumpfile, $line); |
| 536 | 536 | } |
@@ -147,14 +147,14 @@ |
||
| 147 | 147 | $unit_list = array('B', 'KB', 'MB', 'GB', 'PB'); |
| 148 | 148 | |
| 149 | 149 | if ($bytes == 0) { |
| 150 | - return $bytes . ' ' . $unit_list[0]; |
|
| 150 | + return $bytes . ' ' . $unit_list[0]; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $unit_count = count($unit_list); |
| 154 | 154 | for ($i = $unit_count - 1; $i >= 0; $i--) { |
| 155 | - $power = $i * 10; |
|
| 156 | - if (($bytes >> $power) >= 1) |
|
| 157 | - return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
| 155 | + $power = $i * 10; |
|
| 156 | + if (($bytes >> $power) >= 1) |
|
| 157 | + return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | $this->logger->info(sprintf("Creating the AZURE BLOB remote storage connection"), array("")); |
| 255 | 255 | |
| 256 | 256 | $endpoint = sprintf( |
| 257 | - 'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s', |
|
| 258 | - get_option("xcloner_azure_account_name"), |
|
| 259 | - get_option("xcloner_azure_api_key") |
|
| 257 | + 'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s', |
|
| 258 | + get_option("xcloner_azure_account_name"), |
|
| 259 | + get_option("xcloner_azure_api_key") |
|
| 260 | 260 | ); |
| 261 | 261 | |
| 262 | 262 | $blobRestProxy = ServicesBuilder::getInstance()->createBlobService($endpoint); |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | |
| 295 | 295 | $client = new S3Client([ |
| 296 | - 'credentials' => [ |
|
| 297 | - 'key' => get_option("xcloner_aws_key"), |
|
| 298 | - 'secret' => get_option("xcloner_aws_secret") |
|
| 299 | - ], |
|
| 300 | - 'region' => get_option("xcloner_aws_region"), |
|
| 301 | - 'version' => 'latest', |
|
| 296 | + 'credentials' => [ |
|
| 297 | + 'key' => get_option("xcloner_aws_key"), |
|
| 298 | + 'secret' => get_option("xcloner_aws_secret") |
|
| 299 | + ], |
|
| 300 | + 'region' => get_option("xcloner_aws_region"), |
|
| 301 | + 'version' => 'latest', |
|
| 302 | 302 | ]); |
| 303 | 303 | |
| 304 | 304 | $adapter = new AwsS3Adapter($client, get_option("xcloner_aws_bucket_name")); |
@@ -332,16 +332,16 @@ discard block |
||
| 332 | 332 | $this->logger->info(sprintf("Creating the FTP remote storage connection"), array("")); |
| 333 | 333 | |
| 334 | 334 | $adapter = new Adapter([ |
| 335 | - 'host' => get_option("xcloner_ftp_hostname"), |
|
| 336 | - 'username' => get_option("xcloner_ftp_username"), |
|
| 337 | - 'password' => get_option("xcloner_ftp_password"), |
|
| 338 | - |
|
| 339 | - /** optional config settings */ |
|
| 340 | - 'port' => get_option("xcloner_ftp_port", 21), |
|
| 341 | - 'root' => get_option("xcloner_ftp_path"), |
|
| 342 | - 'passive' => get_option("xcloner_ftp_transfer_mode"), |
|
| 343 | - 'ssl' => get_option("xcloner_ftp_ssl_mode"), |
|
| 344 | - 'timeout' => get_option("xcloner_ftp_timeout", 30), |
|
| 335 | + 'host' => get_option("xcloner_ftp_hostname"), |
|
| 336 | + 'username' => get_option("xcloner_ftp_username"), |
|
| 337 | + 'password' => get_option("xcloner_ftp_password"), |
|
| 338 | + |
|
| 339 | + /** optional config settings */ |
|
| 340 | + 'port' => get_option("xcloner_ftp_port", 21), |
|
| 341 | + 'root' => get_option("xcloner_ftp_path"), |
|
| 342 | + 'passive' => get_option("xcloner_ftp_transfer_mode"), |
|
| 343 | + 'ssl' => get_option("xcloner_ftp_ssl_mode"), |
|
| 344 | + 'timeout' => get_option("xcloner_ftp_timeout", 30), |
|
| 345 | 345 | ]); |
| 346 | 346 | |
| 347 | 347 | $adapter->connect(); |
@@ -358,15 +358,15 @@ discard block |
||
| 358 | 358 | $this->logger->info(sprintf("Creating the SFTP remote storage connection"), array("")); |
| 359 | 359 | |
| 360 | 360 | $adapter = new SftpAdapter([ |
| 361 | - 'host' => get_option("xcloner_sftp_hostname"), |
|
| 362 | - 'username' => get_option("xcloner_sftp_username"), |
|
| 363 | - 'password' => get_option("xcloner_sftp_password"), |
|
| 364 | - |
|
| 365 | - /** optional config settings */ |
|
| 366 | - 'port' => get_option("xcloner_sftp_port", 22), |
|
| 367 | - 'root' => get_option("xcloner_sftp_path"), |
|
| 368 | - 'privateKey' => get_option("xcloner_sftp_private_key"), |
|
| 369 | - 'timeout' => get_option("xcloner_ftp_timeout", 30), |
|
| 361 | + 'host' => get_option("xcloner_sftp_hostname"), |
|
| 362 | + 'username' => get_option("xcloner_sftp_username"), |
|
| 363 | + 'password' => get_option("xcloner_sftp_password"), |
|
| 364 | + |
|
| 365 | + /** optional config settings */ |
|
| 366 | + 'port' => get_option("xcloner_sftp_port", 22), |
|
| 367 | + 'root' => get_option("xcloner_sftp_path"), |
|
| 368 | + 'privateKey' => get_option("xcloner_sftp_private_key"), |
|
| 369 | + 'timeout' => get_option("xcloner_ftp_timeout", 30), |
|
| 370 | 370 | ]); |
| 371 | 371 | |
| 372 | 372 | $adapter->connect(); |
@@ -555,15 +555,15 @@ discard block |
||
| 555 | 555 | return array($bytes_wrote, $last_position); |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | - /** |
|
| 559 | - * Open a TAR archive and put the file cursor at the end for data appending |
|
| 560 | - * |
|
| 561 | - * If $file is empty, the tar file will be created in memory |
|
| 562 | - * |
|
| 563 | - * @param string $file |
|
| 564 | - * @throws ArchiveIOException |
|
| 565 | - */ |
|
| 566 | - /* |
|
| 558 | + /** |
|
| 559 | + * Open a TAR archive and put the file cursor at the end for data appending |
|
| 560 | + * |
|
| 561 | + * If $file is empty, the tar file will be created in memory |
|
| 562 | + * |
|
| 563 | + * @param string $file |
|
| 564 | + * @throws ArchiveIOException |
|
| 565 | + */ |
|
| 566 | + /* |
|
| 567 | 567 | public function openForAppend($file = '') |
| 568 | 568 | { |
| 569 | 569 | $this->file = $file; |
@@ -593,16 +593,16 @@ discard block |
||
| 593 | 593 | } |
| 594 | 594 | */ |
| 595 | 595 | |
| 596 | - /** |
|
| 597 | - * Append data to a file to the current TAR archive using an existing file in the filesystem |
|
| 598 | - * |
|
| 599 | - * @param string $file path to the original file |
|
| 600 | - * @param int $start starting reading position in file |
|
| 601 | - * @param int $end end position in reading multiple with 512 |
|
| 602 | - * @param string|FileInfo $fileinfo either the name to us in archive (string) or a FileInfo oject with all meta data, empty to take from original |
|
| 603 | - * @throws ArchiveIOException |
|
| 604 | - */ |
|
| 605 | - /* |
|
| 596 | + /** |
|
| 597 | + * Append data to a file to the current TAR archive using an existing file in the filesystem |
|
| 598 | + * |
|
| 599 | + * @param string $file path to the original file |
|
| 600 | + * @param int $start starting reading position in file |
|
| 601 | + * @param int $end end position in reading multiple with 512 |
|
| 602 | + * @param string|FileInfo $fileinfo either the name to us in archive (string) or a FileInfo oject with all meta data, empty to take from original |
|
| 603 | + * @throws ArchiveIOException |
|
| 604 | + */ |
|
| 605 | + /* |
|
| 606 | 606 | * public function appendFileData($file, $fileinfo = '', $start = 0, $limit = 0) |
| 607 | 607 | { |
| 608 | 608 | $end = $start+($limit*512); |
@@ -658,14 +658,14 @@ discard block |
||
| 658 | 658 | return $last_position; |
| 659 | 659 | }*/ |
| 660 | 660 | |
| 661 | - /** |
|
| 662 | - * Adds a file to a TAR archive by appending it's data |
|
| 663 | - * |
|
| 664 | - * @param string $archive name of the archive file |
|
| 665 | - * @param string $file name of the file to read data from |
|
| 666 | - * @param string $start start position from where to start reading data |
|
| 667 | - * @throws ArchiveIOException |
|
| 668 | - */ |
|
| 661 | + /** |
|
| 662 | + * Adds a file to a TAR archive by appending it's data |
|
| 663 | + * |
|
| 664 | + * @param string $archive name of the archive file |
|
| 665 | + * @param string $file name of the file to read data from |
|
| 666 | + * @param string $start start position from where to start reading data |
|
| 667 | + * @throws ArchiveIOException |
|
| 668 | + */ |
|
| 669 | 669 | /*public function addFileToArchive($archive, $file, $start = 0) |
| 670 | 670 | { |
| 671 | 671 | $this->openForAppend($archive); |
@@ -99,9 +99,9 @@ |
||
| 99 | 99 | function xcloner_display() |
| 100 | 100 | { |
| 101 | 101 | // check user capabilities |
| 102 | - if (!current_user_can('manage_options')) { |
|
| 103 | - return; |
|
| 104 | - } |
|
| 102 | + if (!current_user_can('manage_options')) { |
|
| 103 | + return; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | $page = sanitize_key($_GET['page']); |
| 107 | 107 | $plugin = new Xcloner(); |