Make WordPress Core


Ignore:
Timestamp:
05/24/2004 08:22:18 AM (21 years ago)
Author:
saxmatt
Message:

Giant commit, sorry mailing list people. Move all table names to new $wpdb versions. Works but the whole app needs thorough testing now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import-rss.php

    r1264 r1355  
    125125// So we do it as a last resort
    126126if ('' == $title) :
    127     $dupe = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_content = '$content' AND post_date = '$post_date'");
     127    $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' AND post_date = '$post_date'");
    128128else :
    129     $dupe = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$title' AND post_date = '$post_date'");
     129    $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
    130130endif;
    131131
     
    135135else :
    136136   
    137     $wpdb->query("INSERT INTO $tableposts
     137    $wpdb->query("INSERT INTO $wpdb->posts
    138138        (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name)
    139139        VALUES
    140140        ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')");
    141     $post_id = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$title' AND post_date = '$post_date'");
     141    $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
    142142    if (!$post_id) die("couldn't get post ID");
    143143    if (0 != count($categories)) :
     
    145145        $post_category = unhtmlentities($post_category);
    146146        // See if the category exists yet
    147         $cat_id = $wpdb->get_var("SELECT cat_ID from $tablecategories WHERE cat_name = '$post_category'");
     147        $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
    148148        if (!$cat_id && '' != trim($post_category)) {
    149149            $cat_nicename = sanitize_title($post_category);
    150             $wpdb->query("INSERT INTO $tablecategories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");
    151             $cat_id = $wpdb->get_var("SELECT cat_ID from $tablecategories WHERE cat_name = '$post_category'");
     150            $wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");
     151            $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
    152152        }
    153153        if ('' == trim($post_category)) $cat_id = 1;
    154154        // Double check it's not there already
    155         $exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_id AND category_id = $cat_id");
     155        $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id");
    156156   
    157157         if (!$exists) {
    158158            $wpdb->query("
    159             INSERT INTO $tablepost2cat
     159            INSERT INTO $wpdb->post2cat
    160160            (post_id, category_id)
    161161            VALUES
     
    165165    endforeach;
    166166    else:
    167         $exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_id AND category_id = 1");
    168         if (!$exists) $wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_id, 1) ");
     167        $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1");
     168        if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) ");
    169169    endif;
    170170    echo 'Done!</li>';
Note: See TracChangeset for help on using the changeset viewer.