The MU forums have moved to WordPress.org

Bug: Blog creation database errors (13 posts)

  1. Vimm
    Member
    Posted 16 years ago #

    I have noticed that after creating a new blog there is no content in the blog, just an error message. After further investigation there are several database errors generated in install_blog_defaults() in wpmu-function.php. The problem is caused by the database schema having all values set to NOT NULL, while the queries are missing several fields (and thus default to null). This causes the query to fail and the initial entry to not be created, among others. There are three such errors in this function which are easily fixed by updating the queries as follows:

    Line numbers are referenced using the current version at:
    http://trac.mu.wordpress.org/browser/trunk/wp-includes/wpmu-functions.php

    Line 1335:
    DELETE. There is no "linkcategories" table.

    Line 1336 - 1337:
    From:
    $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_owner, link_rss) VALUES ('http://wordpress.com/', 'WordPress.com', 1, '$user_id', 'http://wordpress.com/feed/');");
    $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_owner, link_rss) VALUES ('http://wordpress.org/', 'WordPress.org', 1, '$user_id', 'http://wordpress.org/development/feed/');");

    To:
    $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_updated, link_rel, link_notes, link_rss) VALUES ('http://wordpress.com/', 'WordPress.com', '', '', 1, '', 'Y', '$user_id', 0, 0, '', '', 'http://wordpress.com/feed/')");
    $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_updated, link_rel, link_notes, link_rss) VALUES ('http://wordpress.org/', 'WordPress.org', '', '', 1, '', 'Y', '$user_id', 0, 0, '', '', 'http://wordpress.org/development/feed/')");

    Line 1350:
    From:
    $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_category, post_name, post_modified, post_modified_gmt, comment_count) VALUES ('".$user_id."', '$now', '$now_gmt', '".addslashes($first_post)."', '".addslashes(__('Hello world!'))."', '0', '".addslashes(__('hello-world'))."', '$now', '$now_gmt', '1')");

    TO:
    $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_category, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_content_filtered, post_parent, guid, menu_order, post_type, post_mime_type, comment_count) VALUES ('".$user_id."', '$now', '$now_gmt', '".addslashes($first_post)."', '".addslashes(__('Hello world!'))."', '0', '', 'publish', 'open', 'open', '', '".addslashes(__('hello-world'))."', to_ping, pinged, '$now', '$now_gmt', '', 0, '', 0, 'post', '', 1)");

  2. drmiketemp
    Member
    Posted 16 years ago #

    I politely point out that you need to post all of that over on the trac, not here, as a new ticket. Posting it here does no good.

    You also need to state what the error message is that you are receiving.

  3. Vimm
    Member
    Posted 16 years ago #

    I looked at the trac place but when I submit my ticket it says:

    TICKET_CREATE privileges are required to perform this operation

    So if I can't make a ticket and I shouldn't post it here, how should I go about fixing it?

  4. lunabyte
    Member
    Posted 16 years ago #

    You gotta register and log into trac, duh.

  5. Vimm
    Member
    Posted 16 years ago #

    Seems to have a short session timeout. When I logged out and logged back in again it allowed me to submit it.

    Also, a link to the trac site on this site would be helpful. Perhaps I'm just missing it, but after looking around for a bit I gave up and googled it.

    PPS: There is no error message since SQL errors are suppressed in install_blog_defaults(). I had to comment out the suppression in order to see the exact SQL errors in the PHP error log, and the changes I made make the queries valid again.

    There is still one SQL error left due to all values in the $meta array being applied to both the wp_blogs table and the blog's options table (it should only exist in one), but I suspect that's not really worth trying to fix.

  6. drmiketemp
    Member
    Posted 16 years ago #

    Luna, be nice. They're trying. Better than 90% of the folks we have here.

    Something's up as that shouldn't be occuring. Log out fully, clear your browsers file and cookie cache and try again. It's teh same login and password you use here.

  7. lunabyte
    Member
    Posted 16 years ago #

    Damn typo. Supposed to be "Doh!"

    I'd ask the moderator if they could please correct it, but it seems we're missing out moderator.

  8. drmiketemp
    Member
    Posted 16 years ago #

    Don't look at me. Matt and crew have made their feelings known to me. I'm not even supposed to be here. I get a good chuckle out of the wp.com forums every morning when I look at those incorrect answers and pointing to the wrong FAQs and the spammers and all that. It's going to bite them on the ass some time soon. (I already see a few folks getting PO'ed trying to get replies over there. Yup, staff pays a lot of attention to those forums. Sure they do...)

    I do see the ticket did get logged.

  9. lunabyte
    Member
    Posted 16 years ago #

    What? You're not even supposed to be here today?

    Well hell, what's Randall going to do without ya? lol ;)

  10. Vimm
    Member
    Posted 16 years ago #

    Yes, it did get posted though my code got a tad mangled. Anyone know of a simple diff tool for Windows?

  11. lunabyte
    Member
    Posted 16 years ago #

    A buddy of mine uses a program called Araxis Merge. Granted, he's mainly running linux, but between quickbooks and that program, that's the only reason he still has a copy.

    It produces some very nice, detailed comparison reports.

    Granted, a nice comparison program comes stock with OS X in their developer tools.

  12. mysorehead
    Member
    Posted 16 years ago #

    TortoiseSVN

  13. drmiketemp
    Member
    Posted 16 years ago #

    Gotta admit that I use TortoiseSVN as well. I'm not big on it though but it does work. Hates compiled javascripts though.

About this Topic