wip
This commit is contained in:
@@ -311,7 +311,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
return false;
|
||||
}
|
||||
|
||||
$r = $current->response[ $theme ];
|
||||
$upgrade_data = $current->response[ $theme ];
|
||||
|
||||
add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 );
|
||||
add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 );
|
||||
@@ -323,7 +323,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
|
||||
$this->run(
|
||||
array(
|
||||
'package' => $r['package'],
|
||||
'package' => $upgrade_data['package'],
|
||||
'destination' => get_theme_root( $theme ),
|
||||
'clear_destination' => true,
|
||||
'clear_working' => true,
|
||||
@@ -400,8 +400,8 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
$this->skin->header();
|
||||
|
||||
// Connect to the filesystem first.
|
||||
$res = $this->fs_connect( array( WP_CONTENT_DIR ) );
|
||||
if ( ! $res ) {
|
||||
$connected = $this->fs_connect( array( WP_CONTENT_DIR ) );
|
||||
if ( ! $connected ) {
|
||||
$this->skin->footer();
|
||||
return false;
|
||||
}
|
||||
@@ -441,30 +441,30 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
}
|
||||
|
||||
// Get the URL to the zip file.
|
||||
$r = $current->response[ $theme ];
|
||||
$upgrade_data = $current->response[ $theme ];
|
||||
|
||||
if ( isset( $r['requires'] ) && ! is_wp_version_compatible( $r['requires'] ) ) {
|
||||
if ( isset( $upgrade_data['requires'] ) && ! is_wp_version_compatible( $upgrade_data['requires'] ) ) {
|
||||
$result = new WP_Error(
|
||||
'incompatible_wp_required_version',
|
||||
sprintf(
|
||||
/* translators: 1: Current WordPress version, 2: WordPress version required by the new theme version. */
|
||||
__( 'Your WordPress version is %1$s, however the new theme version requires %2$s.' ),
|
||||
$wp_version,
|
||||
$r['requires']
|
||||
$upgrade_data['requires']
|
||||
)
|
||||
);
|
||||
|
||||
$this->skin->before( $result );
|
||||
$this->skin->error( $result );
|
||||
$this->skin->after();
|
||||
} elseif ( isset( $r['requires_php'] ) && ! is_php_version_compatible( $r['requires_php'] ) ) {
|
||||
} elseif ( isset( $upgrade_data['requires_php'] ) && ! is_php_version_compatible( $upgrade_data['requires_php'] ) ) {
|
||||
$result = new WP_Error(
|
||||
'incompatible_php_required_version',
|
||||
sprintf(
|
||||
/* translators: 1: Current PHP version, 2: PHP version required by the new theme version. */
|
||||
__( 'The PHP version on your server is %1$s, however the new theme version requires %2$s.' ),
|
||||
PHP_VERSION,
|
||||
$r['requires_php']
|
||||
$upgrade_data['requires_php']
|
||||
)
|
||||
);
|
||||
|
||||
@@ -475,7 +475,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
|
||||
$result = $this->run(
|
||||
array(
|
||||
'package' => $r['package'],
|
||||
'package' => $upgrade_data['package'],
|
||||
'destination' => get_theme_root( $theme ),
|
||||
'clear_destination' => true,
|
||||
'clear_working' => true,
|
||||
@@ -589,7 +589,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
}
|
||||
|
||||
// All these headers are needed on Theme_Installer_Skin::do_overwrite().
|
||||
$info = get_file_data(
|
||||
$new_theme_data = get_file_data(
|
||||
$working_directory . 'style.css',
|
||||
array(
|
||||
'Name' => 'Theme Name',
|
||||
@@ -601,7 +601,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
)
|
||||
);
|
||||
|
||||
if ( empty( $info['Name'] ) ) {
|
||||
if ( empty( $new_theme_data['Name'] ) ) {
|
||||
return new WP_Error(
|
||||
'incompatible_archive_theme_no_name',
|
||||
$this->strings['incompatible_archive'],
|
||||
@@ -619,7 +619,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
* - block themes require /templates/index.html or block-templates/index.html (deprecated 5.9.0).
|
||||
*/
|
||||
if (
|
||||
empty( $info['Template'] ) &&
|
||||
empty( $new_theme_data['Template'] ) &&
|
||||
! file_exists( $working_directory . 'index.php' ) &&
|
||||
! file_exists( $working_directory . 'templates/index.html' ) &&
|
||||
! file_exists( $working_directory . 'block-templates/index.html' )
|
||||
@@ -639,8 +639,8 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
);
|
||||
}
|
||||
|
||||
$requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null;
|
||||
$requires_wp = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null;
|
||||
$requires_php = isset( $new_theme_data['RequiresPHP'] ) ? $new_theme_data['RequiresPHP'] : null;
|
||||
$requires_wp = isset( $new_theme_data['RequiresWP'] ) ? $new_theme_data['RequiresWP'] : null;
|
||||
|
||||
if ( ! is_php_version_compatible( $requires_php ) ) {
|
||||
$error = sprintf(
|
||||
@@ -663,7 +663,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error );
|
||||
}
|
||||
|
||||
$this->new_theme_data = $info;
|
||||
$this->new_theme_data = $new_theme_data;
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user