[wp-trac] [WordPress Trac] #2962: "Resetting" a blog and re-running install.php does not work

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 20 23:57:01 GMT 2006


#2962: "Resetting" a blog and re-running install.php does not work
----------------------------+-----------------------------------------------
 Reporter:  RuddO           |       Owner:  anonymous
     Type:  defect          |      Status:  new      
 Priority:  normal          |   Milestone:  2.0.4    
Component:  Administration  |     Version:  2.0.3    
 Severity:  major           |    Keywords:           
----------------------------+-----------------------------------------------
 I encountered a problem using WP 2.0.3 + nonce fixes patch.  It's
 basically the following:

 1. delete all the WP tables' contents using delete from wp_...
 2. re-run install.php to have the tables repopulated with default values
 3. try to log in with the newly created admin user

 You can log in, but you can't access any of the admin pages (You do not
 have sufficient permissions... that menu.php prints).

 This is what's going on, after running install.php:

 mysql> select * from test_usermeta;
 +----------+---------+-------------------+---------------------------------+
 | umeta_id | user_id | meta_key          | meta_value
 |
 +----------+---------+-------------------+---------------------------------+
 |        5 |       1 | test_user_level   | 10
 |
 |        6 |       5 | test_capabilities | a:1:{s:13:"administrator";b:1;}
 |
 +----------+---------+-------------------+---------------------------------+

 As you can see, the row keyed 6 is using the user_id 5 (non-existant,
 probably taken from some autoincrement in MySQL).  The test_users table
 has the following:

 mysql> select * from test_users;
 +----+------------+----------------------------------+---------------+-------------------+----------+---------------------+---------------------+-------------+--------------+
 | ID | user_login | user_pass                        | user_nicename |
 user_email        | user_url | user_registered     | user_activation_key |
 user_status | display_name |
 +----+------------+----------------------------------+---------------+-------------------+----------+---------------------+---------------------+-------------+--------------+
 |  1 | admin      | 65313ed4218de7c45b1425624632756b | admin         |
 asantos at gmail.com |          | 2006-07-20 18:18:17 |                     |
 0 | asantos      |
 +----+------------+----------------------------------+---------------+-------------------+----------+---------------------+---------------------+-------------+--------------+

 so you can see the correct user ID is 1.

 A simple

 mysql> update test_usermeta set user_id = 1;

 fixes the issue.

 I admit, and I know, emptying a table does not guarantee that the
 autoincrement counter will be reset.  But this simple fact shouldn't have
 any impact on WP performance.

 Who knows what other kinds of bugs like this lie around in WP's source
 code?

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2962>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list