Action hook 'upgrader_process_complete'

in WP Core File wp-admin/includes/class-plugin-upgrader.php at line 414

Description

Upgrades several plugins at once. } / public function bulk_upgrade( $plugins, $args = array() ) { global $wp_version; $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->bulk = true; $this->upgrade_strings(); $current = get_site_transient( 'update_plugins' ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 ); $this->skin->header(); // Connect to the filesystem first. $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) ); if ( ! $res ) { $this->skin->footer(); return false; } $this->skin->bulk_header(); /* Only start maintenance mode if: - running Multisite and there are one or more plugins specified, OR - a plugin with an update available is currently active.

Occurrences

Filename Line Number
wp-admin/includes/class-plugin-upgrader.php 414
wp-admin/includes/class-language-pack-upgrader.php 280
wp-admin/includes/class-wp-upgrader.php 970
wp-admin/includes/class-core-upgrader.php 217
wp-admin/includes/class-theme-upgrader.php 513

Parameters

Type Name Description
string[] $plugins Array of paths to plugin files relative to the plugins directory.
array $args { Optional. Other arguments for upgrading several plugins at once.

Usage Examples

Example 1

add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache'

Example 2

add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache'

PHP Doc

/**
	 * Upgrades several plugins at once.
	 *
	 * @since 2.8.0
	 * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional.
	 *
	 * @global string $wp_version The WordPress version string.
	 *
	 * @param string[] $plugins Array of paths to plugin files relative to the plugins directory.
	 * @param array    $args {
	 *     Optional. Other arguments for upgrading several plugins at once.
	 *
	 *     @type bool $clear_update_cache Whether to clear the plugin updates cache if successful. Default true.
	 * }
	 * @return array|false An array of results indexed by plugin file, or false if unable to connect to the filesystem.
	 */
	public function bulk_upgrade( $plugins, $args = array() ) {
		global $wp_version;

		$defaults    = array(
			'clear_update_cache' => true,
		);
		$parsed_args = wp_parse_args( $args, $defaults );

		$this->init();
		$this->bulk = true;
		$this->upgrade_strings();

		$current = get_site_transient( 'update_plugins' );

		add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 );

		$this->skin->header();

		// Connect to the filesystem first.
		$res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) );
		if ( ! $res ) {
			$this->skin->footer();
			return false;
		}

		$this->skin->bulk_header();

		/*
		 * Only start maintenance mode if:
		 * - running Multisite and there are one or more plugins specified, OR
		 * - a plugin with an update available is currently active.
		 * @todo For multisite, maintenance mode should only kick in for individual sites if at all possible.
		 */