diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php
index 235df51..fa833de 100644
|
a
|
b
|
class Plugin_Upgrader extends WP_Upgrader {
|
| 1044 | 1044 | * @global WP_Filesystem_Base $wp_filesystem Subclass |
| 1045 | 1045 | * |
| 1046 | 1046 | * @param string $source The path to the downloaded package source. |
| | 1047 | * @param string $environment The environment in which the check is running (default, in-plugin-installer, etc). |
| 1047 | 1048 | * @return string|WP_Error The source as passed, or a {@see WP_Error} object if no plugins were found. |
| 1048 | 1049 | */ |
| 1049 | | public function check_package($source) { |
| | 1050 | public function check_package($source, $environment = 'default') { |
| 1050 | 1051 | global $wp_filesystem; |
| 1051 | 1052 | |
| 1052 | 1053 | if ( is_wp_error($source) ) |
| … |
… |
class Plugin_Upgrader extends WP_Upgrader {
|
| 1056 | 1057 | if ( ! is_dir($working_directory) ) // Sanity check, if the above fails, let's not prevent installation. |
| 1057 | 1058 | return $source; |
| 1058 | 1059 | |
| | 1060 | if ( 'default' == $environment ) { |
| | 1061 | // Check if we've got a theme here |
| | 1062 | $theme_check = Theme_Upgrader::check_package( $source, 'in-theme-installer' ); |
| | 1063 | |
| | 1064 | if ( ! is_a( $theme_check, 'WP_Error' ) ) { |
| | 1065 | return new WP_Error( 'incompatible_archive_plugin_is_theme', $this->strings['incompatible_archive'], __( 'It looks like you\'re wanting to install a theme. Visit the theme installer to do this.' ) ); |
| | 1066 | } |
| | 1067 | } |
| | 1068 | |
| 1059 | 1069 | // Check the folder contains at least 1 valid plugin. |
| 1060 | 1070 | $plugins_found = false; |
| 1061 | 1071 | $files = glob( $working_directory . '*.php' ); |
| … |
… |
class Theme_Upgrader extends WP_Upgrader {
|
| 1578 | 1588 | * @global WP_Filesystem_Base $wp_filesystem Subclass |
| 1579 | 1589 | * |
| 1580 | 1590 | * @param string $source The full path to the package source. |
| | 1591 | * @param string $environment The environment in which the check is running (default, in-theme-installer, etc). |
| 1581 | 1592 | * @return string|WP_Error The source or a WP_Error. |
| 1582 | 1593 | */ |
| 1583 | | public function check_package( $source ) { |
| | 1594 | public function check_package( $source, $environment = 'default' ) { |
| 1584 | 1595 | global $wp_filesystem; |
| 1585 | 1596 | |
| 1586 | 1597 | if ( is_wp_error($source) ) |
| … |
… |
class Theme_Upgrader extends WP_Upgrader {
|
| 1591 | 1602 | if ( ! is_dir($working_directory) ) // Sanity check, if the above fails, let's not prevent installation. |
| 1592 | 1603 | return $source; |
| 1593 | 1604 | |
| | 1605 | if ( 'default' == $environment ) { |
| | 1606 | // Check if we've got a plugin here |
| | 1607 | $plugin_check = Plugin_Upgrader::check_package( $source, 'in-theme-installer' ); |
| | 1608 | |
| | 1609 | if ( ! is_a( $plugin_check, 'WP_Error' ) ) { |
| | 1610 | return new WP_Error( 'incompatible_archive_theme_is_plugin', $this->strings['incompatible_archive'], __( 'It looks like you\'re wanting to install a plugin. Visit the plugin installer to do this.' ) ); |
| | 1611 | } |
| | 1612 | } |
| | 1613 | |
| 1594 | 1614 | // A proper archive should have a style.css file in the single subdirectory |
| 1595 | 1615 | if ( ! file_exists( $working_directory . 'style.css' ) ) |
| 1596 | 1616 | return new WP_Error( 'incompatible_archive_theme_no_style', $this->strings['incompatible_archive'], __( 'The theme is missing the <code>style.css</code> stylesheet.' ) ); |