WC_REST_System_Status_Tools_V2_Controller::get_toolspublicWC 1.0

A list of available tools for use in the system status section. 'button' becomes 'action' in the API.

Method of the class: WC_REST_System_Status_Tools_V2_Controller{}

Returns

Array.

Usage

$WC_REST_System_Status_Tools_V2_Controller = new WC_REST_System_Status_Tools_V2_Controller();
$WC_REST_System_Status_Tools_V2_Controller->get_tools();

WC_REST_System_Status_Tools_V2_Controller::get_tools() code WC 11.0.0

public function get_tools() {
	$tools = array(
		'clear_transients'                     => array(
			'name'   => __( 'WooCommerce transients', 'woocommerce' ),
			'button' => __( 'Clear transients', 'woocommerce' ),
			'desc'   => __( 'This tool will clear the product/shop transients cache.', 'woocommerce' ),
		),
		'clear_expired_transients'             => array(
			'name'   => __( 'Expired transients', 'woocommerce' ),
			'button' => __( 'Clear transients', 'woocommerce' ),
			'desc'   => __( 'This tool will clear ALL expired transients from WordPress.', 'woocommerce' ),
		),
		'delete_orphaned_variations'           => array(
			'name'   => __( 'Orphaned variations', 'woocommerce' ),
			'button' => __( 'Delete orphaned variations', 'woocommerce' ),
			'desc'   => __( 'This tool will delete all variations which have no parent.', 'woocommerce' ),
		),
		'clear_expired_download_permissions'   => array(
			'name'   => __( 'Used-up download permissions', 'woocommerce' ),
			'button' => __( 'Clean up download permissions', 'woocommerce' ),
			'desc'   => __( 'This tool will delete expired download permissions and permissions with 0 remaining downloads.', 'woocommerce' ),
		),
		'regenerate_product_lookup_tables'     => array(
			'name'             => __( 'Product lookup tables', 'woocommerce' ),
			'button'           => __( 'Regenerate', 'woocommerce' ),
			'desc'             => __( 'This tool will regenerate product lookup table data. This process may take a while.', 'woocommerce' ),
			'requires_refresh' => true,
		),
		'repair_coupons_lookup_table'          => array(
			'name'   => __( 'Coupons lookup table', 'woocommerce' ),
			'button' => __( 'Repair', 'woocommerce' ),
			'desc'   => __( 'This tool will repair the coupons lookup table data with missing discount amounts. This process may take a while.', 'woocommerce' ),
		),
		'recount_terms'                        => array(
			'name'   => __( 'Term counts', 'woocommerce' ),
			'button' => __( 'Recount terms', 'woocommerce' ),
			'desc'   => __( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.', 'woocommerce' ),
		),
		'reset_roles'                          => array(
			'name'   => __( 'Capabilities', 'woocommerce' ),
			'button' => __( 'Reset capabilities', 'woocommerce' ),
			'desc'   => __( 'This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce' ),
		),
		'clear_sessions'                       => array(
			'name'   => __( 'Clear customer sessions', 'woocommerce' ),
			'button' => __( 'Clear', 'woocommerce' ),
			'desc'   => sprintf(
				'<strong class="red">%1$s</strong> %2$s',
				__( 'Note:', 'woocommerce' ),
				__( 'This tool will delete all customer session data from the database, including current carts and saved carts in the database.', 'woocommerce' )
			),
		),
		'clear_template_cache'                 => array(
			'name'   => __( 'Clear template cache', 'woocommerce' ),
			'button' => __( 'Clear', 'woocommerce' ),
			'desc'   => sprintf(
				'<strong class="red">%1$s</strong> %2$s',
				__( 'Note:', 'woocommerce' ),
				__( 'This tool will empty the template cache.', 'woocommerce' )
			),
		),
		'clear_system_status_theme_info_cache' => array(
			'name'   => __( 'Clear system status theme info cache', 'woocommerce' ),
			'button' => __( 'Clear', 'woocommerce' ),
			'desc'   => sprintf(
				'<strong class="red">%1$s</strong> %2$s',
				__( 'Note:', 'woocommerce' ),
				__( 'This tool will empty the system status theme info cache.', 'woocommerce' )
			),
		),
		'install_pages'                        => array(
			'name'   => __( 'Create default WooCommerce pages', 'woocommerce' ),
			'button' => __( 'Create pages', 'woocommerce' ),
			'desc'   => sprintf(
				'<strong class="red">%1$s</strong> %2$s',
				__( 'Note:', 'woocommerce' ),
				__( 'This tool will install all the missing WooCommerce pages. Pages already defined and set up will not be replaced.', 'woocommerce' )
			),
		),
		'delete_taxes'                         => array(
			'name'   => __( 'Delete WooCommerce tax rates', 'woocommerce' ),
			'button' => __( 'Delete tax rates', 'woocommerce' ),
			'desc'   => sprintf(
				'<strong class="red">%1$s</strong> %2$s',
				__( 'Note:', 'woocommerce' ),
				__( 'This option will delete ALL of your tax rates, use with caution. This action cannot be reversed.', 'woocommerce' )
			),
		),
		'regenerate_thumbnails'                => array(
			'name'             => __( 'Regenerate shop thumbnails', 'woocommerce' ),
			'button'           => __( 'Regenerate', 'woocommerce' ),
			'desc'             => __( 'This will regenerate all shop thumbnails to match your theme and/or image settings.', 'woocommerce' ),
			'requires_refresh' => true,
		),
		'db_update_routine'                    => array(
			'name'   => __( 'Update database', 'woocommerce' ),
			'button' => __( 'Update database', 'woocommerce' ),
			'desc'   => sprintf(
				'<strong class="red">%1$s</strong> %2$s',
				__( 'Note:', 'woocommerce' ),
				__( 'This tool will update your WooCommerce database to the latest version. Please ensure you make sufficient backups before proceeding.', 'woocommerce' )
			),
		),
		'recreate_order_address_fts_index'     => array(
			'name'   => __( 'Re-create Order Address FTS index', 'woocommerce' ),
			'button' => __( 'Recreate index', 'woocommerce' ),
			'desc'   => __( 'This tool will recreate the full text search index for order addresses. If the index does not exist, it will try to create it.', 'woocommerce' ),
		),
	);
	if ( method_exists( 'WC_Install', 'verify_base_tables' ) ) {
		$tools['verify_db_tables'] = array(
			'name'   => __( 'Verify base database tables', 'woocommerce' ),
			'button' => __( 'Verify database', 'woocommerce' ),
			'desc'   => sprintf(
				__( 'Verify if all base database tables are present.', 'woocommerce' )
			),
		);
	}

	// Jetpack does the image resizing heavy lifting so you don't have to.
	if ( ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) || ! apply_filters( 'woocommerce_background_image_regeneration', true ) ) {
		unset( $tools['regenerate_thumbnails'] );
	}

	if ( ! function_exists( 'wc_clear_template_cache' ) ) {
		unset( $tools['clear_template_cache'] );
	}

	if ( wc_update_product_lookup_tables_is_running() ) {
		$tools['regenerate_product_lookup_tables']['desc'] = __(
			'Product lookup table regeneration is running in the background. Product display, sorting, and reports may not be accurate until this finishes.',
			'woocommerce'
		);
		if ( Constants::is_true( 'DISABLE_WP_CRON' ) ) {
			$tools['regenerate_product_lookup_tables']['desc'] .= ' ' . __(
				'WP-Cron has been disabled, which may prevent this update from completing.',
				'woocommerce'
			);
		}
		$tools['regenerate_product_lookup_tables']['button']      = __( 'Regenerating in progress', 'woocommerce' );
		$tools['regenerate_product_lookup_tables']['disabled']    = true;
		$tools['regenerate_product_lookup_tables']['status_text'] = $this->get_regenerating_lookup_table_status_text();
	}

	if ( isset( $tools['regenerate_thumbnails'] ) && WC_Regenerate_Images::is_regeneration_in_progress() ) {
		$tools['regenerate_thumbnails']['desc']        = __(
			'Thumbnail regeneration is running in the background. Depending on the number of images in your store, this may take a while.',
			'woocommerce'
		);
		$tools['regenerate_thumbnails']['button']      = __( 'Regenerating in progress', 'woocommerce' );
		$tools['regenerate_thumbnails']['disabled']    = true;
		$tools['regenerate_thumbnails']['status_text'] = $this->get_regenerating_thumbnails_status_text();
	}

	return apply_filters( 'woocommerce_debug_tools', $tools );
}