diff options
Diffstat (limited to 'modules/system/system.install')
-rw-r--r-- | modules/system/system.install | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/modules/system/system.install b/modules/system/system.install index c244684e9..460836948 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -342,17 +342,17 @@ function system_install() { // uid 2 which is not what we want. So we insert the first user here, the // anonymous user. uid is 1 here for now, but very soon it will be changed // to 0. - db_query("INSERT INTO {user} (name, mail) VALUES('%s', '%s')", '', ''); + db_query("INSERT INTO {users} (name, mail) VALUES('%s', '%s')", '', ''); // We need some placeholders here as name and mail are uniques and data is // presumed to be a serialized array. Install will change uid 1 immediately // anyways. So we insert the superuser here, the uid is 2 here for now, but // very soon it will be changed to 1. - db_query("INSERT INTO {user} (name, mail, created, status, data) VALUES('%s', '%s', %d, %d, '%s')", 'placeholder-for-uid-1', 'placeholder-for-uid-1', REQUEST_TIME, 1, serialize(array())); + db_query("INSERT INTO {users} (name, mail, created, status, data) VALUES('%s', '%s', %d, %d, '%s')", 'placeholder-for-uid-1', 'placeholder-for-uid-1', REQUEST_TIME, 1, serialize(array())); // This sets the above two users uid 0 (anonymous). We avoid an explicit 0 // otherwise MySQL might insert the next auto_increment value. - db_query("UPDATE {user} SET uid = uid - uid WHERE name = '%s'", ''); + db_query("UPDATE {users} SET uid = uid - uid WHERE name = '%s'", ''); // This sets uid 1 (superuser). We skip uid 2 but that's not a big problem. - db_query("UPDATE {user} SET uid = 1 WHERE name = '%s'", 'placeholder-for-uid-1'); + db_query("UPDATE {users} SET uid = 1 WHERE name = '%s'", 'placeholder-for-uid-1'); // Built-in roles. db_query("INSERT INTO {role} (name) VALUES ('%s')", 'anonymous user'); @@ -608,7 +608,7 @@ function system_schema() { 'not null' => TRUE, ), 'uid' => array( - 'description' => 'The {user}.uid of the user who is associated with the file.', + 'description' => 'The {users}.uid of the user who is associated with the file.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, @@ -700,10 +700,10 @@ function system_schema() { ); $schema['history'] = array( - 'description' => 'A record of which {user} have read which {node}s.', + 'description' => 'A record of which {users} have read which {node}s.', 'fields' => array( 'uid' => array( - 'description' => 'The {user}.uid that read the {node} nid.', + 'description' => 'The {users}.uid that read the {node} nid.', 'type' => 'int', 'not null' => TRUE, 'default' => 0, @@ -1114,7 +1114,7 @@ function system_schema() { 'description' => "Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.", 'fields' => array( 'uid' => array( - 'description' => 'The {user}.uid corresponding to a session, or 0 for anonymous user.', + 'description' => 'The {users}.uid corresponding to a session, or 0 for anonymous user.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, @@ -1772,11 +1772,11 @@ function system_update_6019() { db_change_field($ret, 'cache_form', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); // Remove default => 0, set auto increment. - $new_uid = 1 + db_result(db_query('SELECT MAX(uid) FROM {user}')); - $ret[] = update_sql('UPDATE {user} SET uid = ' . $new_uid . ' WHERE uid = 0'); - db_drop_primary_key($ret, 'user'); - db_change_field($ret, 'user', 'uid', 'uid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('uid'))); - $ret[] = update_sql('UPDATE {user} SET uid = 0 WHERE uid = ' . $new_uid); + $new_uid = 1 + db_result(db_query('SELECT MAX(uid) FROM {users}')); + $ret[] = update_sql('UPDATE {users} SET uid = ' . $new_uid . ' WHERE uid = 0'); + db_drop_primary_key($ret, 'users'); + db_change_field($ret, 'users', 'uid', 'uid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('uid'))); + $ret[] = update_sql('UPDATE {users} SET uid = 0 WHERE uid = ' . $new_uid); // Special field names. $map = array('node_revisions' => 'vid'); @@ -2521,8 +2521,8 @@ function system_update_6043() { db_drop_index($ret, 'node', 'status'); db_drop_unique_key($ret, 'node', 'nid_vid'); // Improve user module indices. - db_add_index($ret, 'user', 'mail', array('mail')); - db_add_index($ret, 'user_role', 'rid', array('rid')); + db_add_index($ret, 'users', 'mail', array('mail')); + db_add_index($ret, 'users_roles', 'rid', array('rid')); // Optional modules - need to check if the tables exist. // Alter aggregator module's tables primary keys to make them more useful. @@ -2610,8 +2610,8 @@ function system_update_6044() { } // User module indices. - db_drop_unique_key($ret, 'user', 'mail'); - db_add_index($ret, 'user', 'mail', array('mail')); + db_drop_unique_key($ret, 'users', 'mail'); + db_add_index($ret, 'users', 'mail', array('mail')); // Optional modules - need to check if the tables exist. // Alter taxonomy module's tables. @@ -2864,11 +2864,11 @@ function system_update_7004(&$sandbox) { // Initialize batch update information. $sandbox['progress'] = 0; $sandbox['last_user_processed'] = -1; - $sandbox['max'] = db_result(db_query("SELECT COUNT(*) FROM {user} WHERE data IS NOT NULL")); + $sandbox['max'] = db_result(db_query("SELECT COUNT(*) FROM {users} WHERE data IS NOT NULL")); } // Now do the batch update of the user-specific block visibility settings. $limit = 100; - $result = db_query_range("SELECT uid, data FROM {user} WHERE uid > %d AND data IS NOT NULL", $sandbox['last_user_processed'], 0, $limit); + $result = db_query_range("SELECT uid, data FROM {users} WHERE uid > %d AND data IS NOT NULL", $sandbox['last_user_processed'], 0, $limit); while ($row = db_fetch_object($result)) { $data = unserialize($row->data); $user_needs_update = FALSE; @@ -2885,7 +2885,7 @@ function system_update_7004(&$sandbox) { } // Update the current user. if ($user_needs_update) { - db_query("UPDATE {user} SET data = '%s' WHERE uid = %d", serialize($data), $row->uid); + db_query("UPDATE {users} SET data = '%s' WHERE uid = %d", serialize($data), $row->uid); } // Update our progress information for the batch update. $sandbox['progress']++; |