The MU forums have moved to WordPress.org

Upgrade to 1.3, Table structure, Categories and Blogroll (19 posts)

  1. peripatetic
    Member
    Posted 16 years ago #

    I've found some problems with the upgrade from 1.25 to 1.3. I think these are related to the table structure.

    Blogs I've created in the older version, had the following tables eg:

    wp_52_categories, wp_52_comments, wp_52_link2cat, wp_52_links, wp_52_options, wp_52_post2cat, wp_52_postmeta, wp_52_posts

    The sidebar in blogs with this table structure shows the following entries:

    Categories
    * No categories
    Feeds
    * Entries (RSS)
    * Comments (RSS)

    i.e No blogrolls.

    Blogs created by the newer version have the following tables eg:
    wp_53_comments, wp_53_links, wp_53_options, wp_53_postmeta, wp_53_posts, wp_53_terms, wp_53_term_relationships, wp_53_term_taxonomy

    And the sidebar displays as follows:

    Categories
    * Uncategorized
    Blogroll
    * WordPress.com
    * WordPress.org
    Feeds
    * Entries (RSS)
    * Comments (RSS)

    Clearly I want all the blogs to be in the new format. What went wrong? Did the upgrade script fail? Any ideas on how I can upgrade the site succesfully?

  2. peripatetic
    Member
    Posted 16 years ago #

    OK, I've done a bit more digging ... apparently the wp_blog_versions table, which is used by the upgrade to determine whether or not to upgrade ... is empty! Surely that can't be right.
    Can anyone who knows the database structure of WPMU help me out here? Is there a way of manually running the upgrade script so I could run it on the individual blogs one by one?

    I have about 75 blogs in the system. Around half of them seem to be working correctly, and half are broken.

  3. theapparatus
    Member
    Posted 16 years ago #

    Did you run the taxonomy upgrade? Sounds like you may not have.

  4. peripatetic
    Member
    Posted 16 years ago #

    I certainly didn't run the taxonomy upgrade, and it looks as though it will do the job. I'll report back in a while. Thanks for that pointer ... but isn't it a bit strange that the upgrade process doesn't do this for you?

    Meanwhile, I've been studying the code in /wp-admin/includes/upgrade.php and there seems to be an upgrade process which handles this around line 542, where the comment reads
    // Convert categories to terms.
    Odd that this didn't fire off on my database. Anyhow ... on with the show ...

  5. peripatetic
    Member
    Posted 16 years ago #

    OK, I'm back.
    Some missing info: The script goes in the wp-content/mu-plugins/ directory and was actually already in there. I downloaded that version, uncommented it and reuploaded it.

    Having appended ?upgradetaxonomy=1 as instructed, there was no confirmation, but no errors,

    The value of the key is not put in the site_options table, which doesn't actually exist, but in the wp_sitemeta table.

    Having retrieved this and run
    blog/?upgradetaxonomy=xxxxxxxxxxxxxxx
    The script seems to cycle through the blogs, but doesn't actually make any changes to the tables.

    Also, running
    blog/subblog/?taxonomysync=xxxxxxxxxxxx
    Doesn't seem to do anything.

    So maybe the problem which is stopping the normal upgrade script from working is also stopping this from working.

  6. aydos
    Member
    Posted 16 years ago #

    hi,
    i also have same problems with taxonomy tables... my root blog was upgraged successfuly. but other blogs give errors (505 internal)... i tried the taxonomy upgrade, it says that all blog upgraded but the code does not create taxonamy tables in database.
    should i create taxonomy tables in any way? should i create manually or change the taxonomy upgrade code and try again?

  7. theapparatus
    Member
    Posted 16 years ago #

    You should be checking the webserver and mu error logs first actually.

    http://codex.wordpress.org/Debugging_WPMU

    If something didn't run right or you;re getting a 505 error, you should be seeing something in one of those logs.

  8. aydos
    Member
    Posted 16 years ago #

    Thanks... please look at my boring story :) for details:

    I upgraded my site. First blog (base) was working well. But others had some problems:
    mysite.com/blog2 shown without template.
    mysite.com/blog2/wp-login.php give 500 Internal server error.

    I read some posts, and run the taxonomy upgrade. Errors still were alive.

    I read some posts again, and looked at server logs. It said:
    [09-Nov-2007 11:44:03] WordPress database error: [Table 'mydb.wp_2_terms' doesn't exist]

    I checked the database: wp_1_terms was exist, but wp_2_terms was not.

    I checked the taxonomy upgrade script. It does not run the do_backfill() function, which creates the taxonomy tables, because

    if( function_exists( 'get_term' ) )
    		return;

    at near 200th line.

    and I stopped and send the post.
    I can give the real urls

  9. peripatetic
    Member
    Posted 16 years ago #

    I wasn't able to find a solution to this either in the forums or with web searches, so I've now manually altered the database. The problem was that only half of the blogs upgraded when I ran the upgrade script. I still have no idea why some blogs were skipped, and that probably warrants more attention.

    The fix involved deleting (actually renaming) three tables which were in the old information schema, and then updating a further four tables with information which was in the tables from a correctly updated blog. I'm supplying the code here in case its useful to anyone else. HOWEVER please don't just run it on your database, this is an EXAMPLE only, and will need to be edited before you run it on your own database. For the record I'm trying to update blog number _2_ and filling the blogroll with data from blog number _70_ which was correctly updated.

    RENAME TABLE wp_2_categories TO zz_2_categories, wp_2_link2cat TO zz_2_link2cat, wp_2_post2cat to zz_2_post2cat;
    DROP TABLE wp_2_links;
    
    CREATE TABLE wp_2_links ( link_id bigint( 20 ) NOT NULL auto_increment ,
     link_url varchar( 255 ) NOT NULL default '',
     link_name varchar( 255 ) NOT NULL default '',
     link_image varchar( 255 ) NOT NULL default '',
     link_target varchar( 25 ) NOT NULL default '',
     link_category bigint( 20 ) NOT NULL default '0',
     link_description varchar( 255 ) NOT NULL default '',
     link_visible enum( 'Y', 'N' ) NOT NULL default 'Y',
     link_owner int( 11 ) NOT NULL default '1',
     link_rating int( 11 ) NOT NULL default '0',
     link_updated datetime NOT NULL default '0000-00-00 00:00:00',
     link_rel varchar( 255 ) NOT NULL default '',
     link_notes mediumtext NOT NULL ,
     link_rss varchar( 255 ) NOT NULL default '',
     PRIMARY KEY ( link_id ) ,
     KEY link_category ( link_category ) ,
     KEY link_visible ( link_visible ) ) ENGINE = MyISAM DEFAULT CHARSET = utf8;
    INSERT INTO wp_2_links SELECT * FROM wp_70_links;
    
    CREATE  TABLE  wp_2_terms (  term_id bigint( 20  )  NOT  NULL  auto_increment ,
     name varchar( 55  )  NOT  NULL default  '',
     slug varchar( 200  )  NOT  NULL default  '',
     term_group bigint( 10  )  NOT  NULL default  '0',
     PRIMARY  KEY (  term_id  ) ,
     UNIQUE  KEY  slug (  slug  )  ) ENGINE  =  MyISAM DEFAULT CHARSET  = utf8;
    INSERT INTO wp_2_terms SELECT * FROM wp_70_terms;
    
    CREATE  TABLE  wp_2_term_relationships (  object_id bigint( 20  )  NOT  NULL default  '0',
     term_taxonomy_id bigint( 20  )  NOT  NULL default  '0',
     PRIMARY  KEY (  object_id ,  term_taxonomy_id  ) ,
     KEY  term_taxonomy_id (  term_taxonomy_id  )  ) ENGINE  =  MyISAM DEFAULT CHARSET  = utf8;
    INSERT INTO wp_2_term_relationships SELECT * FROM wp_70_term_relationships;
    
    CREATE  TABLE  wp_2_term_taxonomy (  term_taxonomy_id bigint( 20  )  NOT  NULL  auto_increment ,
     term_id bigint( 20  )  NOT  NULL default  '0',
     taxonomy varchar( 32  )  NOT  NULL default  '',
     description longtext NOT  NULL ,
     parent bigint( 20  )  NOT  NULL default  '0',
     count bigint( 20  )  NOT  NULL default  '0',
     PRIMARY  KEY (  term_taxonomy_id  ) ,
     UNIQUE  KEY  term_id_taxonomy (  term_id ,  taxonomy  )  ) ENGINE  =  MyISAM DEFAULT CHARSET  = utf8;
    INSERT INTO wp_2_term_taxonomy SELECT * FROM wp_70_term_taxonomy;
  10. peripatetic
    Member
    Posted 16 years ago #

    Of course this SQL has to be run once for each blog. As I had 40 blogs to update, I used OpenOffice Writer / MS Word merge function to repeat the SQL 40 times, substituting the correct blog number each time.

  11. epheph
    Member
    Posted 15 years ago #

    I am suffering from this problem as well. I performed an upgrade from 1.1.1 to 1.3.3 which lost all categories and blogrolls. From what I can tell, the category and blogroll info is still in the database, but not in a form the new WPmu is expecting.

    Existing users cannot even add their categories back if they tried.

    My setup:
    Red Hat Enterprise Linux ES release 4
    Apache 2.0.59
    MySQL-5.0.45-community
    PHP 5.2.3

    I performed a clean install of the extracted files and selectively copied over old files (plugins, themes, wp-config.php)

    I am going to look into trying peripatetic's method of SQL modification, but I don't have an existing _term_taxonomy since I cannot create new blogs, either (covered in a separate post). Thanks for your help.

  12. selad
    Member
    Posted 15 years ago #

    Did you try calling the upgrade function by "hand":
    http://blog.domain.com/wp-admin/upgrade.php?step=1

  13. epheph
    Member
    Posted 15 years ago #

    It returns
    "No Upgrade Required

    Your WordPress database is already up-to-date!"

    I checked and the db_version for this blog is: 6124

    here is the table structure:
    wp_4_comments
    wp_4_links
    wp_4_options
    wp_4_postmeta
    wp_4_posts
    wp_4_sk2_logs
    wp_4_sk2_spams

    Is this the correct schema for 6124? Thanks for your help!

  14. epheph
    Member
    Posted 15 years ago #

    While looking into this problem further, it seems all categories in the new version of WPmu are stored in "wp_sitecategories" ? Users cannot even add categories themselves, is it possible this is a db_version inconsistency between blogs & actual site structure?

  15. selad
    Member
    Posted 15 years ago #

    I think you lost all categories. They used to be stored in 3 tables that should have been replaced with the new taxonomy ones. You are missing both.

  16. epheph
    Member
    Posted 15 years ago #

    Hmmmmmm.... OK, well I have backups, and the backup is restored to another DB on the same system. If i could just see how they are supposed to work in the new system it shouldn't be too hard to script...

  17. epheph
    Member
    Posted 15 years ago #

    Also, broken categories will break the blogroll, right?

  18. selad
    Member
    Posted 15 years ago #

    Old categories:
    wp_1_categories
    wp_1_comments
    wp_1_link2cat
    wp_1_links
    wp_1_options
    wp_1_post2cat
    wp_1_postmeta
    wp_1_posts

    New categories:
    wp_1_comments
    wp_1_links
    wp_1_options
    wp_1_postmeta
    wp_1_posts
    wp_1_terms
    wp_1_term_relationships
    wp_1_term_taxonomy

    (diffs in bold)

  19. epheph
    Member
    Posted 15 years ago #

    Thank you, this is very helpful. I see the schema above that I will use, but i see he is pre-populating with something from his wp_70. Is there default data that is needed for the taxonomy to function? Thanks!

About this Topic

  • Started 16 years ago by peripatetic
  • Latest reply from epheph