wp/wp-admin/includes/class-plugin-upgrader.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
--- a/wp/wp-admin/includes/class-plugin-upgrader.php	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/includes/class-plugin-upgrader.php	Wed Sep 21 18:19:35 2022 +0200
@@ -162,9 +162,9 @@
 			 *
 			 * @since 5.5.0
 			 *
-			 * @param string  $package          The package file.
-			 * @param array   $new_plugin_data  The new plugin data.
-			 * @param string  $package_type     The package type (plugin or theme).
+			 * @param string  $package      The package file.
+			 * @param array   $data         The new plugin or theme data.
+			 * @param string  $package_type The package type ('plugin' or 'theme').
 			 */
 			do_action( 'upgrader_overwrote_package', $package, $this->new_plugin_data, 'plugin' );
 		}
@@ -398,21 +398,20 @@
 	}
 
 	/**
-	 * Check a source package to be sure it contains a plugin.
+	 * Checks that the source package contains a valid plugin.
 	 *
-	 * This function is added to the {@see 'upgrader_source_selection'} filter by
-	 * Plugin_Upgrader::install().
+	 * Hooked to the {@see 'upgrader_source_selection'} filter by Plugin_Upgrader::install().
 	 *
 	 * @since 3.3.0
 	 *
 	 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
+	 * @global string             $wp_version    The WordPress version string.
 	 *
 	 * @param string $source The path to the downloaded package source.
-	 * @return string|WP_Error The source as passed, or a WP_Error object
-	 *                         if no plugins were found.
+	 * @return string|WP_Error The source as passed, or a WP_Error object on failure.
 	 */
 	public function check_package( $source ) {
-		global $wp_filesystem;
+		global $wp_filesystem, $wp_version;
 
 		$this->new_plugin_data = array();
 
@@ -459,7 +458,7 @@
 			$error = sprintf(
 				/* translators: 1: Current WordPress version, 2: Version required by the uploaded plugin. */
 				__( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ),
-				$GLOBALS['wp_version'],
+				$wp_version,
 				$requires_wp
 			);