Skip to content

Commit 1935b18

Browse files
committed
Merge branch 'trunk' into fix/issue-64347
2 parents 28a1642 + 3d9fde3 commit 1935b18

File tree

84 files changed

+1294
-506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1294
-506
lines changed

src/js/_enqueues/lib/auth-check.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,23 @@
159159
setShowTimeout();
160160
});
161161
}).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
162-
if ( 'wp-auth-check' in data ) {
162+
if ( ! ( 'wp-auth-check' in data ) ) {
163+
return;
164+
}
165+
166+
var showOrHide = function () {
163167
if ( ! data['wp-auth-check'] && wrap.hasClass( 'hidden' ) && ! tempHidden ) {
164168
show();
165169
} else if ( data['wp-auth-check'] && ! wrap.hasClass( 'hidden' ) ) {
166170
hide();
167171
}
172+
};
173+
174+
// This is necessary due to a race condition where the heartbeat-tick event may fire before DOMContentLoaded.
175+
if ( wrap ) {
176+
showOrHide();
177+
} else {
178+
$( showOrHide );
168179
}
169180
});
170181

src/wp-admin/customize.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@
147147
$body_class .= ' rtl';
148148
}
149149
$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
150+
$admin_color = get_user_option( 'admin_color' );
151+
$body_class .= ' admin-color-' . sanitize_html_class( is_string( $admin_color ) ? $admin_color : '', 'fresh' );
150152

151153
if ( wp_use_widgets_block_editor() ) {
152154
$body_class .= ' wp-embed-responsive';

src/wp-admin/includes/class-wp-debug-data.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,11 @@ private static function get_wp_constants(): array {
15921592
'value' => $db_collate,
15931593
'debug' => $db_collate_debug,
15941594
),
1595+
'EMPTY_TRASH_DAYS' => array(
1596+
'label' => 'EMPTY_TRASH_DAYS',
1597+
'value' => EMPTY_TRASH_DAYS ? EMPTY_TRASH_DAYS : __( 'Empty value' ),
1598+
'debug' => EMPTY_TRASH_DAYS,
1599+
),
15951600
);
15961601

15971602
return array(

src/wp-admin/includes/class-wp-filesystem-direct.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,18 @@ public function owner( $file ) {
249249
/**
250250
* Gets the permissions of the specified file or filepath in their octal format.
251251
*
252-
* FIXME does not handle errors in fileperms()
253-
*
254252
* @since 2.5.0
255253
*
256254
* @param string $file Path to the file.
257-
* @return string Mode of the file (the last 3 digits).
255+
* @return string Mode of the file (the last 3 digits), or the string "0" on failure.
258256
*/
259257
public function getchmod( $file ) {
260-
return substr( decoct( @fileperms( $file ) ), -3 );
258+
$perms = @fileperms( $file );
259+
if ( false === $perms ) {
260+
return '0';
261+
}
262+
263+
return substr( decoct( $perms ), -3 );
261264
}
262265

263266
/**

src/wp-admin/includes/class-wp-ms-sites-list-table.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ protected function site_states( $site ) {
674674

675675
if ( ! empty( $site_states ) ) {
676676
$state_count = count( $site_states );
677+
$separator = wp_get_list_item_separator();
677678

678679
$i = 0;
679680

@@ -682,9 +683,9 @@ protected function site_states( $site ) {
682683
foreach ( $site_states as $state ) {
683684
++$i;
684685

685-
$separator = ( $i < $state_count ) ? ', ' : '';
686+
$suffix = ( $i < $state_count ) ? $separator : '';
686687

687-
echo "<span class='post-state'>{$state}{$separator}</span>";
688+
echo "<span class='post-state'>{$state}{$suffix}</span>";
688689
}
689690
}
690691
}

src/wp-admin/includes/class-wp-site-health.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3412,6 +3412,16 @@ public function get_page_cache_headers() {
34123412
},
34133413
'x-srcache-store-status' => $cache_hit_callback,
34143414
'x-srcache-fetch-status' => $cache_hit_callback,
3415+
3416+
// Generic caching proxies (Nginx, Varnish, etc.)
3417+
'x-cache' => $cache_hit_callback,
3418+
'x-cache-status' => $cache_hit_callback,
3419+
'x-litespeed-cache' => $cache_hit_callback,
3420+
'x-proxy-cache' => $cache_hit_callback,
3421+
'via' => '',
3422+
3423+
// Cloudflare
3424+
'cf-cache-status' => $cache_hit_callback,
34153425
);
34163426

34173427
/**

src/wp-admin/includes/class-wp-upgrader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ public function install_package( $args = array() ) {
590590
* Filters the source file location for the upgrade package.
591591
*
592592
* @since 2.8.0
593-
* @since 4.4.0 The $hook_extra parameter became available.
593+
* @since 4.4.0 The `$hook_extra` parameter became available.
594594
*
595595
* @param string $source File source location.
596596
* @param string $remote_source Remote file source location.

src/wp-admin/includes/export.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,12 @@ function wxr_filter_postmeta( $return_me, $meta_key ) {
687687
endforeach;
688688

689689
$_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
690-
$comments = array_map( 'get_comment', $_comments );
690+
$comments = array_filter(
691+
array_map( 'get_comment', $_comments ),
692+
static function ( $comment ) {
693+
return $comment instanceof WP_Comment;
694+
}
695+
);
691696
foreach ( $comments as $c ) :
692697
?>
693698
<wp:comment>

src/wp-admin/includes/file.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,14 +1896,14 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
18961896
$uncompressed_size = 0;
18971897

18981898
// Determine any children directories needed (From within the archive).
1899-
foreach ( $archive_files as $file ) {
1900-
if ( str_starts_with( $file['filename'], '__MACOSX/' ) ) { // Skip the OS X-created __MACOSX directory.
1899+
foreach ( $archive_files as $archive_file ) {
1900+
if ( str_starts_with( $archive_file['filename'], '__MACOSX/' ) ) { // Skip the OS X-created __MACOSX directory.
19011901
continue;
19021902
}
19031903

1904-
$uncompressed_size += $file['size'];
1904+
$uncompressed_size += $archive_file['size'];
19051905

1906-
$needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname( $file['filename'] ) );
1906+
$needed_dirs[] = $to . untrailingslashit( $archive_file['folder'] ? $archive_file['filename'] : dirname( $archive_file['filename'] ) );
19071907
}
19081908

19091909
// Enough space to unzip the file and copy its contents, with a 10% buffer.
@@ -1967,22 +1967,22 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
19671967
}
19681968

19691969
// Extract the files from the zip.
1970-
foreach ( $archive_files as $file ) {
1971-
if ( $file['folder'] ) {
1970+
foreach ( $archive_files as $archive_file ) {
1971+
if ( $archive_file['folder'] ) {
19721972
continue;
19731973
}
19741974

1975-
if ( str_starts_with( $file['filename'], '__MACOSX/' ) ) { // Don't extract the OS X-created __MACOSX directory files.
1975+
if ( str_starts_with( $archive_file['filename'], '__MACOSX/' ) ) { // Don't extract the OS X-created __MACOSX directory files.
19761976
continue;
19771977
}
19781978

19791979
// Don't extract invalid files:
1980-
if ( 0 !== validate_file( $file['filename'] ) ) {
1980+
if ( 0 !== validate_file( $archive_file['filename'] ) ) {
19811981
continue;
19821982
}
19831983

1984-
if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE ) ) {
1985-
return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
1984+
if ( ! $wp_filesystem->put_contents( $to . $archive_file['filename'], $archive_file['content'], FS_CHMOD_FILE ) ) {
1985+
return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $archive_file['filename'] );
19861986
}
19871987
}
19881988

src/wp-admin/includes/media.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3769,8 +3769,8 @@ function wp_read_audio_metadata( $file ) {
37693769
* @link https://github.com/JamesHeinrich/getID3/blob/master/structure.txt
37703770
*
37713771
* @param array $metadata The metadata returned by getID3::analyze().
3772-
* @return int|false A UNIX timestamp for the media's creation date if available
3773-
* or a boolean FALSE if a timestamp could not be determined.
3772+
* @return int|false A Unix timestamp for the media's creation date if available
3773+
* or a boolean false if the timestamp could not be determined.
37743774
*/
37753775
function wp_get_media_creation_timestamp( $metadata ) {
37763776
$creation_date = false;

0 commit comments

Comments
 (0)