mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-30 18:24:31 +00:00
Giant commit, sorry mailing list people. Move all table names to new $wpdb versions. Works but the whole app needs thorough testing now.
git-svn-id: https://develop.svn.wordpress.org/trunk@1355 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -71,16 +71,16 @@ if ($connection && $database) {
|
||||
<p>First let's get posts and comments.</p>
|
||||
<?php
|
||||
// For people running this on .72
|
||||
$query = "ALTER TABLE `$tableposts` ADD `post_name` VARCHAR(200) NOT NULL";
|
||||
maybe_add_column($tableposts, 'post_name', $query);
|
||||
$query = "ALTER TABLE `$wpdb->posts` ADD `post_name` VARCHAR(200) NOT NULL";
|
||||
maybe_add_column($wpdb->posts, 'post_name', $query);
|
||||
|
||||
// Create post_name field
|
||||
$connection = @mysql_connect($tp_database_host, $tp_database_username, $tp_database_password);
|
||||
$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");
|
||||
$category = $wpdb->get_var("SELECT cat_ID FROM $tablecategories LIMIT 1");
|
||||
$author = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_level = 10 LIMIT 1");
|
||||
$category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1");
|
||||
|
||||
$posts = mysql_query('SELECT * FROM textpattern', $connection);
|
||||
|
||||
@@ -101,13 +101,13 @@ while ($post = mysql_fetch_array($posts)) {
|
||||
$title = $post['Title'];
|
||||
$post_name = sanitize_title($title);
|
||||
|
||||
$wpdb->query("INSERT INTO $tableposts
|
||||
$wpdb->query("INSERT INTO $wpdb->posts
|
||||
(post_author, post_date, post_content, post_title, post_category, post_name, post_status)
|
||||
VALUES
|
||||
('$author', '$posted', '$content', '$title', '$category', '$post_name', 'publish')");
|
||||
|
||||
// Get wordpress post id
|
||||
$wp_post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
|
||||
$wp_post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1");
|
||||
|
||||
// Now let's insert comments if there are any for the TP post
|
||||
$tp_id = $post['ID'];
|
||||
@@ -117,7 +117,7 @@ while ($post = mysql_fetch_array($posts)) {
|
||||
// discussid, parentid, name, email, web, ip, posted, message
|
||||
// For some reason here "posted" is a real MySQL date, so we don't have to do anything about it
|
||||
// comment_post_ID comment_author comment_author_email comment_author_url comment_author_IP comment_date comment_content comment_karma
|
||||
$wpdb->query("INSERT INTO $tablecomments
|
||||
$wpdb->query("INSERT INTO $wpdb->comments
|
||||
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content)
|
||||
VALUES
|
||||
($wp_post_ID, '$comment->name', '$comment->email', '$comment->web', '$comment->ip', '$comment->posted', '$comment->message')");
|
||||
|
||||
Reference in New Issue
Block a user