From f548f565484d79762647c1ed05abd5fbe236ef66 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 6 Feb 2025 12:24:24 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `media_upload_library_form()`. Includes bringing some consistency with a similar fragment in `WP_List_Table::months_dropdown()`. Follow-up to [3724], [7062], [15491], [59755]. Props aristath, poena, afercia, SergeyBiryukov. See #62279. Built from https://develop.svn.wordpress.org/trunk@59767 git-svn-id: http://core.svn.wordpress.org/trunk@59109 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-list-table.php | 4 +-- wp-admin/includes/media.php | 43 +++++++++++------------ wp-includes/version.php | 2 +- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 3a65e015d5..924cc7db30 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -780,9 +780,9 @@ class WP_List_Table { printf( "\n", selected( $selected_month, $year . $month, false ), - esc_attr( $arc_row->year . $month ), + esc_attr( $year . $month ), /* translators: 1: Month name, 2: 4-digit year. */ - sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year ) + esc_html( sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year ) ) ); } ?> diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 24dfef62f5..73a2585f84 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -2845,38 +2845,37 @@ function media_upload_library_form( $errors ) {
get_results( + "SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month + FROM $wpdb->posts + WHERE post_type = 'attachment' + ORDER BY post_date DESC" + ); - $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC"; + $month_count = count( $months ); + $selected_month = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0; - $arc_result = $wpdb->get_results( $arc_query ); - - $month_count = count( $arc_result ); - $selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0; - - if ( $month_count && ! ( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { + if ( $month_count && ( 1 !== $month_count || 0 !== (int) $months[0]->month ) ) { ?> diff --git a/wp-includes/version.php b/wp-includes/version.php index 6f132c009a..7dc3dab0fe 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59766'; +$wp_version = '6.8-alpha-59767'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.