Work:Wordpress and Fantastico to Simple Scripts Failure
Contents |
Synopsis
I recently had two issue arise where the user had converted their Wordpress installations from Fantastico to Simple Scripts, and their site became unusable. The database still had the content, users and comments, everything, but you got a 404 Error from Wordpress simply visiting the site, so I was able to trace down the problem to the following:
[01-Dec-2008 12:30:10] WordPress database error Table '1234567_wrdp1.wp_terms' doesn't exist for query SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('category') ORDER BY t.name ASC made by get_terms
Further research concluded the problem was needing to run the wp-admin/upgrade.php script to fix the database, but as you may already be aware of, without the wp_terms table, you also can't log in to access the Admin backend.
Notes from Simple Scripts
I discussed this case with Simple Scripts and according to them, their upgrade.php is extremely stripped down, removing various things that make the Simple Scripts interface choke when upgrading, and they told me the upgrade.php file listed is NOT theirs, therefore the user has upgraded Wordpress themselves and then after this ran the Simple Scripts migration tool. The user could very well have installed the AutoUpgrade Worpress Plugin as well, and it may have been run prior to the migration as well. Therefore it will be important to knuckle the user down and determine if either of these scenarios are the case. Also, you can use Simple Scripts to upgrade them to the Wordpress 2.7-beta that's available as well, it will go out of beta in a few days anyways, this way, we don't have to run the fix below, unless the customer really needs to keep the 2.6.5 versions.
Fantastico Specifics
New information has come to my attention today, regarding this issue, I had a tech work with me, and tell me he recieved the same error, but he never used Simple Scripts, so it is Fantastico specific. It would appear that Simple Scripts will simply fail to make the upgrade because the upgrade process on Fantastico removed the wp-term* tables from the database. So we'll need to run the upgradewp.php before doing anything else.
SSH to the Rescue
Thus, SSH to the rescue. I had to hack the upgrade.php file to run on the command line, below is a hacked version, install this to wp-admin/ as upgradewp.php and then SSH to the server and enter the following:
cd $HOME/path/to/wp-admin/ #change to the correct physical path. php upgradewp.php
The OutPut
Here is the output you should see upon success:
[~/public_html/wp-admin]# php upgradewp.php [12/01/08][15:24:17] X-Powered-By: PHP/5.2.6 Content-type: text/html Upgrade Complete I made 7 Queries And it took me 0.094 Seconds Done..
This means sweet success, in the web browser, navigate to the Wordpress frontpage and check out the sweet Post, Comments and Pages Goodness :). So without further adieu, here's the hacked upgradewp.php, remember install this in the wp-admin/ directory of the Wordpress installation as the included files to make this script work are accessed from there.
The Script
<?php //Install me to wp-admin/ for security purposes. //Name me upgradewp.php too please ;) This is version 1.0-final define('WP_INSTALLING', true); if (!file_exists('../wp-load.php')) { require('../wp-config.php'); } else { require('../wp-load.php'); } timer_start(); require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); if ( get_option('db_version') == $wp_db_version ) { echo"Database Already Updated Properly to $wp_db_version\n"; die(); } else { wp_upgrade(); echo "Upgrade Complete\n\n"; echo "I made $wpdb->num_queries Queries\n"; echo "And it took me ".timer_stop(0)." Seconds\n"; } echo "Done..\n\n"; ?>
CleanUp
I'd recommend removing the upgradewp.php script from wp-admin/ just to prevent any concern or mixup on the user's part. Once they're migrated to Simple Scripts, there shouldn't be anymore issues.
Other Issues
Admin Login Fails
There seems to be an after effect of this entire mess, various accounts have been unable to login as admin, renaming the wp-content/plugins folder to wp-content/plugins.bak is supposed to fix this, though I've not tested this yet, Brandon has had luck with it. Once login has been restored, rename the wp-content/plugins.bak folder to wp-content/plugins/ and have the user reenable the plugins.
