| Conditions | 5 |
| Paths | 16 |
| Total Lines | 490 |
| Code Lines | 340 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 232 | public function settings_init() { |
||
| 233 | global $wpdb; |
||
| 234 | $this->xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
||
| 235 | |||
| 236 | //ADDING MISSING OPTIONS |
||
| 237 | if (false == get_option('xcloner_mysql_settings_page')) { |
||
| 238 | add_option('xcloner_mysql_settings_page'); |
||
| 239 | } // end if |
||
| 240 | |||
| 241 | if (false == get_option('xcloner_cron_settings_page')) { |
||
| 242 | add_option('xcloner_cron_settings_page'); |
||
| 243 | } // end if |
||
| 244 | |||
| 245 | if (false == get_option('xcloner_system_settings_page')) { |
||
| 246 | add_option('xcloner_system_settings_page'); |
||
| 247 | } // end if |
||
| 248 | |||
| 249 | if (false == get_option('xcloner_cleanup_settings_page')) { |
||
| 250 | add_option('xcloner_cleanup_settings_page'); |
||
| 251 | } // end if |
||
| 252 | |||
| 253 | |||
| 254 | //ADDING SETTING SECTIONS |
||
| 255 | //GENERAL section |
||
| 256 | add_settings_section( |
||
| 257 | 'xcloner_general_settings_group', |
||
| 258 | __(' '), |
||
| 259 | array($this, 'xcloner_settings_section_cb'), |
||
| 260 | 'xcloner_settings_page' |
||
| 261 | ); |
||
| 262 | //MYSQL section |
||
| 263 | add_settings_section( |
||
| 264 | 'xcloner_mysql_settings_group', |
||
| 265 | __(' '), |
||
| 266 | array($this, 'xcloner_settings_section_cb'), |
||
| 267 | 'xcloner_mysql_settings_page' |
||
| 268 | ); |
||
| 269 | |||
| 270 | //SYSTEM section |
||
| 271 | add_settings_section( |
||
| 272 | 'xcloner_system_settings_group', |
||
| 273 | __('These are advanced options recommended for developers!', 'xcloner-backup-and-restore'), |
||
| 274 | array($this, 'xcloner_settings_section_cb'), |
||
| 275 | 'xcloner_system_settings_page' |
||
| 276 | ); |
||
| 277 | |||
| 278 | //CLEANUP section |
||
| 279 | add_settings_section( |
||
| 280 | 'xcloner_cleanup_settings_group', |
||
| 281 | __(' '), |
||
| 282 | array($this, 'xcloner_settings_section_cb'), |
||
| 283 | 'xcloner_cleanup_settings_page' |
||
| 284 | ); |
||
| 285 | |||
| 286 | |||
| 287 | //CRON section |
||
| 288 | add_settings_section( |
||
| 289 | 'xcloner_cron_settings_group', |
||
| 290 | __( ' ' ), |
||
| 291 | array( $this, 'xcloner_settings_section_cb' ), |
||
| 292 | 'xcloner_cron_settings_page' |
||
| 293 | ); |
||
| 294 | |||
| 295 | |||
| 296 | //REGISTERING THE 'GENERAL SECTION' FIELDS |
||
| 297 | register_setting( 'xcloner_general_settings_group', 'xcloner_backup_compression_level', array( |
||
| 298 | $this->xcloner_sanitization, |
||
| 299 | "sanitize_input_as_int" |
||
| 300 | ) ); |
||
| 301 | add_settings_field( |
||
| 302 | 'xcloner_backup_compression_level', |
||
| 303 | __( 'Backup Compression Level', 'xcloner-backup-and-restore' ), |
||
| 304 | array( $this, 'do_form_range_field' ), |
||
| 305 | 'xcloner_settings_page', |
||
| 306 | 'xcloner_general_settings_group', |
||
| 307 | array( |
||
| 308 | 'xcloner_backup_compression_level', |
||
| 309 | __( 'Options between [0-9]. Value 0 means no compression, while 9 is maximum compression affecting cpu load', 'xcloner-backup-and-restore' ), |
||
| 310 | 0, |
||
| 311 | 9 |
||
| 312 | ) |
||
| 313 | ); |
||
| 314 | |||
| 315 | register_setting( 'xcloner_general_settings_group', 'xcloner_start_path', array( |
||
| 316 | $this->xcloner_sanitization, |
||
| 317 | "sanitize_input_as_absolute_path" |
||
| 318 | ) ); |
||
| 319 | add_settings_field( |
||
| 320 | 'xcloner_start_path', |
||
| 321 | __( 'Backup Start Location', 'xcloner-backup-and-restore' ), |
||
| 322 | array( $this, 'do_form_text_field' ), |
||
| 323 | 'xcloner_settings_page', |
||
| 324 | 'xcloner_general_settings_group', |
||
| 325 | array( |
||
| 326 | 'xcloner_start_path', |
||
| 327 | __( 'Base path location from where XCloner can start the Backup.', 'xcloner-backup-and-restore' ), |
||
| 328 | $this->get_xcloner_start_path(), |
||
| 329 | //'disabled' |
||
| 330 | ) |
||
| 331 | ); |
||
| 332 | |||
| 333 | register_setting( 'xcloner_general_settings_group', 'xcloner_store_path', array( |
||
| 334 | $this->xcloner_sanitization, |
||
| 335 | "sanitize_input_as_absolute_path" |
||
| 336 | ) ); |
||
| 337 | add_settings_field( |
||
| 338 | 'xcloner_store_path', |
||
| 339 | __( 'Backup Storage Location', 'xcloner-backup-and-restore' ), |
||
| 340 | array( $this, 'do_form_text_field' ), |
||
| 341 | 'xcloner_settings_page', |
||
| 342 | 'xcloner_general_settings_group', |
||
| 343 | array( |
||
| 344 | 'xcloner_store_path', |
||
| 345 | __( 'Location where XCloner will store the Backup archives.', 'xcloner-backup-and-restore' ), |
||
| 346 | $this->get_xcloner_store_path(), |
||
| 347 | //'disabled' |
||
| 348 | ) |
||
| 349 | ); |
||
| 350 | |||
| 351 | register_setting( 'xcloner_general_settings_group', 'xcloner_encryption_key', array( |
||
| 352 | $this->xcloner_sanitization, |
||
| 353 | "sanitize_input_as_string" |
||
| 354 | ) ); |
||
| 355 | add_settings_field( |
||
| 356 | 'xcloner_encryption_key', |
||
| 357 | __( 'Backup Encryption Key', 'xcloner-backup-and-restore' ), |
||
| 358 | array( $this, 'do_form_text_field' ), |
||
| 359 | 'xcloner_settings_page', |
||
| 360 | 'xcloner_general_settings_group', |
||
| 361 | array( |
||
| 362 | 'xcloner_encryption_key', |
||
| 363 | __( 'Backup Encryption Key used to Encrypt/Decrypt backups, you might want to save this somewhere else as well.', 'xcloner-backup-and-restore' ), |
||
| 364 | $this->get_xcloner_encryption_key(), |
||
| 365 | //'disabled' |
||
| 366 | ) |
||
| 367 | ); |
||
| 368 | |||
| 369 | register_setting( 'xcloner_general_settings_group', 'xcloner_enable_log', array( |
||
| 370 | $this->xcloner_sanitization, |
||
| 371 | "sanitize_input_as_int" |
||
| 372 | ) ); |
||
| 373 | add_settings_field( |
||
| 374 | 'xcloner_enable_log', |
||
| 375 | __( 'Enable XCloner Backup Log', 'xcloner-backup-and-restore' ), |
||
| 376 | array( $this, 'do_form_switch_field' ), |
||
| 377 | 'xcloner_settings_page', |
||
| 378 | 'xcloner_general_settings_group', |
||
| 379 | array( |
||
| 380 | 'xcloner_enable_log', |
||
| 381 | 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() ) |
||
| 382 | ) |
||
| 383 | ); |
||
| 384 | |||
| 385 | register_setting( 'xcloner_general_settings_group', 'xcloner_enable_pre_update_backup', array( |
||
| 386 | $this->xcloner_sanitization, |
||
| 387 | "sanitize_input_as_int" |
||
| 388 | ) ); |
||
| 389 | add_settings_field( |
||
| 390 | 'xcloner_enable_pre_update_backup', |
||
| 391 | __( 'Generate Backups before Automatic WP Upgrades', 'xcloner-backup-and-restore' ), |
||
| 392 | array( $this, 'do_form_switch_field' ), |
||
| 393 | 'xcloner_settings_page', |
||
| 394 | 'xcloner_general_settings_group', |
||
| 395 | array( |
||
| 396 | 'xcloner_enable_pre_update_backup', |
||
| 397 | sprintf( __( 'Attempt to generate a core, plugins, themes or languages files backup before the automatic update of Wordpress core, plugins, themes or languages files.', 'xcloner-backup-and-restore' ), $this->get_logger_filename() ) |
||
| 398 | ) |
||
| 399 | ); |
||
| 400 | |||
| 401 | register_setting( 'xcloner_general_settings_group', 'xcloner_regex_exclude', array( |
||
| 402 | $this->xcloner_sanitization, |
||
| 403 | "sanitize_input_as_raw" |
||
| 404 | ) ); |
||
| 405 | add_settings_field( |
||
| 406 | 'xcloner_regex_exclude', |
||
| 407 | __( 'Regex Exclude Files', 'xcloner-backup-and-restore' ), |
||
| 408 | array( $this, 'do_form_textarea_field' ), |
||
| 409 | 'xcloner_settings_page', |
||
| 410 | 'xcloner_general_settings_group', |
||
| 411 | array( |
||
| 412 | 'xcloner_regex_exclude', |
||
| 413 | __( 'Regular expression match to exclude files and folders, example patterns provided below, one pattern per line', 'xcloner-backup-and-restore' ), |
||
| 414 | //$this->get_xcloner_store_path(), |
||
| 415 | //'disabled' |
||
| 416 | ) |
||
| 417 | ); |
||
| 418 | |||
| 419 | //REGISTERING THE 'MYSQL SECTION' FIELDS |
||
| 420 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_enable_mysql_backup', array( |
||
| 421 | $this->xcloner_sanitization, |
||
| 422 | "sanitize_input_as_int" |
||
| 423 | ) ); |
||
| 424 | add_settings_field( |
||
| 425 | 'xcloner_enable_mysql_backup', |
||
| 426 | __( 'Enable Mysql Backup', 'xcloner-backup-and-restore' ), |
||
| 427 | array( $this, 'do_form_switch_field' ), |
||
| 428 | 'xcloner_mysql_settings_page', |
||
| 429 | 'xcloner_mysql_settings_group', |
||
| 430 | array( |
||
| 431 | 'xcloner_enable_mysql_backup', |
||
| 432 | __( 'Enable Mysql Backup Option. If you don\'t want to backup the database, you can disable this.', 'xcloner-backup-and-restore' ) |
||
| 433 | ) |
||
| 434 | ); |
||
| 435 | |||
| 436 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_backup_only_wp_tables' ); |
||
| 437 | add_settings_field( |
||
| 438 | 'xcloner_backup_only_wp_tables', |
||
| 439 | __( 'Backup only WP tables', 'xcloner-backup-and-restore' ), |
||
| 440 | array( $this, 'do_form_switch_field' ), |
||
| 441 | 'xcloner_mysql_settings_page', |
||
| 442 | 'xcloner_mysql_settings_group', |
||
| 443 | array( |
||
| 444 | 'xcloner_backup_only_wp_tables', |
||
| 445 | sprintf( __( 'Enable this if you only want to Backup only tables starting with \'%s\' prefix', 'xcloner-backup-and-restore' ), $this->get_table_prefix() ) |
||
| 446 | ) |
||
| 447 | ); |
||
| 448 | |||
| 449 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_mysql_hostname', array( |
||
| 450 | $this->xcloner_sanitization, |
||
| 451 | "sanitize_input_as_raw" |
||
| 452 | ) ); |
||
| 453 | add_settings_field( |
||
| 454 | 'xcloner_mysql_hostname', |
||
| 455 | __( 'Mysql Hostname', 'xcloner-backup-and-restore' ), |
||
| 456 | array( $this, 'do_form_text_field' ), |
||
| 457 | 'xcloner_mysql_settings_page', |
||
| 458 | 'xcloner_mysql_settings_group', |
||
| 459 | array( |
||
| 460 | 'xcloner_mysql_hostname', |
||
| 461 | __( 'Wordpress mysql hostname', 'xcloner-backup-and-restore' ), |
||
| 462 | $this->get_db_hostname(), |
||
| 463 | 'disabled' |
||
| 464 | ) |
||
| 465 | ); |
||
| 466 | |||
| 467 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_mysql_username', array( |
||
| 468 | $this->xcloner_sanitization, |
||
| 469 | "sanitize_input_as_raw" |
||
| 470 | ) ); |
||
| 471 | add_settings_field( |
||
| 472 | 'xcloner_mysql_username', |
||
| 473 | __( 'Mysql Username', 'xcloner-backup-and-restore' ), |
||
| 474 | array( $this, 'do_form_text_field' ), |
||
| 475 | 'xcloner_mysql_settings_page', |
||
| 476 | 'xcloner_mysql_settings_group', |
||
| 477 | array( |
||
| 478 | 'xcloner_mysql_username', |
||
| 479 | __( 'Wordpress mysql username', 'xcloner-backup-and-restore' ), |
||
| 480 | $this->get_db_username(), |
||
| 481 | 'disabled' |
||
| 482 | ) |
||
| 483 | ); |
||
| 484 | |||
| 485 | register_setting( 'xcloner_mysql_settings_group', 'xcloner_mysql_database', array( |
||
| 486 | $this->xcloner_sanitization, |
||
| 487 | "sanitize_input_as_raw" |
||
| 488 | ) ); |
||
| 489 | add_settings_field( |
||
| 490 | 'xcloner_mysql_database', |
||
| 491 | __( 'Mysql Database', 'xcloner-backup-and-restore' ), |
||
| 492 | array( $this, 'do_form_text_field' ), |
||
| 493 | 'xcloner_mysql_settings_page', |
||
| 494 | 'xcloner_mysql_settings_group', |
||
| 495 | array( |
||
| 496 | 'xcloner_mysql_database', |
||
| 497 | __( 'Wordpress mysql database', 'xcloner-backup-and-restore' ), |
||
| 498 | $this->get_db_database(), |
||
| 499 | 'disabled' |
||
| 500 | ) |
||
| 501 | ); |
||
| 502 | |||
| 503 | //REGISTERING THE 'SYSTEM SECTION' FIELDS |
||
| 504 | register_setting( 'xcloner_system_settings_group', 'xcloner_size_limit_per_request', array( |
||
| 505 | $this->xcloner_sanitization, |
||
| 506 | "sanitize_input_as_int" |
||
| 507 | ) ); |
||
| 508 | add_settings_field( |
||
| 509 | 'xcloner_size_limit_per_request', |
||
| 510 | __( 'Data Size Limit Per Request', 'xcloner-backup-and-restore' ), |
||
| 511 | array( $this, 'do_form_range_field' ), |
||
| 512 | 'xcloner_system_settings_page', |
||
| 513 | 'xcloner_system_settings_group', |
||
| 514 | array( |
||
| 515 | 'xcloner_size_limit_per_request', |
||
| 516 | __( 'Use this option to set how much file data can XCloner backup in one AJAX request. Range 0-1024 MB', 'xcloner-backup-and-restore' ), |
||
| 517 | 0, |
||
| 518 | 1024 |
||
| 519 | ) |
||
| 520 | ); |
||
| 521 | |||
| 522 | register_setting( 'xcloner_system_settings_group', 'xcloner_files_to_process_per_request', array( |
||
| 523 | $this->xcloner_sanitization, |
||
| 524 | "sanitize_input_as_int" |
||
| 525 | ) ); |
||
| 526 | add_settings_field( |
||
| 527 | 'xcloner_files_to_process_per_request', |
||
| 528 | __( 'Files To Process Per Request', 'xcloner-backup-and-restore' ), |
||
| 529 | array( $this, 'do_form_range_field' ), |
||
| 530 | 'xcloner_system_settings_page', |
||
| 531 | 'xcloner_system_settings_group', |
||
| 532 | array( |
||
| 533 | 'xcloner_files_to_process_per_request', |
||
| 534 | __( 'Use this option to set how many files XCloner should process at one time before doing another AJAX call', 'xcloner-backup-and-restore' ), |
||
| 535 | 0, |
||
| 536 | 1000 |
||
| 537 | ) |
||
| 538 | ); |
||
| 539 | |||
| 540 | register_setting( 'xcloner_system_settings_group', 'xcloner_directories_to_scan_per_request', array( |
||
| 541 | $this->xcloner_sanitization, |
||
| 542 | "sanitize_input_as_int" |
||
| 543 | ) ); |
||
| 544 | add_settings_field( |
||
| 545 | 'xcloner_directories_to_scan_per_request', |
||
| 546 | __( 'Directories To Scan Per Request', 'xcloner-backup-and-restore' ), |
||
| 547 | array( $this, 'do_form_range_field' ), |
||
| 548 | 'xcloner_system_settings_page', |
||
| 549 | 'xcloner_system_settings_group', |
||
| 550 | array( |
||
| 551 | 'xcloner_directories_to_scan_per_request', |
||
| 552 | __( 'Use this option to set how many directories XCloner should scan at one time before doing another AJAX call', 'xcloner-backup-and-restore' ), |
||
| 553 | 0, |
||
| 554 | 1000 |
||
| 555 | ) |
||
| 556 | ); |
||
| 557 | |||
| 558 | register_setting( 'xcloner_system_settings_group', 'xcloner_database_records_per_request', array( |
||
| 559 | $this->xcloner_sanitization, |
||
| 560 | "sanitize_input_as_int" |
||
| 561 | ) ); |
||
| 562 | add_settings_field( |
||
| 563 | 'xcloner_database_records_per_request', |
||
| 564 | __( 'Database Records Per Request', 'xcloner-backup-and-restore' ), |
||
| 565 | array( $this, 'do_form_range_field' ), |
||
| 566 | 'xcloner_system_settings_page', |
||
| 567 | 'xcloner_system_settings_group', |
||
| 568 | array( |
||
| 569 | 'xcloner_database_records_per_request', |
||
| 570 | __( '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' ), |
||
| 571 | 0, |
||
| 572 | 100000 |
||
| 573 | ) |
||
| 574 | ); |
||
| 575 | |||
| 576 | /*register_setting('xcloner_system_settings_group', 'xcloner_diff_backup_recreate_period', array($this->xcloner_sanitization, "sanitize_input_as_int")); |
||
| 577 | add_settings_field( |
||
| 578 | 'xcloner_diff_backup_recreate_period', |
||
| 579 | __('Differetial Backups Max Days','xcloner-backup-and-restore'), |
||
| 580 | array($this, 'do_form_number_field'), |
||
| 581 | 'xcloner_system_settings_page', |
||
| 582 | 'xcloner_system_settings_group', |
||
| 583 | array('xcloner_diff_backup_recreate_period', |
||
| 584 | __('Use this option to set when a full backup should be recreated if the scheduled backup type is set to \'Full Backup+Differential Backups\' ','xcloner-backup-and-restore'), |
||
| 585 | ) |
||
| 586 | );*/ |
||
| 587 | |||
| 588 | register_setting( 'xcloner_system_settings_group', 'xcloner_exclude_files_larger_than_mb', array( |
||
| 589 | $this->xcloner_sanitization, |
||
| 590 | "sanitize_input_as_int" |
||
| 591 | ) ); |
||
| 592 | add_settings_field( |
||
| 593 | 'xcloner_exclude_files_larger_than_mb', |
||
| 594 | __( 'Exclude files larger than (MB)', 'xcloner-backup-and-restore' ), |
||
| 595 | array( $this, 'do_form_number_field' ), |
||
| 596 | 'xcloner_system_settings_page', |
||
| 597 | 'xcloner_system_settings_group', |
||
| 598 | array( |
||
| 599 | 'xcloner_exclude_files_larger_than_mb', |
||
| 600 | __( 'Use this option to automatically exclude files larger than a certain size in MB, or set to 0 to include all. Range 0-1000 MB', 'xcloner-backup-and-restore' ), |
||
| 601 | ) |
||
| 602 | ); |
||
| 603 | |||
| 604 | register_setting( 'xcloner_system_settings_group', 'xcloner_split_backup_limit', array( |
||
| 605 | $this->xcloner_sanitization, |
||
| 606 | "sanitize_input_as_int" |
||
| 607 | ) ); |
||
| 608 | add_settings_field( |
||
| 609 | 'xcloner_split_backup_limit', |
||
| 610 | __( 'Split Backup Archive Limit (MB)', 'xcloner-backup-and-restore' ), |
||
| 611 | array( $this, 'do_form_number_field' ), |
||
| 612 | 'xcloner_system_settings_page', |
||
| 613 | 'xcloner_system_settings_group', |
||
| 614 | array( |
||
| 615 | 'xcloner_split_backup_limit', |
||
| 616 | __( 'Use this option to automatically split the backup archive into smaller parts. Range 0-10000 MB', 'xcloner-backup-and-restore' ), |
||
| 617 | ) |
||
| 618 | ); |
||
| 619 | |||
| 620 | register_setting( 'xcloner_system_settings_group', 'xcloner_force_tmp_path_site_root' ); |
||
| 621 | add_settings_field( |
||
| 622 | 'xcloner_force_tmp_path_site_root', |
||
| 623 | __( 'Force Temporary Path Within XCloner Storage', 'xcloner-backup-and-restore' ), |
||
| 624 | array( $this, 'do_form_switch_field' ), |
||
| 625 | 'xcloner_system_settings_page', |
||
| 626 | 'xcloner_system_settings_group', |
||
| 627 | array( |
||
| 628 | 'xcloner_force_tmp_path_site_root', |
||
| 629 | 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() ) |
||
| 630 | ) |
||
| 631 | ); |
||
| 632 | |||
| 633 | register_setting( 'xcloner_system_settings_group', 'xcloner_disable_email_notification' ); |
||
| 634 | add_settings_field( |
||
| 635 | 'xcloner_disable_email_notification', |
||
| 636 | __( 'Disable Email Notifications', 'xcloner-backup-and-restore' ), |
||
| 637 | array( $this, 'do_form_switch_field' ), |
||
| 638 | 'xcloner_system_settings_page', |
||
| 639 | 'xcloner_system_settings_group', |
||
| 640 | array( |
||
| 641 | 'xcloner_disable_email_notification', |
||
| 642 | sprintf( __( 'Enable this option if you want the XCloner to NOT send email notifications on successful backups', 'xcloner-backup-and-restore' ), $this->get_table_prefix() ) |
||
| 643 | ) |
||
| 644 | ); |
||
| 645 | |||
| 646 | //REGISTERING THE 'CLEANUP SECTION' FIELDS |
||
| 647 | register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_days', array( |
||
| 648 | $this->xcloner_sanitization, |
||
| 649 | "sanitize_input_as_int" |
||
| 650 | ) ); |
||
| 651 | add_settings_field( |
||
| 652 | 'xcloner_cleanup_retention_limit_days', |
||
| 653 | __( 'Cleanup by Date(days)', 'xcloner-backup-and-restore' ), |
||
| 654 | array( $this, 'do_form_number_field' ), |
||
| 655 | 'xcloner_cleanup_settings_page', |
||
| 656 | 'xcloner_cleanup_settings_group', |
||
| 657 | array( |
||
| 658 | 'xcloner_cleanup_retention_limit_days', |
||
| 659 | __( 'Specify the maximum number of days a backup archive can be kept on the server. 0 disables this option', 'xcloner-backup-and-restore' ) |
||
| 660 | ) |
||
| 661 | ); |
||
| 662 | |||
| 663 | register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_retention_limit_archives', array( |
||
| 664 | $this->xcloner_sanitization, |
||
| 665 | "sanitize_input_as_int" |
||
| 666 | ) ); |
||
| 667 | add_settings_field( |
||
| 668 | 'xcloner_cleanup_retention_limit_archives', |
||
| 669 | __( 'Cleanup by Quantity', 'xcloner-backup-and-restore' ), |
||
| 670 | array( $this, 'do_form_number_field' ), |
||
| 671 | 'xcloner_cleanup_settings_page', |
||
| 672 | 'xcloner_cleanup_settings_group', |
||
| 673 | array( |
||
| 674 | 'xcloner_cleanup_retention_limit_archives', |
||
| 675 | __( 'Specify the maximum number of backup archives to keep on the server. 0 disables this option', 'xcloner-backup-and-restore' ) |
||
| 676 | ) |
||
| 677 | ); |
||
| 678 | |||
| 679 | register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_capacity_limit', array( |
||
| 680 | $this->xcloner_sanitization, |
||
| 681 | "sanitize_input_as_int" |
||
| 682 | ) ); |
||
| 683 | add_settings_field( |
||
| 684 | 'xcloner_cleanup_capacity_limit', |
||
| 685 | __( 'Cleanup by Capacity(MB)', 'xcloner-backup-and-restore' ), |
||
| 686 | array( $this, 'do_form_number_field' ), |
||
| 687 | 'xcloner_cleanup_settings_page', |
||
| 688 | 'xcloner_cleanup_settings_group', |
||
| 689 | array( |
||
| 690 | 'xcloner_cleanup_capacity_limit', |
||
| 691 | __( 'Remove oldest backups if all created backups exceed the configured limit in Megabytes. 0 disables this option', 'xcloner-backup-and-restore' ) |
||
| 692 | ) |
||
| 693 | ); |
||
| 694 | |||
| 695 | register_setting( 'xcloner_cleanup_settings_group', 'xcloner_cleanup_delete_after_remote_transfer', array( |
||
| 696 | $this->xcloner_sanitization, |
||
| 697 | "sanitize_input_as_int" |
||
| 698 | ) ); |
||
| 699 | add_settings_field( |
||
| 700 | 'xcloner_cleanup_delete_after_remote_transfer', |
||
| 701 | __( 'Delete Backup After Remote Storage Transfer', 'xcloner-backup-and-restore' ), |
||
| 702 | array( $this, 'do_form_switch_field' ), |
||
| 703 | 'xcloner_cleanup_settings_page', |
||
| 704 | 'xcloner_cleanup_settings_group', |
||
| 705 | array( |
||
| 706 | 'xcloner_cleanup_delete_after_remote_transfer', |
||
| 707 | __( 'Remove backup created automatically from local storage after sending the backup to Remote Storage', 'xcloner-backup-and-restore' ) |
||
| 708 | ) |
||
| 709 | ); |
||
| 710 | |||
| 711 | //REGISTERING THE 'CRON SECTION' FIELDS |
||
| 712 | register_setting( 'xcloner_cron_settings_group', 'xcloner_cron_frequency' ); |
||
| 713 | add_settings_field( |
||
| 714 | 'xcloner_cron_frequency', |
||
| 715 | __( 'Cron frequency', 'xcloner-backup-and-restore' ), |
||
| 716 | array( $this, 'do_form_text_field' ), |
||
| 717 | 'xcloner_cron_settings_page', |
||
| 718 | 'xcloner_cron_settings_group', |
||
| 719 | array( |
||
| 720 | 'xcloner_cron_frequency', |
||
| 721 | __( 'Cron frequency' ) |
||
| 722 | ) |
||
| 929 |