WordPress.org

Make WordPress Core

Ticket #10397: 10397.patch

File 10397.patch, 1.1 KB (added by hakre, 6 years ago)

WEEK query patch, other queries still unpatched.

  • wp-includes/general-template.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    869869                } 
    870870        } elseif ( 'weekly' == $type ) { 
    871871                $start_of_week = get_option('start_of_week'); 
    872                 $query = "SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC $limit"; 
     872                $query = $wpdb->prepare("SELECT DISTINCT WEEK(post_date, %d) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%%Y-%%m-%%d') AS yyyymmdd, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC %d", $start_of_week, $limit); 
    873873                $key = md5($query); 
    874874                $cache = wp_cache_get( 'wp_get_archives' , 'general'); 
    875875                if ( !isset( $cache[ $key ] ) ) {