Removed $querycount. Added $wpdb->querycount

git-svn-id: http://svn.automattic.com/wordpress/trunk@569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
mikelittle 2003-12-05 01:24:02 +00:00
parent 280324268f
commit ed973decee
11 changed files with 2 additions and 17 deletions

2
b2.php
View File

@ -48,7 +48,7 @@
<?php <?php
if ($debug=="1") { if ($debug=="1") {
echo "<p>$querycount queries - ".number_format(timer_stop(),3)." seconds</p>"; echo "<p>$wpdb->querycount queries - ".number_format(timer_stop(),3)." seconds</p>";
} }
?> ?>

View File

@ -15,7 +15,6 @@
$comment_author_url = (isset($HTTP_COOKIE_VARS['comment_author_url_'.$cookiehash])) ? trim($HTTP_COOKIE_VARS['comment_author_url_'.$cookiehash]) : ''; $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"); $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date");
++$querycount;
?> ?>
<!-- You can start editing here. --> <!-- You can start editing here. -->

View File

@ -39,7 +39,6 @@ $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$user_domain = gethostbyaddr($user_ip); $user_domain = gethostbyaddr($user_ip);
$commentstatus = $wpdb->get_var("SELECT comment_status FROM $tableposts WHERE ID = $comment_post_ID"); $commentstatus = $wpdb->get_var("SELECT comment_status FROM $tableposts WHERE ID = $comment_post_ID");
++$querycount;
if ('closed' == $commentstatus) if ('closed' == $commentstatus)
die('Sorry, comments are closed for this item.'); die('Sorry, comments are closed for this item.');
@ -68,7 +67,6 @@ $url = addslashes($url);
/* Flood-protection */ /* Flood-protection */
$lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1"); $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; $ok = true;
if (!empty($lasttime)) { if (!empty($lasttime)) {
$time_lastcomment= mysql2date('U', $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()'); $comment_ID = $wpdb->get_var('SELECT last_insert_id()');
++$querycount;
if (($moderation_notify) && (!$approved)) { if (($moderation_notify) && (!$approved)) {
wp_notify_moderator($comment_ID); wp_notify_moderator($comment_ID);

View File

@ -30,9 +30,7 @@ foreach ($posts as $post) { start_b2();
<?php <?php
// this line is WordPress' motor, do not delete it. // this line is WordPress' motor, do not delete it.
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date"); $comments = $wpdb->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"); $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 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()); echo(get_the_password_form());
} else { ?> } else { ?>

View File

@ -86,11 +86,9 @@ case 'login':
$pass_is_md5 = 1; $pass_is_md5 = 1;
$password = substr($password, 4, strlen($password)); $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'"; $query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND MD5(user_pass) = '$password'";
++$querycount;
} else { } else {
$pass_is_md5 = 0; $pass_is_md5 = 0;
$query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND user_pass = '$password'"; $query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND user_pass = '$password'";
++$querycount;
} }
$login = $wpdb->get_row($query); $login = $wpdb->get_row($query);

View File

@ -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"; $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); $result = $wpdb->get_row($sql);
++$querycount;
if (!$result) { if (!$result) {
echo '<p><b>Wrong login or password.</b></p></div>'; echo '<p><b>Wrong login or password.</b></p></div>';

View File

@ -80,7 +80,6 @@ case 'register':
/* checking the login isn't already used by another user */ /* checking the login isn't already used by another user */
$result = $wpdb->get_results("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'"); $result = $wpdb->get_results("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
++$querycount;
if (count($result) >= 1) { if (count($result) >= 1) {
die ('<strong>ERROR</strong>: This login is already registered, please choose another one.'); die ('<strong>ERROR</strong>: This login is already registered, please choose another one.');
} }

View File

@ -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.'); 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"); $pingstatus = $wpdb->get_var("SELECT ping_status FROM $tableposts WHERE ID = $tb_id");
++$querycount;
if ('closed' == $pingstatus) if ('closed' == $pingstatus)
trackback_response(1, 'Sorry, trackbacks are closed for this item.'); 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...<br />Please contact the <a href='mailto:$admin_email'>webmaster</a>."); die ("There is an error with the database, it can't store your comment...<br />Please contact the <a href='mailto:$admin_email'>webmaster</a>.");
} else { } else {
$comment_ID = $wpdb->get_var('SELECT last_insert_id()'); $comment_ID = $wpdb->get_var('SELECT last_insert_id()');
++$querycount;
if ($comments_notify) if ($comments_notify)
wp_notify_postauthor($comment_ID, 'trackback'); wp_notify_postauthor($comment_ID, 'trackback');
trackback_response(0); trackback_response(0);

View File

@ -307,7 +307,6 @@ if ($preview) {
// error_log("$request"); // error_log("$request");
// echo $request; // echo $request;
$posts = $wpdb->get_results($request); $posts = $wpdb->get_results($request);
++$querycount;
if (1 == count($posts)) { if (1 == count($posts)) {
if ($p || $name) { if ($p || $name) {
$more = 1; $more = 1;

View File

@ -114,6 +114,6 @@ require_once($abspath.'wp-links/links.php');
</div> </div>
<p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org"><strong>WordPress</strong></a></cite></p> <p class="credit"><?php echo $wpdb->querycount; ?> queries. <?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org"><strong>WordPress</strong></a></cite></p>
</body> </body>
</html> </html>

View File

@ -59,7 +59,6 @@ foreach ($posts as $post) { start_b2();
AND post_date < '".date("Y-m-d H:i:s")."' AND post_date < '".date("Y-m-d H:i:s")."'
ORDER BY comment_date ORDER BY comment_date
LIMIT $posts_per_rss"); LIMIT $posts_per_rss");
++$querycount;
} }
else { // if no post id passed in, we'll just ue the last 10 comments. else { // if no post id passed in, we'll just ue the last 10 comments.
$comments = $wpdb->get_results("SELECT comment_ID, $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")."' AND post_date < '".date("Y-m-d H:i:s")."'
ORDER BY comment_date DESC ORDER BY comment_date DESC
LIMIT $posts_per_rss"); LIMIT $posts_per_rss");
++$querycount;
} }
// this line is WordPress' motor, do not delete it. // this line is WordPress' motor, do not delete it.
if ($comments) { if ($comments) {