Make WordPress Core

Changeset 1185


Ignore:
Timestamp:
04/26/2004 11:54:52 PM (21 years ago)
Author:
saxmatt
Message:

Reducing queries and forward thinking database fields.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upgrade-functions.php

    r1156 r1185  
    804804        delete_option($option);
    805805    endforeach;
    806 }
     806
     807    // Forward-thinking
     808    $wpdb->query("ALTER TABLE `$tableposts` CHANGE `post_status` `post_status` ENUM( 'publish', 'draft', 'private', 'static' ) DEFAULT 'publish' NOT NULL");
     809}
     810
     811    maybe_add_column($tableposts, 'post_parent', "ALTER TABLE `$tableposts` ADD `post_parent` INT NOT NULL ;");
    807812
    808813?>
  • trunk/wp-includes/template-functions-comment.php

    r1132 r1185  
    3131
    3232function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $number='') {
    33     global $id, $comment, $tablecomments, $wpdb;
    34     if ('' == $number) $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'");
     33    global $id, $comment, $tablecomments, $wpdb, $comment_count_cache;
     34    if ('' == $comment_count_cache["$id"]) $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'");
     35    else $number = $comment_count_cache["$id"];
    3536    if ($number == 0) {
    3637        $blah = $zero;
  • trunk/wp-includes/template-functions-general.php

    r1157 r1185  
    9393function wp_title($sep = '»', $display = true) {
    9494    global $wpdb, $tableposts, $tablecategories;
    95     global $year, $monthnum, $day, $cat, $p, $name, $month;
     95    global $year, $monthnum, $day, $cat, $p, $name, $month, $posts, $single;
    9696
    9797    // If there's a category
     
    123123
    124124    // If there's a post
    125     if (intval($p) || '' != $name) {
    126         if (!$p) {
    127         if ($year != '') {
    128             $year = '' . intval($year);
    129             $where .= ' AND YEAR(post_date)=' . $year;
    130         }
    131        
    132         if ($monthnum != '') {
    133             $monthnum = '' . intval($monthnum);
    134             $where .= ' AND MONTH(post_date)=' . $monthnum;
    135         }
    136        
    137         if ($day != '') {
    138             $day = '' . intval($day);
    139             $where .= ' AND DAYOFMONTH(post_date)=' . $day;
    140         }
    141             $p = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_name = '$name' $where");
    142         }
    143         $post_data = get_postdata($p);
    144         $title = strip_tags(stripslashes($post_data['Title']));
     125    if ($single) {
     126        $title = strip_tags(stripslashes($posts[0]->post_title));
    145127        $title = apply_filters('single_post_title', $title);
    146128    }
Note: See TracChangeset for help on using the changeset viewer.