Make WordPress Core


Ignore:
Timestamp:
12/05/2003 01:27:00 AM (23 years ago)
Author:
mikelittle
Message:

Removed $querycount.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/b2-include/b2functions.php

    r559 r570  
    374374
    375375function get_lastpostdate() {
    376         global $tableposts, $cache_lastpostdate, $use_cache, $time_difference, $pagenow, $wpdb, $querycount;
     376        global $tableposts, $cache_lastpostdate, $use_cache, $time_difference, $pagenow, $wpdb;
    377377        if ((!isset($cache_lastpostdate)) OR (!$use_cache)) {
    378378                $now = date("Y-m-d H:i:s",(time() + ($time_difference * 3600)));
    … …  
    383383                }
    384384                $lastpostdate = $wpdb->get_var("SELECT post_date FROM $tableposts WHERE $showcatzero post_date <= '$now' ORDER BY post_date DESC LIMIT 1");
    385                 ++$querycount;
    386385                $cache_lastpostdate = $lastpostdate;
    387386//              echo $lastpostdate;
    … …  
    416415
    417416function get_userdata($userid) {
    418         global $wpdb, $querycount, $cache_userdata, $use_cache, $tableusers;
     417        global $wpdb, $cache_userdata, $use_cache, $tableusers;
    419418        if ((empty($cache_userdata[$userid])) || (!$use_cache)) {
    420419                $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID = $userid");
    … …  
    424423        $user->user_firstname =  stripslashes($user->user_firstname);
    425424        $user->user_lastname = stripslashes($user->user_lastname);
    426         ++$querycount;
    427425                $cache_userdata[$userid] = $user;
    428426        } else {
    … …  
    446444
    447445function get_userdatabylogin($user_login) {
    448         global $tableusers, $querycount, $cache_userdata, $use_cache, $wpdb;
     446        global $tableusers, $cache_userdata, $use_cache, $wpdb;
    449447        if ((empty($cache_userdata["$user_login"])) OR (!$use_cache)) {
    450448                $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE user_login = '$user_login'");
    451                 ++$querycount;
    452449                $cache_userdata["$user_login"] = $user;
    453450        } else {
    … …  
    458455
    459456function get_userid($user_login) {
    460         global $tableusers, $querycount, $cache_userdata, $use_cache, $wpdb;
     457        global $tableusers, $cache_userdata, $use_cache, $wpdb;
    461458        if ((empty($cache_userdata["$user_login"])) OR (!$use_cache)) {
    462459                $user_id = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$user_login'");
    463460
    464                 ++$querycount;
    465461                $cache_userdata["$user_login"] = $user_id;
    466462        } else {
    … …  
    471467
    472468function get_usernumposts($userid) {
    473         global $tableposts, $tablecomments, $querycount, $wpdb;
    474         ++$querycount;
     469        global $tableposts, $tablecomments, $wpdb;
    475470        return $wpdb->get_var("SELECT COUNT(*) FROM $tableposts WHERE post_author = $userid");
    476471}
    … …  
    479474// determine the post ID it represents.
    480475function url_to_postid($url = '') {
    481         global $wpdb, $querycount, $tableposts, $siteurl;
     476        global $wpdb, $tableposts, $siteurl;
    482477
    483478        // Take a link like 'http://example.com/blog/something'
    … …  
    537532
    538533        // Run the query to get the post ID:
    539     ++$querycount;
    540534    return intval($wpdb->get_var("SELECT ID FROM $tableposts WHERE 1 = 1 " . $where));
    541535}
    … …  
    545539
    546540function get_settings($setting) {
    547         global $wpdb, $cache_settings, $use_cache, $querycount;
     541        global $wpdb, $cache_settings, $use_cache;
    548542        if ((empty($cache_settings)) OR (!$use_cache)) {
    549543                $settings = get_alloptions();
    … …  
    559553
    560554function get_alloptions() {
    561     global $tableoptions, $wpdb, $querycount;
     555    global $tableoptions, $wpdb;
    562556    $options = $wpdb->get_results("SELECT option_name, option_value FROM $tableoptions");
    563     ++$querycount;
    564557    if ($options) {
    565558        foreach ($options as $option) {
    … …  
    583576
    584577function get_postdata($postid) {
    585         global $tableusers, $tablecategories, $tableposts, $tablecomments, $querycount, $wpdb;
     578        global $tableusers, $tablecategories, $tableposts, $tablecomments, $wpdb;
    586579        $post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = $postid");
    587         ++$querycount;
    588580       
    589581        $postdata = array (
    … …  
    626618
    627619function get_commentdata($comment_ID,$no_cache=0,$include_unapproved=false) { // less flexible, but saves DB queries
    628         global $postc,$id,$commentdata,$tablecomments,$querycount, $wpdb;
     620        global $postc,$id,$commentdata,$tablecomments, $wpdb;
    629621        if ($no_cache) {
    630622                $query = "SELECT * FROM $tablecomments WHERE comment_ID = $comment_ID";
    … …  
    633625                }
    634626                $myrow = $wpdb->get_row($query, ARRAY_A);
    635                 ++$querycount;
    636627        } else {
    637628                $myrow['comment_ID']=$postc->comment_ID;
    … …  
    656647
    657648function get_catname($cat_ID) {
    658         global $tablecategories,$cache_catnames,$use_cache,$querycount, $wpdb;
     649        global $tablecategories,$cache_catnames,$use_cache, $wpdb;
    659650        if ((!$cache_catnames) || (!$use_cache)) {
    660651        $results = $wpdb->get_results("SELECT * FROM $tablecategories") or die('Oops, couldn\'t query the db for categories.');
    661                 $querycount++;
    662652                foreach ($results as $post) {
    663653                        $cache_catnames[$post->cat_ID] = $post->cat_name;
    … …  
    674664
    675665function dropdown_categories($blog_ID=1, $default=1) {
    676         global $postdata,$tablecategories,$mode,$querycount, $wpdb;
     666        global $postdata,$tablecategories,$mode, $wpdb;
    677667        $query="SELECT * FROM $tablecategories ORDER BY cat_name";
    678668        $results = $wpdb->get_results($query);
    679         ++$querycount;
    680669        $width = ($mode=="sidebar") ? "100%" : "170px";
    681670        echo '<select name="post_category" style="width:'.$width.';" tabindex="2" id="category">';
    … …  
    683672        $default = $postdata["Category"];
    684673    }
    685         ++$querycount;
    686674        foreach($results as $post) {
    687675                echo "<option value=\"".$post->cat_ID."\"";
    … …  
    14421430 */
    14431431function wp_get_comment_status($comment_id) {
    1444     global $wpdb, $querycount, $tablecomments;
     1432    global $wpdb, $tablecomments;
    14451433   
    14461434    $result = $wpdb->get_var("SELECT comment_approved FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
    1447     ++$querycount;
    14481435    if ($result == NULL) {
    14491436        return "deleted";
    … …  
    14581445
    14591446function wp_notify_postauthor($comment_id, $comment_type) {
    1460     global $wpdb, $querycount, $tablecomments, $tableposts, $tableusers;
     1447    global $wpdb, $tablecomments, $tableposts, $tableusers;
    14611448    global $querystring_start, $querystring_equal, $querystring_separator;
    14621449    global $blogfilename, $blogname, $siteurl;
    14631450   
    14641451    $comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
    1465     ++$querycount;
    14661452    $post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");
    1467     ++$querycount;
    14681453    $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID='$post->post_author' LIMIT 1");
    1469     ++$querycount;
    14701454
    14711455    if ('' == $user->user_email) return false; // If there's no email to send the comment to
    … …  
    15181502 */
    15191503function wp_notify_moderator($comment_id) {
    1520     global $wpdb, $querycount, $tablecomments, $tableposts, $tableusers;
     1504    global $wpdb, $tablecomments, $tableposts, $tableusers;
    15211505    global $querystring_start, $querystring_equal, $querystring_separator;
    15221506    global $blogfilename, $blogname, $siteurl;
    15231507   
    15241508    $comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
    1525     ++$querycount;
    15261509    $post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");
    1527     ++$querycount;
    15281510    $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID='$post->post_author' LIMIT 1");
    1529     ++$querycount;
    15301511
    15311512    $comment_author_domain = gethostbyaddr($comment->comment_author_IP);
    15321513    $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $tablecomments WHERE comment_approved = '0'");
    1533     ++$querycount;
    15341514
    15351515    $notify_message  = "A new comment on the post #$comment->comment_post_ID \"".stripslashes($post->post_title)."\" is waiting for your approval\r\n\r\n";
Note: See TracChangeset for help on using the changeset viewer.