\MainWP\ChildMainWP_Child_Updraft_Plus_Backups

Class MainWP_Child_Updraft_Plus_Backups

Summary

Methods
Properties
Constants
instance()
__construct()
hook_updraft_plus_save_last_backup()
sync_others_data()
action()
set_showhide()
vault_disconnect()
required_files()
save_settings()
replace_tokens()
addons_connect()
update_wpmu_options()
addons2_get_option()
addons2_update_option()
options_validate()
extradb_testconnection()
backup_now()
activejobs_list()
build_historystatus()
historystatus()
updraft_download_backup()
prune_updraft_dir_prefix()
restore_alldownloaded()
option_filter_template()
option_filter_stylesheet()
option_filter_template_root()
option_filter_stylesheet_root()
show_admin_warning()
analyse_db_file()
diskspaceused()
fetch_log()
close_browser_connection()
updraftplus_init()
remove_notices()
remove_filters_for_anonymous_class()
wp_before_admin_bar_render()
hide_update_notice()
remove_update_nag()
get_sync_data()
all_plugins()
remove_menu()
$instance
$is_plugin_installed
No constants found
No protected methods found
No protected properties found
N/A
get_settings_keys()
do_vault_connect()
connected_html()
vault_connect()
cb_get_name_base_type()
last_backup_html()
get_updraft_data()
next_scheduled_backups()
deleteset()
download_file()
print_delete_old_dirs_form()
delete_old_dirs_go()
delete_old_dirs()
delete_old_dirs_dir()
analyse_db_file_old()
gzopen_for_read()
existing_backup_table()
restore_button()
delete_button()
date_label()
download_db_button()
download_buttons()
download_button()
log_button()
rebuild_backup_history()
force_scheduled_resumption()
recursive_directory_size()
recursive_directory_size_raw()
get_cron()
print_active_jobs()
print_active_job()
fetch_updraft_log()
activejobs_delete()
download_status()
No private properties found
N/A

Properties

$instance

$instance : mixed

Public static variable to hold the single instance of MainWP_Child_Updraft_Plus_Backups.

Type

mixed — Default null

$is_plugin_installed

$is_plugin_installed : boolean

Type

boolean — Whether or not UpdraftPlus WordPress plugin is installed. Default: false.

Methods

__construct()

__construct() 

MainWP_Child_Updraft_Plus_Backups constructor.

Run any time class is called.

hook_updraft_plus_save_last_backup()

hook_updraft_plus_save_last_backup(array  $last_backup) : array

Hook UpdraftPlus save last backup.

Parameters

array $last_backup

Backup array.

Returns

array —

$last_backup Return response array.

sync_others_data()

sync_others_data(array  $information, array  $data = array()) : array

Sync other data from $data[] and merge with $information[]

Parameters

array $information

Returned response array for MainWP BackWPup Extension actions.

array $data

Other data to sync to $information array.

Returns

array —

$information Returned information array with both sets of data.

action()

action() 

MainWP UpdraftPlus Extension actions.

set_showhide()

set_showhide() : array

Set show or hide UpdraftPlus Plugin from Admin & plugins list.

Returns

array —

$information Return results.

vault_disconnect()

vault_disconnect() 

Disconnect from UpdraftPlus Vault.

This method also gets called directly, so don't add code that assumes that it's definitely an AJAX situation.

Throws

\MainWP\Child\Exception

Error message.

required_files()

required_files() 

Require needed UpdraftPlus Files.

replace_tokens()

replace_tokens(string  $str = '') : string|array<mixed,string>

Replace %sitename% and %siteurl% tokens.

Parameters

string $str

String to search & replace.

Returns

string|array<mixed,string> —

$str Altered string.

addons_connect()

addons_connect() : array|array<mixed,string>

Connect UpdraftPlus Premium addons.

Returns

array|array<mixed,string> —

$out return response array. Success or nopremium.

update_wpmu_options()

update_wpmu_options(array  $value) : boolean|void

Update WPMU Options.

Parameters

array $value

Values to save.

Returns

boolean|void —

Return TRUE on success or VOID on failure.

addons2_get_option()

addons2_get_option(string  $option) : mixed

Get site option (2)

Funnelling through here, a) allows for future flexibility and, b) allows us to migrate elegantly from the previous non-MU-friendly setup.

Parameters

string $option

Site option to get.

Returns

mixed —

$val Returned site option.

addons2_update_option()

addons2_update_option(string  $option, string  $val) : boolean

Update site option (2)

Parameters

string $option

Site option to update.

string $val

Value New option value.

Returns

boolean —

False if value was not updated. True if value was updated.

options_validate()

options_validate(string  $input) : mixed

When the options are re-saved, clear any previous cache of the connection status.

Parameters

string $input

Option to validate.

Returns

mixed —

$input The validated option.

activejobs_list()

activejobs_list() : array

Active jobs list.

Returns

array —

Return the active jobs list.

build_historystatus()

build_historystatus() : array

Build backup history status.

Throws

\MainWP\Child\Exception

Error message.

Returns

array —

Return response array.

historystatus()

historystatus(null  $remotescan = null, null  $rescan = null) : array

Display History Status.

Parameters

null $remotescan

Remote Scan $_POST data. Default: null

null $rescan

Rescan $_POST data. Default: null

Throws

\MainWP\Child\Exception

Returns

array —

Return history status data.

prune_updraft_dir_prefix()

prune_updraft_dir_prefix(  $updraft_dir) : false|string

Prune Updraft directory prefix

This options filter removes ABSPATH off the front of $updraft_dir, if it is given absolutely and contained within it.

Parameters

$updraft_dir

Directory to prune.

Returns

false|string —

Return Pruned $updraft_dir or FALSE on failure.

option_filter_template()

option_filter_template(string  $val) : mixed

Option filter template.

Parameters

string $val

Filter to get.

Returns

mixed —

Return template.

option_filter_stylesheet()

option_filter_stylesheet(string  $val) : mixed

Option filter stylesheet.

Parameters

string $val

Filter to get.

Returns

mixed —

Return template.

option_filter_template_root()

option_filter_template_root(string  $val) : mixed

Option filter template root.

Parameters

string $val

Filter to get.

Returns

mixed —

Return template.

option_filter_stylesheet_root()

option_filter_stylesheet_root(string  $val) : mixed

Option filter stylesheet root.

Parameters

string $val

Filter to get.

Returns

mixed —

Return template.

show_admin_warning()

show_admin_warning(string  $message, string  $class = 'updated') 

Show admin warning.

Parameters

string $message

Warning message to display.

string $class

UpdraftPlus message CSS class.

fetch_log()

fetch_log(string  $backup_nonce, integer  $log_pointer) : array|array<mixed,string>

Fetch log.

Parameters

string $backup_nonce

Backup nonce.

integer $log_pointer

Log pointer.

Returns

array|array<mixed,string> —

Return log content, nonce & pointer. ERROR on failure.

close_browser_connection()

close_browser_connection(string  $txt = '') 

Close browser connection.

Parameters

string $txt

Return Base64 Encoded output.

updraftplus_init()

updraftplus_init() 

Initiate UpdraftPlus.

remove_notices()

remove_notices() 

Remove admin notices.

remove_filters_for_anonymous_class()

remove_filters_for_anonymous_class(string  $hook_name = '', string  $class_name = '', string  $method_name = '', integer  $priority) : boolean

Allows removal of method for a hook when the class doesn't have a variable but you know the class name.

Parameters

string $hook_name

Hook name.

string $class_name

Class name.

string $method_name

Method name.

integer $priority

Priority.

Returns

boolean —

Return FALSE on failure.

wp_before_admin_bar_render()

wp_before_admin_bar_render() 

Render before admin bar.

hide_update_notice()

hide_update_notice(string  $slugs) : string

Hide UpdraftPlus notices.

Parameters

string $slugs

Plugin slugs.

Returns

string —

$slugs Plugin slugs.

remove_update_nag()

remove_update_nag(string  $value) : mixed

Remove UpdraftPlus update nag.

Parameters

string $value

String to remove.

Returns

mixed —

$value Return response.

get_sync_data()

get_sync_data(boolean  $with_hist = false) 

Get sync data.

Parameters

boolean $with_hist

Whether or not to include history.

all_plugins()

all_plugins(array  $plugins) : array

Remove UpdraftPlus from plugins page.

Parameters

array $plugins

All plugins array.

Returns

array —

$plugins All plugins array with UpdraftPlus removed.

remove_menu()

remove_menu() 

Remove UpdraftPlus from WP Admin menu.

get_settings_keys()

get_settings_keys() : array

Get settings keys.

Returns

array —

Array of settings keys.

do_vault_connect()

do_vault_connect() : array

Connect to UpdraftPlus Vault.

Throws

\MainWP\Child\Exception

Error message.

Returns

array —

$response Return response.

connected_html()

connected_html() : string

UpdraftPlus Vault connection html.

Throws

\MainWP\Child\Exception|\Exception

Error message.

Returns

string —

$ret Returns connected to UpdraftPlus Vault message html.

vault_connect()

vault_connect(string  $email, \MainWP\Child\strign  $password) : boolean|\MainWP\Child\WP_Error

Connect to UpdraftPlus Vault.

Parameters

string $email

Vault account user name.

\MainWP\Child\strign $password

Vault account password.

Returns

boolean|\MainWP\Child\WP_Error —

$return Returns either true (in which case the Vault token will be stored), or false|\WP_Error.

cb_get_name_base_type()

cb_get_name_base_type(  $a) : mixed

CB get name base type.

Parameters

$a

Returns

mixed

last_backup_html()

last_backup_html() : array

Last backup html.

Returns

array —

Return last backup log text & backup time.

next_scheduled_backups()

next_scheduled_backups() : array

Get next scheduled backup.

Throws

\MainWP\Child\Exception|\Exception

Error message.

Returns

array —

$out Return Next scheduled backup data.

download_file()

download_file(string  $file, string  $service) : boolean

Usage requirements: Pass only a single service, as a string, into this function.

Parameters

string $file

File to download.

string $service

UpdraftPlus service method.

Returns

boolean —

Return file or FALSE on failure.

print_delete_old_dirs_form()

print_delete_old_dirs_form() 

Display delete old directories form.

delete_old_dirs_go()

delete_old_dirs_go(boolean  $show_return = true) : array

Delete old directories.

Parameters

boolean $show_return

Whether or not to show removed directories in the output. Defualt: true.

Returns

array —

Return response array.

delete_old_dirs()

delete_old_dirs() : boolean

Delete the old directories that are created when a backup is restored.

Returns

boolean —

Return $ret, $ret3, $ret4. TRUE|FALSE.

delete_old_dirs_dir()

delete_old_dirs_dir(string  $dir, boolean  $wpfs = true) : boolean|string

Delete the directories within a directory.

Parameters

string $dir

Directory to scan.

boolean $wpfs

Whether or not to use Wordpress filesystem to list directories, Default: true.

Returns

boolean|string —

$ret Return FALSE & echo 'Failed' on failure or echo 'OK' on success.

analyse_db_file_old()

analyse_db_file_old(string  $timestamp, string  $res, boolean  $db_file = false, boolean  $header_only = false) : array<mixed,array>

Analyse old database file.

Parameters

string $timestamp

File timestamp.

string $res

UpdraftPlus response.

boolean $db_file

Whether or not a DB file was found. Default: false.

boolean $header_only

Whether or not file only has headers. Default: false.

Returns

array<mixed,array> —

Return array( $mess, $warn, $err, $info ).

gzopen_for_read()

gzopen_for_read(string  $file, string  $warn, string  $err) : boolean|false|resource

Gzip open.

Parameters

string $file

File to open.

string $warn

Warning message.

string $err

Error message.

Returns

boolean|false|resource —

Return FALSE on failure or $what_to_return the unziped file.

restore_button()

restore_button(string  $backup, string  $key, string  $pretty_date, string  $entities) : string

Restore button.

Parameters

string $backup

Type of backup.

string $key

Timestamp.

string $pretty_date

Backup date.

string $entities

Backup entities.

Returns

string —

$ret Restore button html.

delete_button()

delete_button(string  $key, string  $nonce, string  $backup) : string

Delete button.

Parameters

string $key

Timestamp.

string $nonce

Security nonce.

string $backup

Backup to delete.

Returns

string —

Delete button html.

date_label()

date_label(string  $pretty_date, string  $key, string  $backup, array  $jobdata, string  $nonce) : string

Date label.

Parameters

string $pretty_date

Pretty date.

string $key

Timestamp.

string $backup

Type of backup.

array $jobdata

Job data.

string $nonce

Security nonce.

Returns

string —

$ret Return date label html.

download_db_button()

download_db_button(string  $bkey, string  $key, string  $esc_pretty_date, string  $nonce_field, array  $backup, array  $accept = array()) : string

Download database button.

Parameters

string $bkey

Backup key.

string $key

Timestamp.

string $esc_pretty_date

Escaped pretty date.

string $nonce_field

Nonce filed.

array $backup

Backup data

array $accept

Destination array.

Returns

string —

$ret Download DB button html.

download_buttons()

download_buttons(array  $backup, string  $key, array  $accept, array  $entities, string  $esc_pretty_date, string  $nonce_field) : string

Download buttons.

Parameters

array $backup

Backup data array.

string $key

Backup key.

array $accept

Destination array.

array $entities

File entities.

string $esc_pretty_date

Escaped pretty date.

string $nonce_field

Nonce field.

Returns

string —

$ret Download button html.

download_button()

download_button(string  $type, string  $key, string  $findex, string  $info, string  $nonce_field, string  $ide, string  $pdescrip, string  $esc_pretty_date, string  $set_contents) : string

Single download button.

Parameters

string $type

Backup type.

string $key

Backup key.

string $findex

File index.

string $info

Backup info.

string $nonce_field

Security nonce field.

string $ide

Submit title.

string $pdescrip

Description.

string $esc_pretty_date

Escaped pretty date.

string $set_contents

mainwp_updraft_downloader value.

Returns

string —

Download button html.

log_button()

log_button(array  $backup) : string

Log button.

Parameters

array $backup

Backup data array.

Returns

string —

$ret Log button html.

rebuild_backup_history()

rebuild_backup_history(boolean  $remotescan = false) : array|null

Rebuild backup history.

Parameters

boolean $remotescan

TRUE|FALSE Remote scan.

Returns

array|null —

$messages Return backup history or Null.

force_scheduled_resumption()

force_scheduled_resumption() : array|array<mixed,boolean>

Force a scheduled resumption.

Returns

array|array<mixed,boolean> —

Return FALSE & Empty array on failure.

recursive_directory_size()

recursive_directory_size(array  $directorieses, array  $exclude = array(), string  $basedirs = '') : string

Recursively get directory sizes.

If $basedirs is passed as an array, then $directorieses must be too.

Parameters

array $directorieses

Directories to size.

array $exclude

Directories to exclude.

string $basedirs

Base directories.

Returns

string —

Return total size.

recursive_directory_size_raw()

recursive_directory_size_raw(string  $prefix_directory, array  $exclude = array(), string  $suffix_directory = '') : false|integer

Recursivly get raw directory sizes.

Parameters

string $prefix_directory

Directory prefix.

array $exclude

Directories to exclude.

string $suffix_directory

Directory suffix.

Returns

false|integer —

Return $size Raw Directory size or FALSE on failure.

get_cron()

get_cron(boolean  $job_id = false) : array|boolean

Get cron job.

Parameters

boolean $job_id

Cron job ID.

Returns

array|boolean —

Return cron job time and data or FALSE on failure.

print_active_jobs()

print_active_jobs(boolean  $this_job_only = false) : string

Display active jobs.

A value for $this_job_only also causes something to always be returned (to allow detection of the job having started on the front-end).

Parameters

boolean $this_job_only

Returns

string —

$ret Return active jobs html.

print_active_job()

print_active_job(string  $job_id, boolean  $is_oneshot = false, boolean  $time = false, boolean  $next_resumption = false) : string

Display active job.

Parameters

string $job_id

Job ID.

boolean $is_oneshot

Whether or not this is a one time backup.

boolean $time

Backup time.

boolean $next_resumption

Next backups resumption.

Returns

string —

Active job html.

fetch_updraft_log()

fetch_updraft_log() : array|array<mixed,string>

Fetch Updraft Log.

Returns

array|array<mixed,string> —

Return log content, nonce & pointer. ERROR on failure.

activejobs_delete()

activejobs_delete() : array|array<mixed,string>

Delete active jobs.

Returns

array|array<mixed,string> —

Return Y Job has been deleted or N Job not found.

download_status()

download_status(string  $timestamp, string  $type, string  $findex) : array<mixed,string>

Download status.

Parameters

string $timestamp

Job timestamp

string $type

Job type.

string $findex

File Index.

Returns

array<mixed,string> —

Return $response array.