public function update_plugin( $plugin_slug, $tag = 'master' ) {
		$plugin           = null;
		$is_plugin_active = false;

		foreach ( (array) Singleton::get_instance( 'Plugin', $this )->get_plugin_configs() as $config_entry ) {
			if ( $config_entry->slug === $plugin_slug ) {
				$plugin = $config_entry;
				break;
			}
		}

		if ( ! $plugin ) {
			throw new \UnexpectedValueException( 'Plugin not found or not updatable with GitHub Updater: ' . $plugin_slug );
		}

		if ( is_plugin_active( $plugin->file ) ) {
			$is_plugin_active = true;
		}

		$this->get_remote_repo_meta( $plugin );
		$repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $plugin->git, $plugin );

		$update = [
			'slug'        => $plugin->slug,
			'plugin'      => $plugin->file,
			'new_version' => null,
			'url'         => $plugin->uri,
			'package'     => $repo_api->construct_download_link( $tag ),
		];

		add_filter(
			'site_transient_update_plugins',
			function ( $current ) use ( $plugin, $update ) {
				$current->response[ $plugin->file ] = (object) $update;

				return $current;
			}
		);

		$upgrader = new \Plugin_Upgrader( $this->upgrader_skin );
		$upgrader->upgrade( $plugin->file );

		if ( $is_plugin_active ) {
			$activate = is_multisite() ? activate_plugin( $plugin->file, null, true ) : activate_plugin( $plugin->file );
			if ( ! $activate ) {
				$this->upgrader_skin->messages[] = 'Plugin reactivated successfully.';
			}
		}
	}
public function update_plugin( $plugin_slug, $tag = 'master' ) {
		$plugin           = null;
		$is_plugin_active = false;

		foreach ( (array) Singleton::get_instance( 'Plugin', $this )->get_plugin_configs() as $config_entry ) {
			if ( $config_entry->slug === $plugin_slug ) {
				$plugin = $config_entry;
				break;
			}
		}

		if ( ! $plugin ) {
			throw new \UnexpectedValueException( 'Plugin not found or not updatable with GitHub Updater: ' . $plugin_slug );
		}

		if ( is_plugin_active( $plugin->file ) ) {
			$is_plugin_active = true;
		}

		$this->get_remote_repo_meta( $plugin );
		$repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $plugin->git, $plugin );

		$update = [
			'slug'        => $plugin->slug,
			'plugin'      => $plugin->file,
			'new_version' => null,
			'url'         => $plugin->uri,
			'package'     => $repo_api->construct_download_link( $tag ),
		];

		add_filter(
			'site_transient_update_plugins',
			function ( $current ) use ( $plugin, $update ) {
				$current->response[ $plugin->file ] = (object) $update;

				return $current;
			}
		);

		$upgrader = new \Plugin_Upgrader( $this->upgrader_skin );
		$upgrader->upgrade( $plugin->file );

		if ( $is_plugin_active ) {
			$activate = is_multisite() ? activate_plugin( $plugin->file, null, true ) : activate_plugin( $plugin->file );
			if ( ! $activate ) {
				$this->upgrader_skin->messages[] = 'Plugin reactivated successfully.';
			}
		}
	}
public function update_plugin ( $ plugin_slug , $ tag = 'master' ) { $ plugin = null ; $ is_plugin_active = false ; foreach ( ( array ) Singleton :: get_instance ( 'Plugin' , $ this ) -> get_plugin_configs ( ) as $ config_entry ) { if ( $ config_entry -> slug === $ plugin_slug ) { $ plugin = $ config_entry ; break ; } } if ( ! $ plugin ) { throw new \ UnexpectedValueException ( 'Plugin not found or not updatable with GitHub Updater: ' . $ plugin_slug ) ; } if ( is_plugin_active ( $ plugin -> file ) ) { $ is_plugin_active = true ; } $ this -> get_remote_repo_meta ( $ plugin ) ; $ repo_api = Singleton :: get_instance ( 'API' , $ this ) -> get_repo_api ( $ plugin -> git , $ plugin ) ; $ update = [ 'slug' => $ plugin -> slug , 'plugin' => $ plugin -> file , 'new_version' => null , 'url' => $ plugin -> uri , 'package' => $ repo_api -> construct_download_link ( $ tag ) , ] ; add_filter ( 'site_transient_update_plugins' , function ( $ current ) use ( $ plugin , $ update ) { $ current -> response [ $ plugin -> file ] = ( object ) $ update ; return $ current ; } ) ; $ upgrader = new \ Plugin_Upgrader ( $ this -> upgrader_skin ) ; $ upgrader -> upgrade ( $ plugin -> file ) ; if ( $ is_plugin_active ) { $ activate = is_multisite ( ) ? activate_plugin ( $ plugin -> file , null , true ) : activate_plugin ( $ plugin -> file ) ; if ( ! $ activate ) { $ this -> upgrader_skin -> messages [ ] = 'Plugin reactivated successfully.' ; } } }
Update plugin.

@param string $plugin_slug
@param string $tag

@throws \UnexpectedValueException Plugin not found or not updatable.
Update plugin .