mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Upgrade/Install: Check WordPress and PHP version requirements when uploading a plugin or theme from ZIP file.
Props mariovalney, desrosj. See #50593. git-svn-id: https://develop.svn.wordpress.org/trunk@48666 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -588,7 +588,32 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
);
|
||||
}
|
||||
|
||||
$requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null;
|
||||
$requires_wp = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null;
|
||||
|
||||
if ( ! is_php_version_compatible( $requires_php ) ) {
|
||||
$error = sprintf(
|
||||
/* translators: 1: Current PHP version, 2: Version required by the uploaded theme. */
|
||||
__( 'The PHP version on your server is %1$s, however the uploaded theme requires %2$s.' ),
|
||||
phpversion(),
|
||||
$requires_php
|
||||
);
|
||||
|
||||
return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error );
|
||||
}
|
||||
if ( ! is_wp_version_compatible( $requires_wp ) ) {
|
||||
$error = sprintf(
|
||||
/* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */
|
||||
__( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ),
|
||||
$GLOBALS['wp_version'],
|
||||
$requires_wp
|
||||
);
|
||||
|
||||
return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error );
|
||||
}
|
||||
|
||||
$this->new_theme_data = $info;
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user