\MainWP\Dashboard\Module\ApiBackupsApi_Backups_3rd_Party

Class Api_Backups_3rd_Party

This class is responsible for handling the 3rd party API requests for each available backup provider.

Summary

Methods
Properties
Constants
instance()
get_class_name()
__construct()
admin_init()
init_ajax_actions()
action_notifications()
render_mainwp_backups_page()
render_api_backups_table()
render_api_backups_site()
call_cloudways_api()
fetch_cloudways_access_token()
fetch_cloudways_server_list()
ajax_cloudways_action_update_ids()
cloudways_action_update_ids()
ajax_cloudways_action_individual_backup()
ajax_cloudways_action_backup()
cloudways_action_create_backup()
cloudways_action_poll_backup_operation()
cloudways_action_refresh_available_backups()
cloudways_action_restore_backup()
cloudways_action_delete_backup()
call_vultr_api()
ajax_vultr_action_individual_create_snapshot()
ajax_vultr_action_create_snapshot()
get_vultr_api_key()
get_gridpane_api_key()
get_linode_api_key()
get_digitalocean_api_key()
get_cloudways_api_key()
get_cpanel_account_password()
get_plesk_api_key()
vultr_action_create_snapshot()
vultr_action_refresh_available_backups()
ajax_vultr_action_restore_backup()
vultr_action_restore_backup()
vultr_action_delete_backup()
call_gridpane_api()
gridpane_get_sites_list()
ajax_gridpane_action_update_ids()
gridpane_action_update_ids()
ajax_gridpane_action_individual_create_backup()
ajax_gridpane_action_create_backup()
gridpane_action_create_backup()
gridpane_action_refresh_available_backups()
gridpane_action_restore_backup()
gridpane_action_delete_backup()
call_linode_api()
ajax_linode_action_individual_create_backup()
ajax_linode_action_create_backup()
linode_action_create_backup()
linode_action_refresh_available_backups()
linode_action_restore_backup()
linode_action_linode_status()
linode_action_linode_start()
linode_action_cancel_backups()
call_digitalocean_api()
ajax_digitalocean_action_create_backup()
ajax_digitalocean_action_individual_create_backup()
digitalocean_action_create_backup()
digitalocean_action_refresh_available_backups()
digitalocean_action_restore_backup()
digitalocean_action_delete_backup()
call_plesk_api()
get_plesk_home_dir()
get_plesk_authentication_credentials()
ajax_plesk_action_refresh_available_backups()
ajax_plesk_action_create_backup()
ajax_plesk_action_restore_backup()
ajax_plesk_action_delete_backup()
plesk_action_refresh_available_backups()
plesk_action_create_backup()
plesk_action_restore_backup()
plesk_action_delete_backup()
call_cpanel_api()
call_cpanel_api_json()
get_cpanel_authentication_credentials()
cpanel_action_get_home_directory()
get_cpanel_manual_account_backups()
get_cpanel_manual_database_backups()
get_cpanel_wp_toolkit_backups()
ajax_cpanel_action_restore_backup()
ajax_cpanel_action_restore_database_backup()
ajax_cpanel_action_restore_manual_backup()
ajax_cpanel_action_refresh_available_backups()
ajax_cpanel_action_create_manual_backup()
ajax_cpanel_action_create_wptk_backup()
ajax_cpanel_action_restore_wptk_backup()
ajax_cpanel_action_delete_wptk_backup()
ajax_cpanel_action_create_full_backup()
ajax_cpanel_action_create_database_backup()
cpanel_action_create_manual_backup()
cpanel_action_create_wptk_backup()
cpanel_action_restore_wptk_backup()
cpanel_action_delete_wptk_backup()
cpanel_action_refresh_available_backups()
cpanel_action_restore_backup()
cpanel_action_restore_database_backup()
cpanel_action_restore_manual_backup()
No public properties found
No constants found
No protected methods found
$instance
N/A
No private methods found
No private properties found
N/A

Properties

$instance

$instance : mixed

Public static variable to hold the single instance of the class.

Type

mixed — Default null

Methods

get_class_name()

get_class_name() : string

Method get_class_name()

Get class name.

Returns

string —

CLASS Class name.

__construct()

__construct() 

Api_Backups_3rd_Party Constructor.

Runs each time the class is called.

admin_init()

admin_init() 

Admin init.

init_ajax_actions()

init_ajax_actions() 

Init ajax actions.

action_notifications()

action_notifications() : void

Global backup page Action notification handler.

render_mainwp_backups_page()

render_mainwp_backups_page() : void

Render the main api backups page.

render_api_backups_table()

render_api_backups_table() : void

Render the global 3rd party api backups table.

render_api_backups_site()

render_api_backups_site(mixed  $website) 

Render the Individual 3rd Party API Backup Page.

Parameters

mixed $website

The Child Site Object.

call_cloudways_api()

call_cloudways_api(string  $method, string  $url, string  $accessToken, array  $post = array()) : object

Call Cloudways API, Authenticate & perform given method.

Use this function to contact CW API We use OAuth, an open standard for authorization. Here are the steps involved:

  1. Get your API Key from here: https://platform.cloudways.com/api
  2. Enter in your account email address and API Key below.

Parameters

string $method

GET|POST|PUT|DELETE.

string $url

relative URL for the call.

string $accessToken

Access token generated using OAuth Call.

array $post

Optional post data for the call.

Returns

object —

Output from CW API.

fetch_cloudways_access_token()

fetch_cloudways_access_token() : mixed

Fetch Cloudways oAuth Access Token.

Fetch the Cloudways oAuth access token from the given API credentials.

Returns

mixed —

Return Cloudways Access Token.

fetch_cloudways_server_list()

fetch_cloudways_server_list() : mixed

Fetch all available servers.

Returns

mixed —

Returns available list of servers.

ajax_cloudways_action_update_ids()

ajax_cloudways_action_update_ids() 

Ajax.

Save the server & app ID to that Child Site's options table.

Compare connected Child Sites against connected Cloudways account. Automatically check for Child Sites domain name in server list & save. that app's Server ID & App ID to that Child Site's options table.

cloudways_action_update_ids()

cloudways_action_update_ids() 

Save the server & app ID to that Child Site's options table.

Compare connected Child Sites against connected Cloudways account. Automatically check for Child Sites domain name in server list & save. that app's Server ID & App ID to that Child Site's options table.

ajax_cloudways_action_individual_backup()

ajax_cloudways_action_individual_backup() : void

Cloudways: action backup.

Perform a backup on the selected Cloudways server.

ajax_cloudways_action_backup()

ajax_cloudways_action_backup() : void

Cloudways: action backup.

Perform a backup on the selected Cloudways server.

cloudways_action_create_backup()

cloudways_action_create_backup(integer  $website_id = '', boolean  $ret_val = false) : mixed

Cloudways: action backup.

Perform a backup on the selected Cloudways server.

Parameters

integer $website_id

Website ID.

boolean $ret_val

Return output or not.

Returns

mixed

cloudways_action_poll_backup_operation()

cloudways_action_poll_backup_operation(integer  $website_id) : void

Cloudways: action poll backup operation.

Poll the Cloudways operations endpoint for backup status.

Parameters

integer $website_id

Website ID.

cloudways_action_refresh_available_backups()

cloudways_action_refresh_available_backups() : void

Cloudways: action refresh available backups.

Save backups to DB for the selected Cloudways server.

cloudways_action_restore_backup()

cloudways_action_restore_backup() : void

Cloudways: action restore backup.

Restore a backup on the selected Cloudways server.

cloudways_action_delete_backup()

cloudways_action_delete_backup() : void

Cloudways: action delete backup.

Delete a backup on the selected Cloudways server.

call_vultr_api()

call_vultr_api(string  $method, string  $url, string  $accessToken, string  $data = null, boolean  $die_error = true) : array

Call Vultr API, Authenticate & perform given method.

Use this function to contact Vultr API We use OAuth, an open standard for authorization. Here are the steps involved:

  1. Get your API Key from here: https://platform.cloudways.com/api
  2. Enter in your account email address and API Key below.

Parameters

string $method

GET|POST|PUT|DELETE.

string $url

relative URL for the call.

string $accessToken

Access token generated using OAuth Call.

string $data

Json encoded array - Optional post data for the call.

boolean $die_error

die when error.

Returns

array —

Response from Vultr API.

ajax_vultr_action_individual_create_snapshot()

ajax_vultr_action_individual_create_snapshot() : void

Ajax.

Vultr: action create snapshot.

Create a snapshot on the selected Vultr server.

This function is also called before any update. During this time a backup will be. Created but no updates will be made this time around. A new update will need to be manually triggered.

ajax_vultr_action_create_snapshot()

ajax_vultr_action_create_snapshot() : void

Ajax.

Vultr: action create snapshot.

Create a snapshot on the selected Vultr server.

This function is also called before any update. During this time a backup will be. Created but no updates will be made this time around. A new update will need to be manually triggered.

get_vultr_api_key()

get_vultr_api_key() 

Method get_vultr_api_key().

get_gridpane_api_key()

get_gridpane_api_key() 

Method get_gridpane_api_key().

get_linode_api_key()

get_linode_api_key() 

Method get_linode_api_key().

get_digitalocean_api_key()

get_digitalocean_api_key() 

Method get_digitalocean_api_key().

get_cloudways_api_key()

get_cloudways_api_key() 

Method get_cloudways_api_key().

get_cpanel_account_password()

get_cpanel_account_password() 

Method get_cpanel_account_password().

get_plesk_api_key()

get_plesk_api_key() 

Method get_plesk_api_key().

vultr_action_create_snapshot()

vultr_action_create_snapshot(integer  $website_id = '', string  $backup_api = '', boolean  $ret_val = false) : mixed

Vultr: action create snapshot.

Create a snapshot on the selected Vultr server.

This function is also called before any update. During this time a backup will be Created but no updates will be made this time around. A new update will need to be manually triggered.

Parameters

integer $website_id

Website ID.

string $backup_api

Backup api.

boolean $ret_val

Return output or not.

Returns

mixed

vultr_action_refresh_available_backups()

vultr_action_refresh_available_backups() : void

Vultr: action refresh available backups.

Save backups to DB for the selected Vultr server.

ajax_vultr_action_restore_backup()

ajax_vultr_action_restore_backup() : void

Vultr: action restore backup.

Restore backup on the selected Vultr server.

vultr_action_restore_backup()

vultr_action_restore_backup() : void

Vultr: action restore backup.

Restore backup on the selected Vultr server.

vultr_action_delete_backup()

vultr_action_delete_backup() : void

Vultr: action delete backup.

Delete a backup on the selected Vultr server.

call_gridpane_api()

call_gridpane_api(string  $method, string  $url, string  $accessToken, mixed  $backup_data = array()) : string

Call GridPane API, Authenticate & perform given method.

Use this function to contact GridPane API We use OAuth, an open standard for authorization. Here are the steps involved:

  1. Get your API Key from here: https://platform.cloudways.com/api
  2. Enter in your account email address and API Key below.

Parameters

string $method

GET|POST|PUT|DELETE.

string $url

relative URL for the call.

string $accessToken

Access token generated using OAuth Call.

mixed $backup_data

Json encoded array - Optional post data for the call.

Returns

string —

Output from GridPane API.

gridpane_get_sites_list()

gridpane_get_sites_list(integer  $sites_count) : object|boolean

Get GridPane Site List.

Request for all sites for current user token.

Parameters

integer $sites_count

sites count.

Returns

object|boolean —

Return Sites Object.

ajax_gridpane_action_update_ids()

ajax_gridpane_action_update_ids() : void

Ajax.

Assign Server:Apps to Child Sites options table.

Compare connected Child Sites against connected GridPane account. Automatically check for Child Sites domain name in server list & save that app's Server ID & App ID to that Child Site's options table.

gridpane_action_update_ids()

gridpane_action_update_ids() : void

Assign Server:Apps to Child Sites options table.

Compare connected Child Sites against connected GridPane account. Automatically check for Child Sites domain name in server list & save that app's Server ID & App ID to that Child Site's options table.

ajax_gridpane_action_individual_create_backup()

ajax_gridpane_action_individual_create_backup() : void

Ajax.

GridPane: action create backup.

Create a backup on the selected GridPane server.

ajax_gridpane_action_create_backup()

ajax_gridpane_action_create_backup() : void

Ajax.

GridPane: action create backup.

Create a backup on the selected GridPane server.

gridpane_action_create_backup()

gridpane_action_create_backup(integer  $website_id = '', boolean  $ret_val = false) : mixed

GridPane: action create backup.

Parameters

integer $website_id

Website ID.

boolean $ret_val

Return output or not.

Returns

mixed

gridpane_action_refresh_available_backups()

gridpane_action_refresh_available_backups() : void

GridPane: action refresh available backups.

Save backups to DB for the selected GridPane server.

gridpane_action_restore_backup()

gridpane_action_restore_backup() : void

GridPane: action restore backup.

Restore selected backup for the selected GridPane server.

gridpane_action_delete_backup()

gridpane_action_delete_backup() : void

GridPane: action delete backup.

Delete backup for the selected GridPane server.

call_linode_api()

call_linode_api(string  $method, string  $url, string  $accessToken, mixed  $backup_data = array()) : string

Call Linode API, Authenticate & perform given method.

Use this function to contact Linode API We use OAuth, an open standard for authorization. Here are the steps involved:

  1. Get your API Key from here: https://platform.cloudways.com/api
  2. Enter in your account email address and API Key below.

Parameters

string $method

GET|POST|PUT|DELETE.

string $url

relative URL for the call.

string $accessToken

Access token generated using OAuth Call.

mixed $backup_data

Json encoded array - Optional post data for the call.

Returns

string —

Output from GridPane API.

ajax_linode_action_individual_create_backup()

ajax_linode_action_individual_create_backup() : void

Linode: action create backup.

Create backup for the selected Linode server.

ajax_linode_action_create_backup()

ajax_linode_action_create_backup() : void

Linode: action create backup.

Create backup for the selected Linode server.

linode_action_create_backup()

linode_action_create_backup(integer  $website_id = '', boolean  $ret_val = false) : mixed

Linode: action create backup.

Create backup for the selected Linode server.

Parameters

integer $website_id

Website ID.

boolean $ret_val

Return output or not.

Returns

mixed

linode_action_refresh_available_backups()

linode_action_refresh_available_backups() : void

Linode: action Refresh available backups.

Save backups to DB for the selected Linode server.

linode_action_restore_backup()

linode_action_restore_backup() : void

Linode: action Restore backup.

Restore backup for the selected Linode server.

linode_action_linode_status()

linode_action_linode_status(integer  $website_id) : void

Linode: action Linode status.

Check linode status to know when to reboot server.

Parameters

integer $website_id

Child Site ID.

linode_action_linode_start()

linode_action_linode_start(integer  $instance_id) : void

Linode: action Linode start.

Parameters

integer $instance_id

Linode Instance ID.

linode_action_cancel_backups()

linode_action_cancel_backups() : void

Linode: action cancel backups.

Cancel all backups for a Linode Instance.

call_digitalocean_api()

call_digitalocean_api(string  $method, string  $url, string  $accessToken, mixed  $backup_data = array()) : array

Call DigitalOcean API, Authenticate & perform given method.

Parameters

string $method

GET|POST|PUT|DELETE.

string $url

relative URL for the call.

string $accessToken

Access token generated using OAuth Call.

mixed $backup_data

Json encoded array - Optional post data for the call.

Returns

array —

Output from DigitalOcean API.

ajax_digitalocean_action_create_backup()

ajax_digitalocean_action_create_backup() : void

DigitalOcean: Action create backup.

Create a backup of the droplet.

ajax_digitalocean_action_individual_create_backup()

ajax_digitalocean_action_individual_create_backup() : void

DigitalOcean: Action create backup.

Create a backup of the droplet.

digitalocean_action_create_backup()

digitalocean_action_create_backup(integer  $website_id = '', boolean  $ret_val = false) : mixed

DigitalOcean: Action create backup.

Create a backup of the droplet.

Parameters

integer $website_id

Website ID.

boolean $ret_val

Return output or not.

Returns

mixed

digitalocean_action_refresh_available_backups()

digitalocean_action_refresh_available_backups() : void

DigitalOcean: Action refresh available backups.

Save backups to DB for the selected DigitalOcean server.

digitalocean_action_restore_backup()

digitalocean_action_restore_backup() : void

DigitalOcean: Action restore backup.

Restore a backup of the droplet.

digitalocean_action_delete_backup()

digitalocean_action_delete_backup() : void

DigitalOcean: Action delete backup.

Delete a backup of the droplet.

call_plesk_api()

call_plesk_api(string  $method, string  $url, string  $baseurl, string  $api_key, mixed  $backup_data = array()) : array

Call Plesk API, Authenticate & perform given method.

Parameters

string $method

GET|POST|PUT|DELETE.

string $url

API endpoint for the call.

string $baseurl

Base url.

string $api_key

Plesk API Key.

mixed $backup_data

Json encoded array - Optional post data for the call.

Returns

array —

Output from cPanel API.

get_plesk_home_dir()

get_plesk_home_dir() : string|boolean

Plesk: Grab Home Directory.

Grab needed home directory for downloading backups.

Returns

string|boolean

get_plesk_authentication_credentials()

get_plesk_authentication_credentials(integer  $website_id = null) : array

Plesk: Authentication.

Grab needed authentication credentials for Plesk API - either from global settings or individual settings.

Parameters

integer $website_id

Website ID.

Returns

array

ajax_plesk_action_refresh_available_backups()

ajax_plesk_action_refresh_available_backups() : void

Plesk: action refresh available backups.

Refresh available backups for the selected server.

ajax_plesk_action_create_backup()

ajax_plesk_action_create_backup() : void

Plesk: action create backup.

Create backup for the selected server.

ajax_plesk_action_restore_backup()

ajax_plesk_action_restore_backup() : void

Plesk: action restore backup.

Create backup for the selected server.

ajax_plesk_action_delete_backup()

ajax_plesk_action_delete_backup() : void

Plesk: action delete backup.

Delete backup for the selected server.

plesk_action_refresh_available_backups()

plesk_action_refresh_available_backups() : void

Plesk: Action refresh available backups.

Save backups to DB for the selected server.

plesk_action_create_backup()

plesk_action_create_backup(boolean  $ret_val = false, integer  $website_id = null) : mixed

Plesk: Action create manual backup.

Create a Plesk Backup.

Parameters

boolean $ret_val

Return output or not.

integer $website_id

Website ID.

Returns

mixed

plesk_action_restore_backup()

plesk_action_restore_backup() 

Plesk: Action restore backup.

Restore Plesk Backup.

plesk_action_delete_backup()

plesk_action_delete_backup() 

Plesk: Action delete backup.

Delete Plesk Backup.

call_cpanel_api()

call_cpanel_api(string  $method, string  $url, string  $baseurl, string  $username, string  $password, mixed  $backup_data = array()) : array

Call cPanel API, Authenticate & perform given method.

Parameters

string $method

GET|POST|PUT|DELETE.

string $url

API endpoint for the call.

string $baseurl

Baseurl.

string $username

cPanel account username.

string $password

cPanel account password.

mixed $backup_data

Json encoded array - Optional post data for the call.

Returns

array —

Output from cPanel API.

call_cpanel_api_json()

call_cpanel_api_json(string  $method, string  $url, string  $baseurl, string  $username, string  $password, mixed  $backup_data = array()) : array

Call cPanel API, Authenticate & perform given method.

Parameters

string $method

GET|POST|PUT|DELETE.

string $url

API endpoint for the call.

string $baseurl

base url.

string $username

cPanel account username.

string $password

cPanel account password.

mixed $backup_data

Json encoded array - Optional post data for the call.

Returns

array —

Output from cPanel API.

get_cpanel_authentication_credentials()

get_cpanel_authentication_credentials(integer  $website_id = '') : array

CPanel: Authentication.

Grab needed authentication credentials for cPanel API - either from global settings or individual settings.

Parameters

integer $website_id

Website ID.

Returns

array

cpanel_action_get_home_directory()

cpanel_action_get_home_directory() : string

CPanel: Action get cPanel Home Directory.

Grab cPanel Home Directory for manual backup links.

Returns

string

get_cpanel_manual_account_backups()

get_cpanel_manual_account_backups() : false|string

Get cPanel manual account backups.

Returns

false|string —

cPanel account backups

get_cpanel_manual_database_backups()

get_cpanel_manual_database_backups(integer  $website_id = '') : false|string

Get cPanel manual database backups.

Create manual database backup via mysqldump. Backups will be stored within /uploads/mainwp/api_db_backups directory.

Parameters

integer $website_id

Website ID.

Returns

false|string —

cPanel account backups

get_cpanel_wp_toolkit_backups()

get_cpanel_wp_toolkit_backups(integer  $website_id) : array

CPanel: Action refresh available WP-Toolit backups.

Save backups to DB for the selected server.

Parameters

integer $website_id

Website id.

Returns

array

ajax_cpanel_action_restore_backup()

ajax_cpanel_action_restore_backup() : void

CPanel: action restore backup.

Restore cPanel backup for the selected cPanel server.

ajax_cpanel_action_restore_database_backup()

ajax_cpanel_action_restore_database_backup() : void

CPanel: action restore database backup.

Restore cPanel backup for the selected cPanel server.

ajax_cpanel_action_restore_manual_backup()

ajax_cpanel_action_restore_manual_backup() : void

CPanel: action restore manual backup.

Restore cPanel backup for the selected cPanel server.

ajax_cpanel_action_refresh_available_backups()

ajax_cpanel_action_refresh_available_backups() : void

CPanel: action refresh available backups.

Refresh available backups for the selected cPanel server.

ajax_cpanel_action_create_manual_backup()

ajax_cpanel_action_create_manual_backup() : void

CPanel: action create backup.

Create backup for the selected cPanel server.

ajax_cpanel_action_create_wptk_backup()

ajax_cpanel_action_create_wptk_backup() : void

CPanel: action create WP-Toolkit backup.

Create backup for the selected cPanel server.

ajax_cpanel_action_restore_wptk_backup()

ajax_cpanel_action_restore_wptk_backup() : void

CPanel: action create WP-Toolkit backup.

Create backup for the selected cPanel server.

ajax_cpanel_action_delete_wptk_backup()

ajax_cpanel_action_delete_wptk_backup() : void

CPanel: action delete WP-Toolkit backup.

Create backup for the selected cPanel server.

ajax_cpanel_action_create_full_backup()

ajax_cpanel_action_create_full_backup() : void

CPanel: action create full backup.

Create backup for the selected cPanel server.

ajax_cpanel_action_create_database_backup()

ajax_cpanel_action_create_database_backup(boolean  $ret_val = false, integer  $website_id = null) : mixed

CPanel: action create database backup.

Create database backup for the selected cPanel server.

Parameters

boolean $ret_val

Return output or not.

integer $website_id

Website ID.

Returns

mixed

cpanel_action_create_manual_backup()

cpanel_action_create_manual_backup(boolean  $ret_val = false, integer  $website_id = null) : mixed

CPanel: Action create manual backup.

Create a cPanel Manual Backup.

Parameters

boolean $ret_val

Return output or not.

integer $website_id

Website ID.

Returns

mixed

cpanel_action_create_wptk_backup()

cpanel_action_create_wptk_backup(boolean  $ret_val = false) : array|void

CPanel: Action create WP-Toolkit backup.

Create a cPanel Manual Backup.

Parameters

boolean $ret_val

Return output or not.

Returns

array|void

cpanel_action_restore_wptk_backup()

cpanel_action_restore_wptk_backup(boolean  $ret_val = false) : array|void

CPanel: Action create WP-Toolkit backup.

Create a cPanel Manual Backup.

Parameters

boolean $ret_val

Return output or not.

Returns

array|void

cpanel_action_delete_wptk_backup()

cpanel_action_delete_wptk_backup() : void

Plesk: Action delete backup.

Delete Plesk Backup.

cpanel_action_refresh_available_backups()

cpanel_action_refresh_available_backups() : void

CPanel: Action refresh available backups.

Save backups to DB for the selected cPanel server.

cpanel_action_restore_backup()

cpanel_action_restore_backup() : void

CPanel: Action restore selected backup.

cpanel_action_restore_database_backup()

cpanel_action_restore_database_backup() : void

CPanel: Action restore selected database backup.

cpanel_action_restore_manual_backup()

cpanel_action_restore_manual_backup() : void

CPanel: Action restore selected manual backup.