Changeset 10422
- Timestamp:
- 01/23/2009 10:26:40 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r10389 r10422 1921 1921 $num = (int) $num; 1922 1922 $post = (int) $post; 1923 1924 if ( 'moderated' == $status ) 1923 $count = wp_count_comments(); 1924 1925 if ( 'moderated' == $status ) { 1925 1926 $approved = "comment_approved = '0'"; 1926 elseif ( 'approved' == $status ) 1927 $total = $count->moderated; 1928 } elseif ( 'approved' == $status ) { 1927 1929 $approved = "comment_approved = '1'"; 1928 elseif ( 'spam' == $status ) 1930 $total = $count->approved; 1931 } elseif ( 'spam' == $status ) { 1929 1932 $approved = "comment_approved = 'spam'"; 1930 else 1933 $total = $count->spam; 1934 } else { 1931 1935 $approved = "( comment_approved = '0' OR comment_approved = '1' )"; 1936 $total = $count->moderated + $count->approved; 1937 } 1932 1938 1933 1939 if ( $post ) { 1940 $total = ''; 1934 1941 $post = " AND comment_post_ID = '$post'"; 1935 1942 $orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num"; … … 1950 1957 $typesql = ''; 1951 1958 1959 if ( !empty($type) ) 1960 $total = ''; 1961 1952 1962 if ( $s ) { 1963 $total = ''; 1953 1964 $s = $wpdb->escape($s); 1954 $ comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS *FROM $wpdb->comments WHERE1965 $query = "FROM $wpdb->comments WHERE 1955 1966 (comment_author LIKE '%$s%' OR 1956 1967 comment_author_email LIKE '%$s%' OR … … 1960 1971 $approved 1961 1972 $typesql 1962 $orderby" );1973 $orderby"; 1963 1974 } else { 1964 $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved $post $typesql $orderby" ); 1965 } 1975 $query = "FROM $wpdb->comments USE INDEX (comment_date_gmt) WHERE $approved $post $typesql $orderby"; 1976 } 1977 1978 $comments = $wpdb->get_results("SELECT * $query"); 1979 if ( '' === $total ) 1980 $total = $wpdb->get_var("SELECT COUNT(comment_ID) $query"); 1966 1981 1967 1982 update_comment_cache($comments); 1968 1969 $total = $wpdb->get_var( "SELECT FOUND_ROWS()" );1970 1983 1971 1984 return array($comments, $total);
Note: See TracChangeset
for help on using the changeset viewer.