From f2aa5da5b06160417acde1a731938c8b39937257 Mon Sep 17 00:00:00 2001 From: Mike Little Date: Fri, 5 Dec 2003 01:24:02 +0000 Subject: [PATCH] Removed $querycount. Added $wpdb->querycount git-svn-id: https://develop.svn.wordpress.org/trunk@569 602fd350-edb4-49c9-b593-d223f7449a82 --- b2.php | 2 +- b2comments.php | 1 - b2comments.post.php | 3 --- b2commentspopup.php | 2 -- b2login.php | 2 -- b2mail.php | 1 - b2register.php | 1 - b2trackback.php | 2 -- blog.header.php | 1 - index.php | 2 +- wp-commentsrss2.php | 2 -- 11 files changed, 2 insertions(+), 17 deletions(-) diff --git a/b2.php b/b2.php index f0b8de0a88..fb14e28ac8 100644 --- a/b2.php +++ b/b2.php @@ -48,7 +48,7 @@ $querycount queries - ".number_format(timer_stop(),3)." seconds

"; + echo "

$wpdb->querycount queries - ".number_format(timer_stop(),3)." seconds

"; } ?> diff --git a/b2comments.php b/b2comments.php index 33ea662c77..e4e7a70a90 100644 --- a/b2comments.php +++ b/b2comments.php @@ -15,7 +15,6 @@ $comment_author_url = (isset($HTTP_COOKIE_VARS['comment_author_url_'.$cookiehash])) ? trim($HTTP_COOKIE_VARS['comment_author_url_'.$cookiehash]) : ''; $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date"); - ++$querycount; ?> diff --git a/b2comments.post.php b/b2comments.post.php index 9eef3413e7..bc38ebb4ee 100644 --- a/b2comments.post.php +++ b/b2comments.post.php @@ -39,7 +39,6 @@ $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR']; $user_domain = gethostbyaddr($user_ip); $commentstatus = $wpdb->get_var("SELECT comment_status FROM $tableposts WHERE ID = $comment_post_ID"); -++$querycount; if ('closed' == $commentstatus) die('Sorry, comments are closed for this item.'); @@ -68,7 +67,6 @@ $url = addslashes($url); /* Flood-protection */ $lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1"); -++$querycount; $ok = true; if (!empty($lasttime)) { $time_lastcomment= mysql2date('U', $lasttime); @@ -101,7 +99,6 @@ if ($ok) { // if there was no comment from this IP in the last 10 seconds "); $comment_ID = $wpdb->get_var('SELECT last_insert_id()'); - ++$querycount; if (($moderation_notify) && (!$approved)) { wp_notify_moderator($comment_ID); diff --git a/b2commentspopup.php b/b2commentspopup.php index 11f7cf12d7..a4bcddb184 100644 --- a/b2commentspopup.php +++ b/b2commentspopup.php @@ -30,9 +30,7 @@ foreach ($posts as $post) { start_b2(); get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date"); -++$querycount; $commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id"); -++$querycount; if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $commentstatus->post_password) { // and it doesn't match the cookie echo(get_the_password_form()); } else { ?> diff --git a/b2login.php b/b2login.php index 2cb1931d91..2c6082968d 100644 --- a/b2login.php +++ b/b2login.php @@ -86,11 +86,9 @@ case 'login': $pass_is_md5 = 1; $password = substr($password, 4, strlen($password)); $query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND MD5(user_pass) = '$password'"; - ++$querycount; } else { $pass_is_md5 = 0; $query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND user_pass = '$password'"; - ++$querycount; } $login = $wpdb->get_row($query); diff --git a/b2mail.php b/b2mail.php index 3a850660a8..e9080de1eb 100644 --- a/b2mail.php +++ b/b2mail.php @@ -204,7 +204,6 @@ for ($iCount=1; $iCount<=$Count; $iCount++) { $sql = "SELECT ID, user_level FROM $tableusers WHERE user_login='$user_login' AND user_pass='$user_pass' ORDER BY ID DESC LIMIT 1"; $result = $wpdb->get_row($sql); - ++$querycount; if (!$result) { echo '

Wrong login or password.

'; diff --git a/b2register.php b/b2register.php index fcd09fc8fe..0d5cf1fc0c 100644 --- a/b2register.php +++ b/b2register.php @@ -80,7 +80,6 @@ case 'register': /* checking the login isn't already used by another user */ $result = $wpdb->get_results("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'"); - ++$querycount; if (count($result) >= 1) { die ('ERROR: This login is already registered, please choose another one.'); } diff --git a/b2trackback.php b/b2trackback.php index db03f79179..18b8829198 100644 --- a/b2trackback.php +++ b/b2trackback.php @@ -31,7 +31,6 @@ if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$tb_u trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.'); $pingstatus = $wpdb->get_var("SELECT ping_status FROM $tableposts WHERE ID = $tb_id"); - ++$querycount; if ('closed' == $pingstatus) trackback_response(1, 'Sorry, trackbacks are closed for this item.'); @@ -87,7 +86,6 @@ if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$tb_u die ("There is an error with the database, it can't store your comment...
Please contact the webmaster."); } else { $comment_ID = $wpdb->get_var('SELECT last_insert_id()'); - ++$querycount; if ($comments_notify) wp_notify_postauthor($comment_ID, 'trackback'); trackback_response(0); diff --git a/blog.header.php b/blog.header.php index 7e2766d305..213a3db4ad 100644 --- a/blog.header.php +++ b/blog.header.php @@ -307,7 +307,6 @@ if ($preview) { // error_log("$request"); // echo $request; $posts = $wpdb->get_results($request); -++$querycount; if (1 == count($posts)) { if ($p || $name) { $more = 1; diff --git a/index.php b/index.php index 32498d54d5..8d40026b78 100644 --- a/index.php +++ b/index.php @@ -114,6 +114,6 @@ require_once($abspath.'wp-links/links.php'); -

Powered by WordPress

+

querycount; ?> queries. Powered by WordPress

diff --git a/wp-commentsrss2.php b/wp-commentsrss2.php index 381f2c5cd8..c7cfc06e4c 100644 --- a/wp-commentsrss2.php +++ b/wp-commentsrss2.php @@ -59,7 +59,6 @@ foreach ($posts as $post) { start_b2(); AND post_date < '".date("Y-m-d H:i:s")."' ORDER BY comment_date LIMIT $posts_per_rss"); - ++$querycount; } else { // if no post id passed in, we'll just ue the last 10 comments. $comments = $wpdb->get_results("SELECT comment_ID, @@ -79,7 +78,6 @@ foreach ($posts as $post) { start_b2(); AND post_date < '".date("Y-m-d H:i:s")."' ORDER BY comment_date DESC LIMIT $posts_per_rss"); - ++$querycount; } // this line is WordPress' motor, do not delete it. if ($comments) {