Missing querycount

git-svn-id: https://develop.svn.wordpress.org/trunk@558 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mike Little
2003-11-25 00:46:52 +00:00
parent 6c8852bc51
commit 4efb6bb23a
27 changed files with 95 additions and 31 deletions

View File

@@ -103,6 +103,7 @@ default:
</tr>
<?php
$users = $wpdb->get_results("SELECT ID FROM $tableusers WHERE user_level>0 ORDER BY ID");
++$querycount;
foreach ($users as $user) {
$user_data = get_userdata($user->ID);
echo "<tr>\n<!--".$user_data->user_login."-->\n";
@@ -138,6 +139,7 @@ default:
<?php
$users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID");
++$querycount;
if ($users) {
?>
<div class="wrap">

View File

@@ -5,7 +5,7 @@ require_once('../wp-config.php');
/* checking login & pass in the database */
function veriflog() {
global $HTTP_COOKIE_VARS,$cookiehash;
global $tableusers, $wpdb;
global $tableusers, $wpdb, $querycount;
if (!empty($HTTP_COOKIE_VARS["wordpressuser_".$cookiehash])) {
$user_login = $HTTP_COOKIE_VARS["wordpressuser_".$cookiehash];
@@ -20,6 +20,7 @@ function veriflog() {
return false;
$login = $wpdb->get_row("SELECT user_login, user_pass FROM $tableusers WHERE user_login = '$user_login'");
++$querycount;
if (!$login) {
return false;
@@ -46,4 +47,4 @@ function veriflog() {
exit();
}
//}
?>
?>

View File

@@ -136,6 +136,7 @@ echo $comments_nav_bar;
ORDER BY comment_date $commentorder
LIMIT $commentstart, $commentend"
);
++$querycount;
// need to account for offet, etc.

View File

@@ -268,6 +268,7 @@ foreach ($posts as $post) { start_b2();
if (($withcomments) or ($c)) {
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
++$querycount;
if ($comments) {
?>

View File

@@ -139,6 +139,7 @@ if (!$got_links) {
echo "<p>... may need to update it though. Looking for column link_updated...</p>\n";
$query = "SELECT link_updated FROM $tablelinks LIMIT 1";
$q = @mysql_query($query);
++$querycount;
if ($q != false) {
if ($row = mysql_fetch_object($q)) {
echo "<p>You have column link_updated. Good!</p>\n";
@@ -150,6 +151,7 @@ if (!$got_links) {
}
echo "<p>Looking for column link_rel...</p>\n";
$query = "SELECT link_rel FROM $tablelinks LIMIT 1";
++$querycount;
$q = @mysql_query($query);
if ($q != false) {
if ($row = mysql_fetch_object($q)) {
@@ -166,6 +168,7 @@ if (!$got_links) {
if ($got_links && $got_cats) {
echo "<p>Looking for category 1...</p>\n";
$sql = "SELECT * FROM $tablelinkcategories WHERE cat_id=1 ";
++$querycount;
$result = mysql_query($sql) or print ("Can't query '$tablelinkcategories'.<br />" . $sql . "<br />" . mysql_error());
if ($result != false) {
if ($row = mysql_fetch_object($result)) {

View File

@@ -69,6 +69,7 @@ case "step1":
$post_author = trim(addslashes($postinfo[1]));
// we'll check the author is registered already
$user = $wpdb->get_row("SELECT * FROM $tableusers WHERE user_login = '$post_author'");
++$querycount;
if (!$user) { // seems s/he's not, so let's register
$user_ip = '127.0.0.1';
$user_domain = 'localhost';
@@ -111,6 +112,7 @@ case "step1":
}
$post_author_ID = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$post_author'");
++$querycount;
$post_date = explode(' ', $post_date);
$post_date_Ymd = explode('/', $post_date[0]);
@@ -134,6 +136,7 @@ case "step1":
// Quick-n-dirty check for dups:
$dupcheck = $wpdb->get_results("SELECT ID,post_date,post_title FROM $tableposts WHERE post_date='$post_date' AND post_title='$post_title' LIMIT 1",ARRAY_A);
++$querycount;
if ($dupcheck[0]['ID']) {
print "<br />\nSkipping duplicate post, ID = '" . $dupcheck[0]['ID'] . "'<br />\n";
print "Timestamp: " . $post_date . "<br />\n";

View File

@@ -139,6 +139,7 @@ textarea,input,select {
// we'll check the author is registered, or if it's a deleted author
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
$result = mysql_query($sql);
++$querycount;
if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2
$user_ip="127.0.0.1";
$user_domain="localhost";
@@ -159,6 +160,7 @@ textarea,input,select {
}
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
++$querycount;
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$post_author_ID=$myrow[0];
@@ -195,6 +197,7 @@ textarea,input,select {
die ("Error in posting... contact the <a href=\"mailto:$admin_email\">webmaster</a>");
$sql2 = "SELECT * FROM $tableposts WHERE 1=1 ORDER BY ID DESC LIMIT 1";
++$querycount;
$result2 = mysql_query($sql2);
$myrow2 = mysql_fetch_array($result2);
$post_ID=$myrow2[0];

View File

@@ -80,9 +80,12 @@ $database = @mysql_select_db($tp_database_name);
// For now we're going to give everything the same author and same category
$author = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_level = 10 LIMIT 1");
++$querycount;
$category = $wpdb->get_var("SELECT cat_ID FROM $tablecategories LIMIT 1");
++$querycount;
$posts = mysql_query('SELECT * FROM textpattern', $connection);
++$querycount;
while ($post = mysql_fetch_array($posts)) {
// ID, AuthorID, LastMod, LastModID, Posted, Title, Body, Body_html, Abstract, Category1, Category2, Annotate, AnnotateInvite, Status, Listing1, Listing2, Section
@@ -108,10 +111,12 @@ while ($post = mysql_fetch_array($posts)) {
// Get wordpress post id
$wp_post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
++$querycount;
// Now let's insert comments if there are any for the TP post
$tp_id = $post['ID'];
$comments = mysql_query("SELECT * FROM txp_Discuss WHERE parentid = $tp_id");
++$querycount;
if ($comments) {
while($comment = mysql_fetch_object($comments)) {
// discussid, parentid, name, email, web, ip, posted, message

View File

@@ -134,6 +134,7 @@ switch ($action) {
$row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_id=$cat_id");
++$querycount;
if ($row) {
if ($row->list_limit == -1) {
$row->list_limit = '';
@@ -324,11 +325,12 @@ switch ($action) {
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories ORDER BY cat_id");
foreach ($results as $row) {
if ($row->list_limit == -1) {
$row->list_limit = 'none';
}
$style = ($i % 2) ? ' class="alternate"' : '';
++$querycount;
foreach ($results as $row) {
if ($row->list_limit == -1) {
$row->list_limit = 'none';
}
$style = ($i % 2) ? ' class="alternate"' : '';
?>
<tr valign="middle" <?php echo $style ?>>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->cat_id?></td>

View File

@@ -33,9 +33,10 @@ $title = 'Manage Links';
$this_file = 'linkmanager.php';
function category_dropdown($fieldname, $selected = 0) {
global $wpdb, $tablelinkcategories;
global $wpdb, $querycount, $tablelinkcategories;
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
++$querycount;
echo ' <select name="'.$fieldname.'" size="1">'."\n";
foreach ($results as $row) {
echo " <option value=\"".$row->cat_id."\"";
@@ -109,6 +110,7 @@ switch ($action) {
}
$all_links = join(',', $linkcheck);
$results = $wpdb->get_results("SELECT link_id, link_owner, user_level FROM $tablelinks LEFT JOIN $tableusers ON link_owner = ID WHERE link_id in ($all_links)");
++$querycount;
foreach ($results as $row) {
if (!get_settings('links_use_adminlevels') || ($user_level >= $row->user_level)) { // ok to proceed
$ids_to_change[] = $row->link_id;
@@ -138,6 +140,7 @@ switch ($action) {
}
$all_links = join(',', $linkcheck);
$results = $wpdb->get_results("SELECT link_id, link_visible FROM $tablelinks WHERE link_id in ($all_links)");
++$querycount;
foreach ($results as $row) {
if ($row->link_visible == 'Y') { // ok to proceed
$ids_to_turnoff[] = $row->link_id;
@@ -304,6 +307,7 @@ switch ($action) {
$row = $wpdb->get_row("SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel, link_notes " .
" FROM $tablelinks " .
" WHERE link_id = $link_id");
++$querycount;
if ($row) {
$link_url = stripslashes($row->link_url);
@@ -498,6 +502,7 @@ function checkAll(form)
<td>
<?php
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
++$querycount;
echo " <select name=\"cat_id\">\n";
echo " <option value=\"All\"";
if ($cat_id == 'All')
@@ -560,6 +565,7 @@ function checkAll(form)
FROM $tablelinks
LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id
LEFT JOIN $tableusers ON $tableusers.ID = $tablelinks.link_owner ";
++$querycount;
if (isset($cat_id) && ($cat_id != 'All')) {
$sql .= " WHERE link_category = $cat_id ";
@@ -630,6 +636,7 @@ LINKS;
<input type="submit" name="action2" value="Assign" /> ownership <?php echo gethelp_link($this_file,'assign_ownership');?> to:
<?php
$results = $wpdb->get_results("SELECT ID, user_login FROM $tableusers WHERE user_level > 0 ORDER BY ID");
++$querycount;
echo " <select name=\"newowner\" size=\"1\">\n";
foreach ($results as $row) {
echo " <option value=\"".$row->ID."\"";

View File

@@ -73,6 +73,7 @@ switch ($step) {
Category: <?php echo gethelp_link($this_file,'link_category');?><select name="cat_id">
<?php
$categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
++$querycount;
foreach ($categories as $category) {
?>
<option value="<?php echo $category->cat_id; ?>"><?php echo $category->cat_id.': '.$category->cat_name; ?></option>

View File

@@ -50,6 +50,7 @@ SELECT;
."FROM $tableoptionvalues "
."WHERE option_id = $option_result->option_id "
."ORDER BY optionvalue_seq");
++$querycount;
if ($select) {
foreach($select as $option) {
$ret .= '<option value="'.$option->optionvalue.'"';
@@ -67,6 +68,7 @@ SELECT;
case 7: // SQL select
// first get the sql to run
$sql = $wpdb->get_var("SELECT optionvalue FROM $tableoptionvalues WHERE option_id = $option_result->option_id");
++$querycount;
if (!$sql) {
return $option_result->option_name . $editable;
}

View File

@@ -271,6 +271,7 @@ echo $posts_nav_bar;
if (($withcomments) or ($c)) {
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
++$querycount;
if ($comments) {
?>
@@ -353,4 +354,4 @@ echo $posts_nav_bar;
<?php
// uncomment this to show the nav bar at the bottom as well
// echo $posts_nav_bar;
?>
?>