diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index 5a93690eb0..2cfc3f4075 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -803,6 +803,11 @@ function upgrade_110() { foreach ($unusedoptions as $option) : delete_option($option); endforeach; + + // Forward-thinking + $wpdb->query("ALTER TABLE `$tableposts` CHANGE `post_status` `post_status` ENUM( 'publish', 'draft', 'private', 'static' ) DEFAULT 'publish' NOT NULL"); } + maybe_add_column($tableposts, 'post_parent', "ALTER TABLE `$tableposts` ADD `post_parent` INT NOT NULL ;"); + ?> \ No newline at end of file diff --git a/wp-includes/template-functions-comment.php b/wp-includes/template-functions-comment.php index 10a86a70db..49b8b6a544 100644 --- a/wp-includes/template-functions-comment.php +++ b/wp-includes/template-functions-comment.php @@ -30,8 +30,9 @@ function clean_url($url) { } function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $number='') { - global $id, $comment, $tablecomments, $wpdb; - if ('' == $number) $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'"); + global $id, $comment, $tablecomments, $wpdb, $comment_count_cache; + if ('' == $comment_count_cache["$id"]) $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'"); + else $number = $comment_count_cache["$id"]; if ($number == 0) { $blah = $zero; } elseif ($number == 1) { diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index a6abc1214c..03c47374e1 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -92,7 +92,7 @@ function get_bloginfo($show='') { function wp_title($sep = '»', $display = true) { global $wpdb, $tableposts, $tablecategories; - global $year, $monthnum, $day, $cat, $p, $name, $month; + global $year, $monthnum, $day, $cat, $p, $name, $month, $posts, $single; // If there's a category if(!empty($cat)) { @@ -122,26 +122,8 @@ function wp_title($sep = '»', $display = true) { } // If there's a post - if (intval($p) || '' != $name) { - if (!$p) { - if ($year != '') { - $year = '' . intval($year); - $where .= ' AND YEAR(post_date)=' . $year; - } - - if ($monthnum != '') { - $monthnum = '' . intval($monthnum); - $where .= ' AND MONTH(post_date)=' . $monthnum; - } - - if ($day != '') { - $day = '' . intval($day); - $where .= ' AND DAYOFMONTH(post_date)=' . $day; - } - $p = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_name = '$name' $where"); - } - $post_data = get_postdata($p); - $title = strip_tags(stripslashes($post_data['Title'])); + if ($single) { + $title = strip_tags(stripslashes($posts[0]->post_title)); $title = apply_filters('single_post_title', $title); }