272 * Upgrades several plugins at once. |
272 * Upgrades several plugins at once. |
273 * |
273 * |
274 * @since 2.8.0 |
274 * @since 2.8.0 |
275 * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional. |
275 * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional. |
276 * |
276 * |
277 * @global string $wp_version The WordPress version string. |
|
278 * |
|
279 * @param string[] $plugins Array of paths to plugin files relative to the plugins directory. |
277 * @param string[] $plugins Array of paths to plugin files relative to the plugins directory. |
280 * @param array $args { |
278 * @param array $args { |
281 * Optional. Other arguments for upgrading several plugins at once. |
279 * Optional. Other arguments for upgrading several plugins at once. |
282 * |
280 * |
283 * @type bool $clear_update_cache Whether to clear the plugin updates cache if successful. Default true. |
281 * @type bool $clear_update_cache Whether to clear the plugin updates cache if successful. Default true. |
284 * } |
282 * } |
285 * @return array|false An array of results indexed by plugin file, or false if unable to connect to the filesystem. |
283 * @return array|false An array of results indexed by plugin file, or false if unable to connect to the filesystem. |
286 */ |
284 */ |
287 public function bulk_upgrade( $plugins, $args = array() ) { |
285 public function bulk_upgrade( $plugins, $args = array() ) { |
288 global $wp_version; |
286 $wp_version = wp_get_wp_version(); |
289 |
287 |
290 $defaults = array( |
288 $defaults = array( |
291 'clear_update_cache' => true, |
289 'clear_update_cache' => true, |
292 ); |
290 ); |
293 $parsed_args = wp_parse_args( $args, $defaults ); |
291 $parsed_args = wp_parse_args( $args, $defaults ); |
455 * Hooked to the {@see 'upgrader_source_selection'} filter by Plugin_Upgrader::install(). |
453 * Hooked to the {@see 'upgrader_source_selection'} filter by Plugin_Upgrader::install(). |
456 * |
454 * |
457 * @since 3.3.0 |
455 * @since 3.3.0 |
458 * |
456 * |
459 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. |
457 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. |
460 * @global string $wp_version The WordPress version string. |
|
461 * |
458 * |
462 * @param string $source The path to the downloaded package source. |
459 * @param string $source The path to the downloaded package source. |
463 * @return string|WP_Error The source as passed, or a WP_Error object on failure. |
460 * @return string|WP_Error The source as passed, or a WP_Error object on failure. |
464 */ |
461 */ |
465 public function check_package( $source ) { |
462 public function check_package( $source ) { |
466 global $wp_filesystem, $wp_version; |
463 global $wp_filesystem; |
467 |
464 |
|
465 $wp_version = wp_get_wp_version(); |
468 $this->new_plugin_data = array(); |
466 $this->new_plugin_data = array(); |
469 |
467 |
470 if ( is_wp_error( $source ) ) { |
468 if ( is_wp_error( $source ) ) { |
471 return $source; |
469 return $source; |
472 } |
470 } |