\MainWP\DashboardMainWP_WP_CLI_Handle

Class MainWP_WP_CLI_Handle

Manage all child sites added to the MainWP Dashboard via WP CLI.

Summary

Methods
Properties
Constants
instance()
get_assoc_handle_commands()
get_assoc_args_commands()
handle_cli_callback()
get_cli_params()
map_assoc_args()
callback_sites_all_sites()
callback_sites_all_sites_count()
callback_sites_connected_sites()
callback_sites_connected_sites_count()
callback_sites_disconnected_sites()
callback_sites_disconnected_sites_count()
callback_sites_sync_sites()
callback_sites_check_sites()
callback_sites_disconnect_sites()
callback_site_site()
callback_site_site_info()
callback_site_site_installed_plugins()
callback_site_site_installed_plugins_count()
callback_site_site_active_plugins()
callback_site_site_active_plugins_count()
callback_site_site_inactive_plugins()
callback_site_site_inactive_plugins_count()
callback_site_site_installed_themes()
callback_site_site_installed_themes_count()
callback_site_site_active_themes()
callback_site_site_inactive_themes()
callback_site_site_inactive_themes_count()
callback_site_site_available_updates()
callback_site_site_available_updates_count()
callback_site_site_abandoned_plugins()
callback_site_site_abandoned_plugins_count()
callback_site_site_abandoned_themes()
callback_site_site_abandoned_themes_count()
callback_site_site_http_status()
callback_site_site_health_score()
callback_site_site_security_issues()
callback_site_add_site()
callback_site_edit_site()
callback_site_sync_site()
callback_site_reconnect_site()
callback_site_disconnect_site()
callback_site_remove_site()
callback_site_site_update_wordpress()
callback_site_site_update_plugins()
callback_site_site_update_themes()
callback_site_site_update_translations()
callback_site_site_update_item()
callback_site_site_manage_plugin()
callback_site_site_manage_theme()
callback_site_check_site_http_status()
callback_updates_available_updates()
callback_updates_ignored_plugins_updates()
callback_updates_site_ignored_plugins_updates()
callback_updates_ignored_themes_updates()
callback_updates_site_ignored_themes_updates()
callback_updates_ignore_updates()
callback_updates_ignore_update()
callback_updates_unignore_updates()
callback_updates_unignore_update()
handle_sync_sites()
print_process_success()
print_sites()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$instance
N/A

Properties

$instance

$instance : null

Singleton.

Type

null

Methods

instance()

instance() : self

MainWP WP CLI Handle Instance.

Returns

self —

$instance

get_assoc_handle_commands()

get_assoc_handle_commands(string  $comm) : array

Return available MainWP WP CLI Commands.

Parameters

string $comm

MainWP WP CLI Command.

Returns

array —

$cli_commands CLI Commands.

get_assoc_args_commands()

get_assoc_args_commands(string  $cli_com, array  $assoc_args) : string

Gets associated agruments for the command.

Parameters

string $cli_com

MainWP WP CLI command.

array $assoc_args

Associated arguments for the command.

Returns

string —

$callback Callback method.

handle_cli_callback()

handle_cli_callback(string  $cli_com, array  $args, array  $assoc_args) : boolean

Calls correct Callback.

Parameters

string $cli_com

CLI Command.

array $args

Arguments.

array $assoc_args

Correct callback.

Returns

boolean —

True on success, false or error.

get_cli_params()

get_cli_params(array  $args, array  $assoc_args, string  $what) : array

Gets parameters.

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

string $what

Targetted action.

Returns

array —

Required data.

map_assoc_args()

map_assoc_args(array  $assoc_args, array  $fields) : array

Maps arguments.

Parameters

array $assoc_args

Arguments.

array $fields

Fields.

Returns

array —

$data Required data.

callback_sites_all_sites()

callback_sites_all_sites() 

Lists all sites.

Command Example: wp mainwp sites --all-sites.

callback_sites_all_sites_count()

callback_sites_all_sites_count() 

Returns number of child sites.

Command Example: wp mainwp sites --all-sites-count.

callback_sites_connected_sites()

callback_sites_connected_sites() 

Lists all connected child sites.

Command Example: wp mainwp sites --connected-sites.

callback_sites_connected_sites_count()

callback_sites_connected_sites_count() 

Returns number of connected sites.

Command Example: wp mainwp sites --connected-sites-count.

callback_sites_disconnected_sites()

callback_sites_disconnected_sites() 

Lists all disconnected child sites.

Command Example: wp mainwp sites --disconnected-sites.

callback_sites_disconnected_sites_count()

callback_sites_disconnected_sites_count() 

Returns number of disconnected child sites.

Command Example: wp mainwp sites --disconnected-sites-count.

callback_sites_sync_sites()

callback_sites_sync_sites() 

Syncs all child sites.

Command Example: wp mainwp sites --sync-sites.

callback_sites_check_sites()

callback_sites_check_sites(array  $args, array  $assoc_args) 

Checks all child sites (HTTP Status).

Command Example: wp mainwp sites --check-sites.

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

callback_sites_disconnect_sites()

callback_sites_disconnect_sites(array  $args = array(), array  $assoc_args = false) 

Disconnects all child sites.

Command Example: wp mainwp sites --disconnect-sites.

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

callback_site_site()

callback_site_site(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists child site data.

Command Example: wp mainwp site --site [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_info()

callback_site_site_info(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Shows child site info.

Command Example: wp mainwp site --site-info [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_installed_plugins()

callback_site_site_installed_plugins(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists installed plugins on a child site.

Command Example: wp mainwp site --site-installed-plugins [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_installed_plugins_count()

callback_site_site_installed_plugins_count(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns the number of installed plugins on a child site.

Command Example: wp mainwp site --site-installed-plugins-count [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_active_plugins()

callback_site_site_active_plugins(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists all active plugins on a child site.

Command Example: wp mainwp site --site-active-plugins [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_active_plugins_count()

callback_site_site_active_plugins_count(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns a number of active plugins on a child site.

Command Example: wp mainwp site --site-active-plugins-count [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_inactive_plugins()

callback_site_site_inactive_plugins(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists all inactive plugins on a child site.

Command Example: wp mainwp site --site-inactive-plugins [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_inactive_plugins_count()

callback_site_site_inactive_plugins_count(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns the number of inactive plugins on a child site.

Command Example: wp mainwp site --site-inactive-plugins-count [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_installed_themes()

callback_site_site_installed_themes(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists all installed themes on a child site.

Command Example: wp mainwp site --site-installed-themes [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_installed_themes_count()

callback_site_site_installed_themes_count(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns the number of installed themes.

Command Example: wp mainwp site --site-installed-themes-count [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_active_themes()

callback_site_site_active_themes(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Shows the active theme on the child site.

Command Example: wp mainwp site --site-active-themes [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_inactive_themes()

callback_site_site_inactive_themes(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists all inactive themes on a child site.

Command Example: wp mainwp site --site-inactive-themes [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_inactive_themes_count()

callback_site_site_inactive_themes_count(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns the number of inactive themes.

Command Example: wp mainwp site --site-inactive-themes-count [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_available_updates()

callback_site_site_available_updates(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists available updates for a child site.

Command Example: wp mainwp site --site-available-updates [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_available_updates_count()

callback_site_site_available_updates_count(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns the number of available updates for a child site.

Command Example: wp mainwp site --site-available-updates-count [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_abandoned_plugins()

callback_site_site_abandoned_plugins(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists all abandoned plugins on a child site.

Command Example: wp mainwp site --site-abandoned-plugins [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_abandoned_plugins_count()

callback_site_site_abandoned_plugins_count(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns the number of abaindoned plugins on a child site.

Command Example: wp mainwp site --site-abandoned-plugins-count [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_abandoned_themes()

callback_site_site_abandoned_themes(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists all abandoned themes on a child site.

Command Example: wp mainwp site --site-abandoned-themes [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_abandoned_themes_count()

callback_site_site_abandoned_themes_count(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns the number of abandoned themes on a child site.

Command Example: wp mainwp site --site-abandoned-themes-count [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_http_status()

callback_site_site_http_status(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns child site HTTP status.

Command Example: wp mainwp site --site-http-status [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_health_score()

callback_site_site_health_score(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Returns child site Health score.

Command Example: wp mainwp site --site-health-score [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_security_issues()

callback_site_site_security_issues(array  $args = array(), array  $assoc_args = array(), object  $website = false) 

Lists child site security issues.

Command Example: wp mainwp site --site-security-issues [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_add_site()

callback_site_add_site(array  $args = array(), array  $assoc_args, object  $website = false) 

Adds child site.

Command Example: wp mainwp site --add-site [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_edit_site()

callback_site_edit_site(array  $args = array(), array  $assoc_args, object  $website = false) 

Edits child site.

Command Example: wp mainwp site --edit-site [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_sync_site()

callback_site_sync_site(array  $args = array(), array  $assoc_args, object  $website = false) 

Syncs child site.

Command Example: wp mainwp site --sync-site [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_reconnect_site()

callback_site_reconnect_site(array  $args = array(), array  $assoc_args, object  $website = false) 

Reconnects child site.

Command Example: wp mainwp site --reconnect-site [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_disconnect_site()

callback_site_disconnect_site(array  $args = array(), array  $assoc_args, object  $website = false) 

Disconnects child site.

Command Example: wp mainwp site --disconnect-site [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_remove_site()

callback_site_remove_site(array  $args = array(), array  $assoc_args, object  $website = false) 

Removes child site from the MainWP Dashboard.

Command Example: wp mainwp site --remove-site [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_update_wordpress()

callback_site_site_update_wordpress(array  $args = array(), array  $assoc_args, object  $website = false) 

Updates WP Core on a child site.

Command Example: wp mainwp site --site-update-wordpress [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_update_plugins()

callback_site_site_update_plugins(array  $args = array(), array  $assoc_args, object  $website = false) 

Updates all plugins on a child site.

Command Example: wp mainwp site --site-update-plugins [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_update_themes()

callback_site_site_update_themes(array  $args = array(), array  $assoc_args, object  $website = false) 

Updates all themes on a child site.

Command Example: wp mainwp site --site-update-themes [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_update_translations()

callback_site_site_update_translations(array  $args = array(), array  $assoc_args, object  $website = false) 

Updates translations on a child site.

Command Example: wp mainwp site --site-update-translations [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_update_item()

callback_site_site_update_item(array  $args = array(), array  $assoc_args, object  $website = false) 

Updates single item on a child site.

Command Example: wp mainwp site --site-update-item [] --type=[type] --slug=[slug].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_manage_plugin()

callback_site_site_manage_plugin(array  $args = array(), array  $assoc_args, object  $website = false) 

Manages plgins on a child site.

Command Example: wp mainwp site --site-manage-plugin [] --action=[action] --plugin=[plugin].

Action: activate|deactivate|delete Plugin: plugin slugs separated by ||.

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_site_manage_theme()

callback_site_site_manage_theme(array  $args = array(), array  $assoc_args, object  $website = false) 

Manages themes on a child site.

Command Example: wp mainwp site --site-manage-theme [] --action=[action] --theme=[theme].

action: activate|delete. theme: theme name.

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_site_check_site_http_status()

callback_site_check_site_http_status(array  $args = array(), array  $assoc_args, object  $website = false) 

Checks child site for HTTP Status.

Command Example: wp mainwp site --check-site-http-status [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_updates_available_updates()

callback_updates_available_updates(array  $args = array(), array  $assoc_args = array()) 

Lists all available update for all sites.

Command Example: wp mainwp updates --available-updates [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

callback_updates_ignored_plugins_updates()

callback_updates_ignored_plugins_updates(array  $args = array(), array  $assoc_args = array()) 

Lists all ignored plugins for a child site.

Command Example: wp mainwp updates --ignored-plugins-updates [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

callback_updates_site_ignored_plugins_updates()

callback_updates_site_ignored_plugins_updates(array  $args = array(), array  $assoc_args, object  $website = false) 

Lists all per site ignored plugin updates for a child site.

Command Example: wp mainwp updates --site-ignored-plugins-updates [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_updates_ignored_themes_updates()

callback_updates_ignored_themes_updates(array  $args = array(), array  $assoc_args, object  $website = false) 

Lists all ignored theme updates for a child site.

Command Example: wp mainwp updates --ignored-themes-updates [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_updates_site_ignored_themes_updates()

callback_updates_site_ignored_themes_updates(array  $args = array(), array  $assoc_args, object  $website = false) 

Lists all per site ignored theme updates for a child site.

Command Example: wp mainwp updates --site-ignored-themes-updates [].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_updates_ignore_updates()

callback_updates_ignore_updates(array  $args = array(), array  $assoc_args, object  $website = false) 

Ignores an update globally.

Command Example: wp mainwp updates --ignore-updates --type=[type] --slug=[slug] --name=[name].

type: plugin|theme

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_updates_ignore_update()

callback_updates_ignore_update(array  $args = array(), array  $assoc_args, object  $website = false) 

Ignores an update on a child site.

Command Example: wp mainwp updates --ignore-update [] --type=[type] --slug=[slug] --name=[name].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_updates_unignore_updates()

callback_updates_unignore_updates(array  $args = array(), array  $assoc_args, object  $website = false) 

Unignores an update.

Command Example: wp mainwp updates --unignore-updates --type=[type] --slug=[slug].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

callback_updates_unignore_update()

callback_updates_unignore_update(array  $args = array(), array  $assoc_args, object  $website = false) 

Unitnores an update on a child site.

Command Example: wp mainwp updates --unignore-update [] --type=[type] --slug=[slug].

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

object $website

Object containing child site data.

handle_sync_sites()

handle_sync_sites(array  $args = array(), array  $assoc_args = false) 

Syncs all child sites.

Command Example: wp mainwp sites --sync-sites.

Parameters

array $args

Arguments.

array $assoc_args

Arguments.

print_process_success()

print_process_success() 

Prints process success message.

print_sites()

print_sites(array  $data) 

Prints child sites list.

Parameters

array $data

Array containing child sites.