Ticket #9642: 9642-posts.diff
| File 9642-posts.diff, 6.8 KB (added by Denis-de-Bernardy, 4 years ago) |
|---|
-
wp-includes/post.php
1276 1276 $limit = "LIMIT $num"; 1277 1277 } 1278 1278 1279 $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit";1279 $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date_gmt DESC $limit"; 1280 1280 $result = $wpdb->get_results($sql,ARRAY_A); 1281 1281 1282 1282 return $result ? $result : array(); -
wp-includes/version.php
15 15 * 16 16 * @global int $wp_db_version 17 17 */ 18 $wp_db_version = 108 50;18 $wp_db_version = 10880; 19 19 20 20 ?> -
wp-includes/query.php
2022 2022 2023 2023 // Order by 2024 2024 if ( empty($q['orderby']) ) { 2025 $q['orderby'] = "$wpdb->posts.post_date ".$q['order'];2025 $q['orderby'] = "$wpdb->posts.post_date_gmt ".$q['order']; 2026 2026 } else { 2027 2027 // Used to filter values 2028 2028 $allowed_keys = array('author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand'); -
wp-includes/wp-db.php
714 714 715 715 // Return number of rows selected 716 716 $return_val = $this->num_rows; 717 718 // log explain 719 if ( defined('QUERIES_DEBUG') && defined('SAVEQUERIES') && QUERIES_DEBUG && SAVEQUERIES && 'SELECT FOUND_ROWS()' != $query ) { 720 $explain = @mysql_query("EXPLAIN $query", $this->dbh); 721 $this->queries[] = @mysql_fetch_object($explain); 722 } 717 723 } 718 724 719 725 return $return_val; -
wp-includes/general-template.php
776 776 $output = ''; 777 777 778 778 if ( 'monthly' == $type ) { 779 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_dateDESC $limit";779 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY YEAR(post_date) DESC, MONTH(post_date) DESC $limit"; 780 780 $key = md5($query); 781 781 $cache = wp_cache_get( 'wp_get_archives' , 'general'); 782 782 if ( !isset( $cache[ $key ] ) ) { -
wp-admin/admin-ajax.php
1182 1182 if ( count($search_terms) > 1 && $search_terms[0] != $s ) 1183 1183 $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; 1184 1184 1185 $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND $search ORDER BY post_date _gmtDESC LIMIT 50" );1185 $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND $search ORDER BY post_date DESC LIMIT 50" ); 1186 1186 1187 1187 if ( ! $posts ) 1188 1188 exit( __('No posts found.') ); -
wp-admin/includes/upgrade.php
654 654 655 655 if ( $wp_current_db_version < 3506 ) { 656 656 // Update status and type. 657 $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts"); 658 659 if ( ! empty($posts) ) foreach ($posts as $post) { 660 $status = $post->post_status; 661 $type = 'post'; 662 663 if ( 'static' == $status ) { 664 $status = 'publish'; 665 $type = 'page'; 666 } else if ( 'attachment' == $status ) { 667 $status = 'inherit'; 668 $type = 'attachment'; 669 } 670 671 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID) ); 672 } 657 $wpdb->query(" 658 UPDATE $wpdb->posts 659 SET post_type = CASE 660 WHEN post_status = 'page' 661 THEN 'page' 662 WHEN post_status = 'attachment' 663 THEN 'attachment' 664 ELSE 'post' 665 END, 666 post_status = CASE 667 WHEN post_status = 'page' 668 THEN 'publish' 669 WHEN post_status = 'attachment' 670 THEN 'inherit' 671 ELSE post_status 672 END; 673 "); 673 674 } 674 675 675 676 if ( $wp_current_db_version < 3845 ) { -
wp-admin/includes/schema.php
136 136 post_mime_type varchar(100) NOT NULL default '', 137 137 comment_count bigint(20) NOT NULL default '0', 138 138 PRIMARY KEY (ID), 139 KEY post_author (post_author), 139 140 KEY post_name (post_name), 140 KEY type_status_date (post_type,post_status,post_date,ID), 141 KEY post_parent (post_parent) 141 KEY type_date (post_type, post_date), 142 KEY type_parent (post_type, post_parent), 143 KEY type_date_gmt (post_type, post_date_gmt), 144 KEY type_modified_gmt (post_type, post_modified_gmt) 142 145 ) $charset_collate; 143 146 CREATE TABLE $wpdb->users ( 144 147 ID bigint(20) unsigned NOT NULL auto_increment, -
wp-admin/includes/user.php
324 324 $other_unpubs = ''; 325 325 } else { 326 326 $editable = join(',', $editable); 327 $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );327 $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified_gmt $dir", $user_id) ); 328 328 } 329 329 330 330 return apply_filters('get_others_drafts', $other_unpubs); … … 389 389 */ 390 390 function get_users_drafts( $user_id ) { 391 391 global $wpdb; 392 $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);392 $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified_gmt DESC", $user_id); 393 393 $query = apply_filters('get_users_drafts', $query); 394 394 return $wpdb->get_results( $query ); 395 395 }
