summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/file.inc2
-rw-r--r--includes/password.inc4
-rw-r--r--includes/session.inc6
-rw-r--r--modules/block/block.install2
-rw-r--r--modules/blogapi/blogapi.install2
-rw-r--r--modules/blogapi/blogapi.module4
-rw-r--r--modules/comment/comment.admin.inc6
-rw-r--r--modules/comment/comment.install4
-rw-r--r--modules/comment/comment.module8
-rw-r--r--modules/comment/comment.pages.inc4
-rw-r--r--modules/dblog/dblog.admin.inc4
-rw-r--r--modules/dblog/dblog.install2
-rw-r--r--modules/forum/forum.module4
-rw-r--r--modules/node/node.admin.inc2
-rw-r--r--modules/node/node.install4
-rw-r--r--modules/node/node.module18
-rw-r--r--modules/poll/poll.install6
-rw-r--r--modules/poll/poll.pages.inc2
-rw-r--r--modules/profile/profile.admin.inc2
-rw-r--r--modules/profile/profile.install2
-rw-r--r--modules/profile/profile.pages.inc4
-rw-r--r--modules/simpletest/tests/database_test.test4
-rw-r--r--modules/statistics/statistics.admin.inc6
-rw-r--r--modules/statistics/statistics.install2
-rw-r--r--modules/statistics/statistics.module2
-rw-r--r--modules/statistics/statistics.pages.inc2
-rw-r--r--modules/system/system.admin.inc2
-rw-r--r--modules/system/system.api.php2
-rw-r--r--modules/system/system.install40
-rw-r--r--modules/tracker/tracker.pages.inc4
-rw-r--r--modules/user/user.admin.inc16
-rw-r--r--modules/user/user.install62
-rw-r--r--modules/user/user.module66
-rw-r--r--modules/user/user.pages.inc2
-rwxr-xr-xscripts/password-hash.sh2
-rw-r--r--sites/default/default.settings.php2
-rw-r--r--update.php18
37 files changed, 153 insertions, 171 deletions
diff --git a/includes/file.inc b/includes/file.inc
index 8b6162379..aa3b7f190 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -13,7 +13,7 @@
*
* Fields on the file object:
* - fid - File ID
- * - uid - The {user}.uid of the user who is associated with the file.
+ * - uid - The {users}.uid of the user who is associated with the file.
* - filename - Name of the file with no path components. This may differ from
* the basename of the filepath if the file is renamed to avoid overwriting
* an existing file.
diff --git a/includes/password.inc b/includes/password.inc
index 667c3ba47..e82842634 100644
--- a/includes/password.inc
+++ b/includes/password.inc
@@ -195,7 +195,7 @@ function user_hash_password($password, $count_log2 = 0) {
* @param $password
* A plain-text password
* @param $account
- * A user object with at least the fields from the {user} table.
+ * A user object with at least the fields from the {users} table.
*
* @return
* TRUE or FALSE.
@@ -227,7 +227,7 @@ function user_check_password($password, $account) {
* on the fields in $account.
*
* @param $account
- * A user object with at least the fields from the {user} table.
+ * A user object with at least the fields from the {users} table.
*
* @return
* TRUE or FALSE.
diff --git a/includes/session.inc b/includes/session.inc
index 141af2f8f..aa06db4ca 100644
--- a/includes/session.inc
+++ b/includes/session.inc
@@ -83,7 +83,7 @@ function _sess_read($key) {
// Otherwise, if the session is still active, we have a record of the
// client's session in the database.
- $user = db_query("SELECT u.*, s.* FROM {user} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", array(':sid' => $key))->fetchObject();
+ $user = db_query("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", array(':sid' => $key))->fetchObject();
// We found the client's session record and they are an authenticated user.
if ($user && $user->uid > 0) {
@@ -93,7 +93,7 @@ function _sess_read($key) {
// Add roles element to $user.
$user->roles = array();
$user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
- $user->roles += db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {user_role} ur ON ur.rid = r.rid WHERE ur.uid = :uid", array(':uid' => $user->uid))->fetchAllKeyed(0, 1);
+ $user->roles += db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = :uid", array(':uid' => $user->uid))->fetchAllKeyed(0, 1);
}
// We didn't find the client's record (session has expired), or they
// are an anonymous user.
@@ -146,7 +146,7 @@ function _sess_write($key, $value) {
// Last access time is updated no more frequently than once every 180 seconds.
// This reduces contention in the users table.
if ($user->uid && REQUEST_TIME - $user->access > variable_get('session_write_interval', 180)) {
- db_update('user')
+ db_update('users')
->fields(array(
'access' => REQUEST_TIME
))
diff --git a/modules/block/block.install b/modules/block/block.install
index dc29c0ac8..db8a2f503 100644
--- a/modules/block/block.install
+++ b/modules/block/block.install
@@ -117,7 +117,7 @@ function block_schema() {
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
- 'description' => "The user's role ID from {user_role}.rid.",
+ 'description' => "The user's role ID from {users_roles}.rid.",
),
),
'primary key' => array('module', 'delta', 'rid'),
diff --git a/modules/blogapi/blogapi.install b/modules/blogapi/blogapi.install
index d0dc8eaa3..a8bb46d9b 100644
--- a/modules/blogapi/blogapi.install
+++ b/modules/blogapi/blogapi.install
@@ -30,7 +30,7 @@ function blogapi_schema() {
'type' => 'serial',
),
'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,
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index 57c210191..763d39f10 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -379,13 +379,13 @@ function blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password
}
if ($bodies) {
- $result = db_query_range("SELECT n.nid, n.title, r.body, r.format, n.comment, n.created, u.name FROM {node} n, {node_revision} r, {user} u WHERE n.uid = u.uid AND n.vid = r.vid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array(
+ $result = db_query_range("SELECT n.nid, n.title, r.body, r.format, n.comment, n.created, u.name FROM {node} n, {node_revision} r, {users} u WHERE n.uid = u.uid AND n.vid = r.vid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array(
':type' => $blogid,
':uid' => $user->uid
), 0, $number_of_posts);
}
else {
- $result = db_query_range("SELECT n.nid, n.title, n.created, u.name FROM {node} n, {user} u WHERE n.uid = u.uid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array(
+ $result = db_query_range("SELECT n.nid, n.title, n.created, u.name FROM {node} n, {users} u WHERE n.uid = u.uid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array(
':type' => $blogid,
':uid' => $user->uid
), 0, $number_of_posts);
diff --git a/modules/comment/comment.admin.inc b/modules/comment/comment.admin.inc
index 8d88ec77e..d669fe5e7 100644
--- a/modules/comment/comment.admin.inc
+++ b/modules/comment/comment.admin.inc
@@ -67,7 +67,7 @@ function comment_admin_overview($type = 'new', $arg) {
);
$query = db_select('comment', 'c');
- $query->join('user', 'u', 'u.uid = c.uid');
+ $query->join('users', 'u', 'u.uid = c.uid');
$query->join('node', 'n', 'n.nid = c.nid');
$query->addField('u', 'name', 'registered_name');
$query->addField('n', 'title', 'node_title');
@@ -218,7 +218,7 @@ function comment_multiple_delete_confirm_submit($form, &$form_state) {
* The comment to be deleted.
*/
function comment_delete($cid = NULL) {
- $comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {user} u ON u.uid = c.uid WHERE c.cid = %d', $cid));
+ $comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.cid = %d', $cid));
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
$output = '';
@@ -285,7 +285,7 @@ function _comment_delete_thread($comment) {
comment_invoke_comment($comment, 'delete');
// Delete the comment's replies.
- $result = db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {user} u ON u.uid = c.uid WHERE pid = %d', $comment->cid);
+ $result = db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {users} u ON u.uid = c.uid WHERE pid = %d', $comment->cid);
while ($comment = db_fetch_object($result)) {
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
_comment_delete_thread($comment);
diff --git a/modules/comment/comment.install b/modules/comment/comment.install
index 60b8b8e75..0ae7e1980 100644
--- a/modules/comment/comment.install
+++ b/modules/comment/comment.install
@@ -181,7 +181,7 @@ function comment_schema() {
'type' => 'int',
'not null' => TRUE,
'default' => 0,
- 'description' => 'The {user}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.',
+ 'description' => 'The {users}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.',
),
'subject' => array(
'type' => 'varchar',
@@ -234,7 +234,7 @@ function comment_schema() {
'type' => 'varchar',
'length' => 60,
'not null' => FALSE,
- 'description' => "The comment author's name. Uses {user}.name if the user is logged in, otherwise uses the value typed into the comment form.",
+ 'description' => "The comment author's name. Uses {users}.name if the user is logged in, otherwise uses the value typed into the comment form.",
),
'mail' => array(
'type' => 'varchar',
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index d982a19f8..89c5c4557 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1058,7 +1058,7 @@ function comment_render($node, $cid = 0) {
$query->fields('c', array('cid', 'nid', 'pid', 'comment', 'subject', 'format', 'timestamp', 'name', 'mail', 'homepage', 'status') );
$query->fields('u', array( 'uid', 'signature', 'picture', 'data', 'status') );
$query->addField('u', 'name', 'registered_name');
- $query->innerJoin('user', 'u', 'c.uid = u.uid');
+ $query->innerJoin('users', 'u', 'c.uid = u.uid');
$query->condition('c.cid', $cid);
if (!user_access('administer comments')) {
@@ -1084,7 +1084,7 @@ function comment_render($node, $cid = 0) {
// Multiple comment view.
$query_count = 'SELECT COUNT(*) FROM {comment} c WHERE c.nid = %d';
- $query = 'SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM {comment} c INNER JOIN {user} u ON c.uid = u.uid WHERE c.nid = %d';
+ $query = 'SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d';
$query_args = array($nid);
if (!user_access('administer comments')) {
@@ -1292,7 +1292,7 @@ function comment_validate($edit) {
$node = node_load($edit['nid']);
if (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
if ($edit['name']) {
- $query = db_select('user', 'u');
+ $query = db_select('users', 'u');
$query->addField('u', 'uid', 'uid');
$taken = $query->where('LOWER(name) = :name', array(':name' => $edit['name']))
->countQuery()
@@ -1635,7 +1635,7 @@ function comment_form_add_preview($form, &$form_state) {
$output = ''; // Isn't this line a duplication of the first $output above?
if ($edit['pid']) {
- $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {user} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
+ $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
':cid' => $edit['pid'],
':status' => COMMENT_PUBLISHED ))
->fetchObject();
diff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc
index 93e93e8b5..dd88ad514 100644
--- a/modules/comment/comment.pages.inc
+++ b/modules/comment/comment.pages.inc
@@ -15,7 +15,7 @@
*/
function comment_edit($cid) {
global $user;
- $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comment} c INNER JOIN {user} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid'=>$cid) )->fetchObject();
+ $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid'=>$cid) )->fetchObject();
$comment = drupal_unpack($comment);
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
@@ -69,7 +69,7 @@ function comment_reply($node, $pid = NULL) {
// $pid indicates that this is a reply to a comment.
if ($pid) {
// Load the comment whose cid = $pid
- $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {user} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
+ $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
':cid'=>$pid,
':status'=>COMMENT_PUBLISHED))->fetchObject();
if ( $comment ) {
diff --git a/modules/dblog/dblog.admin.inc b/modules/dblog/dblog.admin.inc
index 870c78c1c..921fb7c4d 100644
--- a/modules/dblog/dblog.admin.inc
+++ b/modules/dblog/dblog.admin.inc
@@ -63,7 +63,7 @@ function dblog_overview() {
array('data' => t('Operations')),
);
- $sql = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.variables, w.link, u.name FROM {watchdog} w INNER JOIN {user} u ON w.uid = u.uid";
+ $sql = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.variables, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid";
$tablesort = tablesort_sql($header);
if (!empty($filter['where'])) {
$result = pager_query($sql . " WHERE " . $filter['where'] . $tablesort, 50, 0, NULL, $filter['args']);
@@ -132,7 +132,7 @@ function dblog_top($type) {
function dblog_event($id) {
$severity = watchdog_severity_levels();
$output = '';
- $result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {user} u ON w.uid = u.uid WHERE w.wid = %d', $id);
+ $result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE w.wid = %d', $id);
if ($dblog = db_fetch_object($result)) {
$rows = array(
array(
diff --git a/modules/dblog/dblog.install b/modules/dblog/dblog.install
index 0d3e2e363..a1dbbf344 100644
--- a/modules/dblog/dblog.install
+++ b/modules/dblog/dblog.install
@@ -33,7 +33,7 @@ function dblog_schema() {
'type' => 'int',
'not null' => TRUE,
'default' => 0,
- 'description' => 'The {user}.uid of the user who triggered the event.',
+ 'description' => 'The {users}.uid of the user who triggered the event.',
),
'type' => array(
'type' => 'varchar',
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index ac25720ab..f9c6e00f5 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -613,7 +613,7 @@ function forum_get_forums($tid = 0) {
// This query does not use full ANSI syntax since MySQL 3.x does not support
// table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria
// used to join node_comment_statistics to users.
- $sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {user} u1 ON n.uid = u1.uid INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {user} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC";
+ $sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {users} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC";
$sql = db_rewrite_sql($sql);
$topic = db_fetch_object(db_query_range($sql, $forum->tid, 0, 1));
@@ -659,7 +659,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
}
}
- $sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {user} cu ON l.last_comment_uid = cu.uid INNER JOIN {taxonomy_term_node} r ON n.vid = r.vid INNER JOIN {user} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d");
+ $sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {taxonomy_term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d");
$sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,');
$sql .= ', n.created DESC'; // Always add a secondary sort order so that the news forum topics are on top.
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc
index e9cdeaa00..29005bb94 100644
--- a/modules/node/node.admin.inc
+++ b/modules/node/node.admin.inc
@@ -483,7 +483,7 @@ function node_admin_nodes() {
$filter = node_build_filter_query();
$sort = tablesort_sql($header, '', 'n.changed DESC');
- $result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n '. $filter['join'] .' INNER JOIN {user} u ON n.uid = u.uid '. $filter['where'] . $sort), 50, 0, NULL, $filter['args']);
+ $result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] . $sort), 50, 0, NULL, $filter['args']);
// Build the 'Update options' form.
$form['options'] = array(
diff --git a/modules/node/node.install b/modules/node/node.install
index 77063da92..d0867f328 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -43,7 +43,7 @@ function node_schema() {
'default' => '',
),
'uid' => array(
- 'description' => 'The {user}.uid that owns this node; initially, this is the user that created it.',
+ 'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
@@ -227,7 +227,7 @@ function node_schema() {
'not null' => TRUE,
),
'uid' => array(
- 'description' => 'The {user}.uid that created this version.',
+ 'description' => 'The {users}.uid that created this version.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
diff --git a/modules/node/node.module b/modules/node/node.module
index e601f2260..be76fd330 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -855,7 +855,7 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL
else {
$query->join('node_revision', 'r', 'r.vid = n.vid');
}
- $query->join('user', 'u', 'u.uid = n.uid');
+ $query->join('users', 'u', 'u.uid = n.uid');
// Add fields from the {node} table.
$node_fields = drupal_schema_fields_sql('node');
@@ -876,7 +876,7 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL
$query->addField('r', 'timestamp', 'revision_timestamp');
$query->fields('r', $node_revision_fields);
- // Add fields from the {user} table.
+ // Add fields from the {users} table.
$user_fields = array('name', 'picture', 'data');
$query->fields('u', $user_fields);
@@ -1865,7 +1865,7 @@ function node_last_changed($nid) {
*/
function node_revision_list($node) {
$revisions = array();
- $result = db_query('SELECT r.vid, r.title, r.log, r.uid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revision} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {user} u ON u.uid = r.uid WHERE r.nid = %d ORDER BY r.timestamp DESC', $node->nid);
+ $result = db_query('SELECT r.vid, r.title, r.log, r.uid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revision} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {users} u ON u.uid = r.uid WHERE r.nid = %d ORDER BY r.timestamp DESC', $node->nid);
while ($revision = db_fetch_object($result)) {
$revisions[$revision->vid] = $revision;
}
@@ -3019,22 +3019,22 @@ function node_save_action($node) {
*/
function node_assign_owner_action(&$node, $context) {
$node->uid = $context['owner_uid'];
- $owner_name = db_result(db_query("SELECT name FROM {user} WHERE uid = %d", $context['owner_uid']));
+ $owner_name = db_result(db_query("SELECT name FROM {users} WHERE uid = %d", $context['owner_uid']));
watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_get_types('type', $node), '%title' => $node->title, '%name' => $owner_name));
}
function node_assign_owner_action_form($context) {
$description = t('The username of the user to which you would like to assign ownership.');
- $count = db_result(db_query("SELECT COUNT(*) FROM {user}"));
+ $count = db_result(db_query("SELECT COUNT(*) FROM {users}"));
$owner_name = '';
if (isset($context['owner_uid'])) {
- $owner_name = db_result(db_query("SELECT name FROM {user} WHERE uid = %d", $context['owner_uid']));
+ $owner_name = db_result(db_query("SELECT name FROM {users} WHERE uid = %d", $context['owner_uid']));
}
// Use dropdown for fewer than 200 users; textbox for more than that.
if (intval($count) < 200) {
$options = array();
- $result = db_query("SELECT uid, name FROM {user} WHERE uid > 0 ORDER BY name");
+ $result = db_query("SELECT uid, name FROM {users} WHERE uid > 0 ORDER BY name");
while ($data = db_fetch_object($result)) {
$options[$data->name] = $data->name;
}
@@ -3061,7 +3061,7 @@ function node_assign_owner_action_form($context) {
}
function node_assign_owner_action_validate($form, $form_state) {
- $count = db_result(db_query("SELECT COUNT(*) FROM {user} WHERE name = '%s'", $form_state['values']['owner_name']));
+ $count = db_result(db_query("SELECT COUNT(*) FROM {users} WHERE name = '%s'", $form_state['values']['owner_name']));
if (intval($count) != 1) {
form_set_error('owner_name', t('Please enter a valid username.'));
}
@@ -3069,7 +3069,7 @@ function node_assign_owner_action_validate($form, $form_state) {
function node_assign_owner_action_submit($form, $form_state) {
// Username can change, so we need to store the ID, not the username.
- $uid = db_result(db_query("SELECT uid from {user} WHERE name = '%s'", $form_state['values']['owner_name']));
+ $uid = db_result(db_query("SELECT uid from {users} WHERE name = '%s'", $form_state['values']['owner_name']));
return array('owner_uid' => $uid);
}
diff --git a/modules/poll/poll.install b/modules/poll/poll.install
index e1bd72c60..04b7ad5a5 100644
--- a/modules/poll/poll.install
+++ b/modules/poll/poll.install
@@ -92,13 +92,13 @@ function poll_schema() {
);
$schema['poll_vote'] = array(
- 'description' => 'Stores per-{user} votes for each {poll}.',
+ 'description' => 'Stores per-{users} votes for each {poll}.',
'fields' => array(
'chid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
- 'description' => "The {user}'s vote for this poll.",
+ 'description' => "The {users}'s vote for this poll.",
),
'nid' => array(
'type' => 'int',
@@ -111,7 +111,7 @@ function poll_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
- 'description' => 'The {user}.uid this vote is from unless the voter was anonymous.',
+ 'description' => 'The {users}.uid this vote is from unless the voter was anonymous.',
),
'hostname' => array(
'type' => 'varchar',
diff --git a/modules/poll/poll.pages.inc b/modules/poll/poll.pages.inc
index c1e112f53..4851b9987 100644
--- a/modules/poll/poll.pages.inc
+++ b/modules/poll/poll.pages.inc
@@ -35,7 +35,7 @@ function poll_votes($node) {
$header[] = array('data' => t('Vote'), 'field' => 'pc.chtext');
$header[] = array('data' => t('Timestamp'), 'field' => 'pv.timestamp', 'sort' => 'desc');
- $result = pager_query("SELECT pv.chid, pv.uid, pv.hostname, pv.timestamp, pv.nid, pc.chtext, u.name FROM {poll_vote} pv INNER JOIN {poll_choice} pc ON pv.chid = pc.chid LEFT JOIN {user} u ON pv.uid = u.uid WHERE pv.nid = %d". tablesort_sql($header), 20, 0, NULL, $node->nid);
+ $result = pager_query("SELECT pv.chid, pv.uid, pv.hostname, pv.timestamp, pv.nid, pc.chtext, u.name FROM {poll_vote} pv INNER JOIN {poll_choice} pc ON pv.chid = pc.chid LEFT JOIN {users} u ON pv.uid = u.uid WHERE pv.nid = %d". tablesort_sql($header), 20, 0, NULL, $node->nid);
$rows = array();
while ($vote = db_fetch_object($result)) {
$rows[] = array(
diff --git a/modules/profile/profile.admin.inc b/modules/profile/profile.admin.inc
index b7ee8b2cf..e0252ce10 100644
--- a/modules/profile/profile.admin.inc
+++ b/modules/profile/profile.admin.inc
@@ -294,7 +294,7 @@ function profile_field_form_validate($form, &$form_state) {
form_set_error('name', t('The specified form name contains one or more illegal characters. Spaces or any other special characters except dash (-) and underscore (_) are not allowed.'));
}
- $users_table = drupal_get_schema('user');
+ $users_table = drupal_get_schema('users');
if (!empty($users_table['fields'][$form_state['values']['name']])) {
form_set_error('name', t('The specified form name is reserved for use by Drupal.'));
}
diff --git a/modules/profile/profile.install b/modules/profile/profile.install
index e081383e9..a4c1fd24f 100644
--- a/modules/profile/profile.install
+++ b/modules/profile/profile.install
@@ -132,7 +132,7 @@ function profile_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
- 'description' => 'The {user}.uid of the profile user.',
+ 'description' => 'The {users}.uid of the profile user.',
),
'value' => array(
'type' => 'text',
diff --git a/modules/profile/profile.pages.inc b/modules/profile/profile.pages.inc
index bd14dac85..9cb761a28 100644
--- a/modules/profile/profile.pages.inc
+++ b/modules/profile/profile.pages.inc
@@ -55,7 +55,7 @@ function profile_browse() {
}
// Extract the affected users:
- $result = pager_query("SELECT u.uid, u.access FROM {user} u INNER JOIN {profile_value} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments);
+ $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_value} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments);
$content = '';
while ($account = db_fetch_object($result)) {
@@ -88,7 +88,7 @@ function profile_browse() {
}
// Extract the affected users:
- $result = pager_query('SELECT uid, access FROM {user} WHERE uid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL);
+ $result = pager_query('SELECT uid, access FROM {users} WHERE uid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL);
$content = '';
while ($account = db_fetch_object($result)) {
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test
index c528360b4..eb355714b 100644
--- a/modules/simpletest/tests/database_test.test
+++ b/modules/simpletest/tests/database_test.test
@@ -2127,10 +2127,10 @@ class DatabaseTemporaryQueryTestCase extends DrupalWebTestCase {
// Now try to run two db_query_temporary() in the same request.
$table_name_system = db_query_temporary('SELECT status FROM {system}', array());
- $table_name_users = db_query_temporary('SELECT uid FROM {user}', array());
+ $table_name_users = db_query_temporary('SELECT uid FROM {users}', array());
$this->assertEqual($this->countTableRows($table_name_system), $this->countTableRows("system"), t('A temporary table was created successfully in this request.'));
- $this->assertEqual($this->countTableRows($table_name_users), $this->countTableRows("user"), t('A second temporary table was created successfully in this request.'));
+ $this->assertEqual($this->countTableRows($table_name_users), $this->countTableRows("users"), t('A second temporary table was created successfully in this request.'));
}
}
diff --git a/modules/statistics/statistics.admin.inc b/modules/statistics/statistics.admin.inc
index 763b453d4..d527ae4c8 100644
--- a/modules/statistics/statistics.admin.inc
+++ b/modules/statistics/statistics.admin.inc
@@ -17,7 +17,7 @@ function statistics_recent_hits() {
array('data' => t('Operations'))
);
- $sql = 'SELECT a.aid, a.path, a.title, a.uid, u.name, a.timestamp FROM {accesslog} a LEFT JOIN {user} u ON u.uid = a.uid' . tablesort_sql($header);
+ $sql = 'SELECT a.aid, a.path, a.title, a.uid, u.name, a.timestamp FROM {accesslog} a LEFT JOIN {users} u ON u.uid = a.uid' . tablesort_sql($header);
$result = pager_query($sql, 30);
$rows = array();
@@ -82,7 +82,7 @@ function statistics_top_visitors() {
array('data' => user_access('block IP addresses') ? t('Operations') : '', 'colspan' => 2),
);
- $sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, bl.iid FROM {accesslog} a LEFT JOIN {blocked_ips} bl ON a.hostname = bl.ip LEFT JOIN {user} u ON a.uid = u.uid GROUP BY a.hostname, a.uid, u.name, bl.iid" . tablesort_sql($header);
+ $sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, bl.iid FROM {accesslog} a LEFT JOIN {blocked_ips} bl ON a.hostname = bl.ip LEFT JOIN {users} u ON a.uid = u.uid GROUP BY a.hostname, a.uid, u.name, bl.iid" . tablesort_sql($header);
$sql_cnt = "SELECT COUNT(DISTINCT(CONCAT(CAST(uid AS char), hostname))) FROM {accesslog}";
$result = pager_query($sql, 30, 0, $sql_cnt);
@@ -138,7 +138,7 @@ function statistics_top_referrers() {
* Menu callback; Displays recent page accesses.
*/
function statistics_access_log($aid) {
- $result = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {user} u ON a.uid = u.uid WHERE aid = %d', $aid);
+ $result = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = %d', $aid);
if ($access = db_fetch_object($result)) {
$rows[] = array(
array('data' => t('URL'), 'header' => TRUE),
diff --git a/modules/statistics/statistics.install b/modules/statistics/statistics.install
index 9c140409e..e835cf317 100644
--- a/modules/statistics/statistics.install
+++ b/modules/statistics/statistics.install
@@ -91,7 +91,7 @@ function statistics_schema() {
'unsigned' => TRUE,
'not null' => FALSE,
'default' => 0,
- 'description' => 'User {user}.uid that visited the page.',
+ 'description' => 'User {users}.uid that visited the page.',
),
'timer' => array(
'type' => 'int',
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 63f3bb23b..edfba3994 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -232,7 +232,7 @@ function statistics_cron() {
*/
function statistics_title_list($dbfield, $dbrows) {
if (in_array($dbfield, array('totalcount', 'daycount', 'timestamp'))) {
- return db_query_range(db_rewrite_sql("SELECT n.nid, n.title, u.uid, u.name FROM {node} n INNER JOIN {node_counter} s ON n.nid = s.nid INNER JOIN {user} u ON n.uid = u.uid WHERE s." . $dbfield . " != 0 AND n.status = 1 ORDER BY s." . $dbfield . " DESC"), 0, $dbrows);
+ return db_query_range(db_rewrite_sql("SELECT n.nid, n.title, u.uid, u.name FROM {node} n INNER JOIN {node_counter} s ON n.nid = s.nid INNER JOIN {users} u ON n.uid = u.uid WHERE s." . $dbfield . " != 0 AND n.status = 1 ORDER BY s." . $dbfield . " DESC"), 0, $dbrows);
}
return FALSE;
}
diff --git a/modules/statistics/statistics.pages.inc b/modules/statistics/statistics.pages.inc
index 3b0fb4c4a..612a03f34 100644
--- a/modules/statistics/statistics.pages.inc
+++ b/modules/statistics/statistics.pages.inc
@@ -15,7 +15,7 @@ function statistics_node_tracker() {
array('data' => t('User'), 'field' => 'u.name'),
array('data' => t('Operations')));
- $result = pager_query('SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {user} u ON a.uid = u.uid WHERE a.path LIKE \'node/%d%%\'' . tablesort_sql($header), 30, 0, NULL, $node->nid);
+ $result = pager_query('SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE a.path LIKE \'node/%d%%\'' . tablesort_sql($header), 30, 0, NULL, $node->nid);
$rows = array();
while ($log = db_fetch_object($result)) {
$rows[] = array(
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 84a6bbb67..ecc15e3a8 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -1784,7 +1784,7 @@ function system_status($check = FALSE) {
}
// MySQL import might have set the uid of the anonymous user to autoincrement
// value. Let's try fixing it. See http://drupal.org/node/204411
- db_query("UPDATE {user} SET uid = uid - uid WHERE name = '' AND pass = '' AND status = 0");
+ db_query("UPDATE {users} SET uid = uid - uid WHERE name = '' AND pass = '' AND status = 0");
return theme('status_report', $requirements);
}
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index b13d848ef..63cdbe249 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -1423,7 +1423,7 @@ function hook_schema() {
*/
function hook_schema_alter(&$schema) {
// Add field to existing schema.
- $schema['user']['fields']['timezone_id'] = array(
+ $schema['users']['fields']['timezone_id'] = array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
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']++;
diff --git a/modules/tracker/tracker.pages.inc b/modules/tracker/tracker.pages.inc
index 3c74c244e..f5f702b75 100644
--- a/modules/tracker/tracker.pages.inc
+++ b/modules/tracker/tracker.pages.inc
@@ -22,14 +22,14 @@ function tracker_page($account = NULL, $set_title = FALSE) {
drupal_set_title($account->name);
}
// TODO: These queries are very expensive, see http://drupal.org/node/105639
- $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {user} u ON n.uid = u.uid LEFT JOIN {comment} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_updated DESC';
+ $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comment} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_updated DESC';
$sql = db_rewrite_sql($sql);
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comment} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d)';
$sql_count = db_rewrite_sql($sql_count);
$result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $account->uid, $account->uid);
}
else {
- $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {user} u ON n.uid = u.uid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 ORDER BY last_updated DESC';
+ $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 ORDER BY last_updated DESC';
$sql = db_rewrite_sql($sql);
$sql_count = 'SELECT COUNT(n.nid) FROM {node} n WHERE n.status = 1';
$sql_count = db_rewrite_sql($sql_count);
diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc
index 3ecda1749..ca4d4fdeb 100644
--- a/modules/user/user.admin.inc
+++ b/modules/user/user.admin.inc
@@ -144,9 +144,9 @@ function user_admin_account() {
t('Operations')
);
- $sql = 'SELECT DISTINCT u.uid, u.name, u.status, u.created, u.access FROM {user} u LEFT JOIN {user_role} ur ON u.uid = ur.uid ' . $filter['join'] . ' WHERE u.uid != 0 ' . $filter['where'];
+ $sql = 'SELECT DISTINCT u.uid, u.name, u.status, u.created, u.access FROM {users} u LEFT JOIN {users_roles} ur ON u.uid = ur.uid ' . $filter['join'] . ' WHERE u.uid != 0 ' . $filter['where'];
$sql .= tablesort_sql($header);
- $query_count = 'SELECT COUNT(DISTINCT u.uid) FROM {user} u LEFT JOIN {user_role} ur ON u.uid = ur.uid ' . $filter['join'] . ' WHERE u.uid != 0 ' . $filter['where'];
+ $query_count = 'SELECT COUNT(DISTINCT u.uid) FROM {users} u LEFT JOIN {users_roles} ur ON u.uid = ur.uid ' . $filter['join'] . ' WHERE u.uid != 0 ' . $filter['where'];
$result = pager_query($sql, 50, 0, $query_count, $filter['args']);
$form['options'] = array(
@@ -178,13 +178,13 @@ function user_admin_account() {
$accounts[$account->uid] = '';
$form['name'][$account->uid] = array('#markup' => theme('username', $account));
$form['status'][$account->uid] = array('#markup' => $status[$account->status]);
- $user_roles = array();
- $roles_result = db_query('SELECT rid FROM {user_role} WHERE uid = %d', $account->uid);
+ $users_roles = array();
+ $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = %d', $account->uid);
while ($user_role = db_fetch_object($roles_result)) {
- $user_roles[] = $roles[$user_role->rid];
+ $users_roles[] = $roles[$user_role->rid];
}
- asort($user_roles);
- $form['roles'][$account->uid][0] = array('#markup' => theme('item_list', $user_role));
+ asort($users_roles);
+ $form['roles'][$account->uid][0] = array('#markup' => theme('item_list', $users_roles));
$form['member_for'][$account->uid] = array('#markup' => format_interval(REQUEST_TIME - $account->created));
$form['last_access'][$account->uid] = array('#markup' => $account->access ? t('@time ago', array('@time' => format_interval(REQUEST_TIME - $account->access))) : t('never'));
$form['operations'][$account->uid] = array('#markup' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination)));
@@ -736,7 +736,7 @@ function user_admin_role_submit($form, &$form_state) {
db_query('DELETE FROM {role} WHERE rid = %d', $form_state['values']['rid']);
db_query('DELETE FROM {role_permission} WHERE rid = %d', $form_state['values']['rid']);
// Update the users who have this role set:
- db_query('DELETE FROM {user_role} WHERE rid = %d', $form_state['values']['rid']);
+ db_query('DELETE FROM {users_roles} WHERE rid = %d', $form_state['values']['rid']);
drupal_set_message(t('The role has been deleted.'));
}
diff --git a/modules/user/user.install b/modules/user/user.install
index 6c66fd21c..d172e8c6d 100644
--- a/modules/user/user.install
+++ b/modules/user/user.install
@@ -18,7 +18,7 @@ function user_schema() {
'type' => 'int',
'not null' => TRUE,
'default' => 0,
- 'description' => "User's {user}.uid.",
+ 'description' => "User's {users}.uid.",
),
'authname' => array(
'type' => 'varchar',
@@ -87,7 +87,7 @@ function user_schema() {
'primary key' => array('rid'),
);
- $schema['user'] = array(
+ $schema['users'] = array(
'description' => 'Stores user data.',
'fields' => array(
'uid' => array(
@@ -201,7 +201,7 @@ function user_schema() {
'primary key' => array('uid'),
);
- $schema['user_role'] = array(
+ $schema['users_roles'] = array(
'description' => 'Maps users to roles.',
'fields' => array(
'uid' => array(
@@ -209,7 +209,7 @@ function user_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
- 'description' => 'Primary Key: {user}.uid for user.',
+ 'description' => 'Primary Key: {users}.uid for user.',
),
'rid' => array(
'type' => 'int',
@@ -245,9 +245,9 @@ function user_update_7000(&$sandbox) {
$hash_count_log2 = 11;
// Multi-part update.
if (!isset($sandbox['user_from'])) {
- db_change_field($ret, 'user', 'pass', 'pass', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''));
+ db_change_field($ret, 'users', 'pass', 'pass', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''));
$sandbox['user_from'] = 0;
- $sandbox['user_count'] = db_result(db_query("SELECT COUNT(uid) FROM {user}"));
+ $sandbox['user_count'] = db_result(db_query("SELECT COUNT(uid) FROM {users}"));
}
else {
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
@@ -255,37 +255,37 @@ function user_update_7000(&$sandbox) {
$has_rows = FALSE;
// Update this many per page load.
$count = 1000;
- $result = db_query_range("SELECT uid, pass FROM {user} WHERE uid > 0 ORDER BY uid", $sandbox['user_from'], $count);
+ $result = db_query_range("SELECT uid, pass FROM {users} WHERE uid > 0 ORDER BY uid", $sandbox['user_from'], $count);
while ($account = db_fetch_array($result)) {
$has_rows = TRUE;
$new_hash = user_hash_password($account['pass'], $hash_count_log2);
if ($new_hash) {
// Indicate an updated password.
$new_hash = 'U' . $new_hash;
- db_query("UPDATE {user} SET pass = '%s' WHERE uid = %d", $new_hash, $account['uid']);
+ db_query("UPDATE {users} SET pass = '%s' WHERE uid = %d", $new_hash, $account['uid']);
}
}
$ret['#finished'] = $sandbox['user_from']/$sandbox['user_count'];
$sandbox['user_from'] += $count;
if (!$has_rows) {
$ret['#finished'] = 1;
- $ret[] = array('success' => TRUE, 'query' => "UPDATE {user} SET pass = 'U' . user_hash_password(pass) WHERE uid > 0");
+ $ret[] = array('success' => TRUE, 'query' => "UPDATE {users} SET pass = 'U' . user_hash_password(pass) WHERE uid > 0");
}
}
return $ret;
}
/**
- * Remove the 'threshold', 'mode' and 'sort' columns from the {user} table.
+ * Remove the 'threshold', 'mode' and 'sort' columns from the {users} table.
*
* These fields were previously used to store per-user comment settings.
*/
function user_update_7001() {
$ret = array();
- db_drop_field($ret, 'user', 'threshold');
- db_drop_field($ret, 'user', 'mode');
- db_drop_field($ret, 'user', 'sort');
+ db_drop_field($ret, 'users', 'threshold');
+ db_drop_field($ret, 'users', 'mode');
+ db_drop_field($ret, 'users', 'sort');
return $ret;
}
@@ -298,25 +298,25 @@ function user_update_7002(&$sandbox) {
// Multi-part update.
if (!isset($sandbox['user_from'])) {
- db_change_field($ret, 'user', 'timezone', 'timezone', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE));
+ db_change_field($ret, 'users', 'timezone', 'timezone', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE));
$sandbox['user_from'] = 0;
- $sandbox['user_count'] = db_result(db_query("SELECT COUNT(uid) FROM {user}"));
+ $sandbox['user_count'] = db_result(db_query("SELECT COUNT(uid) FROM {users}"));
$sandbox['user_not_migrated'] = 0;
}
else {
$timezones = system_time_zones();
// Update this many per page load.
$count = 10000;
- $contributed_date_module = db_column_exists('user', 'timezone_name');
- $contributed_event_module = db_column_exists('user', 'timezone_id');
+ $contributed_date_module = db_column_exists('users', 'timezone_name');
+ $contributed_event_module = db_column_exists('users', 'timezone_id');
- $results = db_query_range("SELECT uid FROM {user} ORDER BY uid", array(), $sandbox['user_from'], $count);
+ $results = db_query_range("SELECT uid FROM {users} ORDER BY uid", array(), $sandbox['user_from'], $count);
foreach ($results as $account) {
$timezone = NULL;
- // If the contributed Date module has created a user.timezone_name
+ // If the contributed Date module has created a users.timezone_name
// column, use this data to set each user's time zone.
if ($contributed_date_module) {
- $date_timezone = db_query("SELECT timezone_name FROM {user} WHERE uid = :uid", array(':uid' => $account->uid))->fetchField();
+ $date_timezone = db_query("SELECT timezone_name FROM {users} WHERE uid = :uid", array(':uid' => $account->uid))->fetchField();
if (isset($timezones[$date_timezone])) {
$timezone = $date_timezone;
}
@@ -325,7 +325,7 @@ function user_update_7002(&$sandbox) {
// use that information to update the user accounts.
if (!$timezone && $contributed_event_module) {
try {
- $event_timezone = db_query("SELECT t.name FROM {user} u LEFT JOIN {event_timezones} t ON u.timezone_id = t.timezone WHERE u.uid = :uid", array(':uid' => $account->uid))->fetchField();
+ $event_timezone = db_query("SELECT t.name FROM {users} u LEFT JOIN {event_timezones} t ON u.timezone_id = t.timezone WHERE u.uid = :uid", array(':uid' => $account->uid))->fetchField();
$event_timezone = str_replace(' ', '_', $event_timezone);
if (isset($timezones[$event_timezone])) {
$timezone = $event_timezone;
@@ -337,11 +337,11 @@ function user_update_7002(&$sandbox) {
}
}
if ($timezone) {
- db_query("UPDATE {user} SET timezone = :timezone WHERE uid = :uid", array(':timezone' => $timezone, ':uid' => $account->uid));
+ db_query("UPDATE {users} SET timezone = :timezone WHERE uid = :uid", array(':timezone' => $timezone, ':uid' => $account->uid));
}
else {
$sandbox['user_not_migrated']++;
- db_query("UPDATE {user} SET timezone = NULL WHERE uid = :uid", array(':uid' => $account->uid));
+ db_query("UPDATE {users} SET timezone = NULL WHERE uid = :uid", array(':uid' => $account->uid));
}
$sandbox['user_from']++;
}
@@ -402,21 +402,21 @@ function user_update_7004(&$sandbox) {
if (!isset($sandbox['progress'])) {
// Check that the field hasn't been updated in an aborted run of this
// update.
- if (!db_column_exists('user', 'picture_fid')) {
+ if (!db_column_exists('users', 'picture_fid')) {
// Add a new field for the fid.
- db_add_field($ret, 'user', 'picture_fid', $picture_field);
+ db_add_field($ret, 'users', 'picture_fid', $picture_field);
}
// Initialize batch update information.
$sandbox['progress'] = 0;
$sandbox['last_user_processed'] = -1;
- $sandbox['max'] = db_query("SELECT COUNT(*) FROM {user} WHERE picture <> ''")->fetchField();
+ $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE picture <> ''")->fetchField();
}
// As a batch operation move the photos into the {files} table and update the
- // {user} records.
+ // {users} records.
$limit = 500;
- $result = db_query_range("SELECT uid, picture FROM {user} WHERE picture <> '' AND uid > :uid ORDER BY uid", array(':uid' => $sandbox['last_user_processed']), 0, $limit);
+ $result = db_query_range("SELECT uid, picture FROM {users} WHERE picture <> '' AND uid > :uid ORDER BY uid", array(':uid' => $sandbox['last_user_processed']), 0, $limit);
foreach ($result as $user) {
// Don't bother adding files that don't exist.
if (!file_exists($user->picture)) {
@@ -439,7 +439,7 @@ function user_update_7004(&$sandbox) {
$file = file_save($file);
}
- db_update('user')
+ db_update('users')
->fields(array('picture_fid' => $file->fid))
->condition('uid', $user->uid)
->execute();
@@ -456,8 +456,8 @@ function user_update_7004(&$sandbox) {
// When we're finished, drop the old picture field and rename the new one to
// replace it.
if (isset($ret['#finished']) && $ret['#finished'] == 1) {
- db_drop_field($ret, 'user', 'picture');
- db_change_field($ret, 'user', 'picture_fid', 'picture', $picture_field);
+ db_drop_field($ret, 'users', 'picture');
+ db_change_field($ret, 'users', 'picture_fid', 'picture', $picture_field);
}
return $ret;
diff --git a/modules/user/user.module b/modules/user/user.module
index 015facca2..edd21ebdc 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -196,7 +196,7 @@ function user_load($array = array()) {
$params[] = $value;
}
}
- $result = db_query('SELECT * FROM {user} u WHERE ' . implode(' AND ', $query), $params);
+ $result = db_query('SELECT * FROM {users} u WHERE ' . implode(' AND ', $query), $params);
if ($user = db_fetch_object($result)) {
$user = drupal_unpack($user);
@@ -208,7 +208,7 @@ function user_load($array = array()) {
else {
$user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user';
}
- $result = db_query('SELECT r.rid, r.name FROM {role} r INNER JOIN {user_role} ur ON ur.rid = r.rid WHERE ur.uid = %d', $user->uid);
+ $result = db_query('SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $user->uid);
while ($role = db_fetch_object($result)) {
$user->roles[$role->rid] = $role->name;
}
@@ -254,7 +254,7 @@ function user_load($array = array()) {
* A fully-loaded $user object upon successful save or FALSE if the save failed.
*/
function user_save($account, $edit = array(), $category = 'account') {
- $table = drupal_get_schema('user');
+ $table = drupal_get_schema('users');
$user_fields = $table['fields'];
if (!empty($edit['pass'])) {
@@ -285,7 +285,7 @@ function user_save($account, $edit = array(), $category = 'account') {
if (is_object($account) && $account->uid) {
user_module_invoke('update', $edit, $account, $category);
- $data = unserialize(db_result(db_query('SELECT data FROM {user} WHERE uid = %d', $account->uid)));
+ $data = unserialize(db_result(db_query('SELECT data FROM {users} WHERE uid = %d', $account->uid)));
// Consider users edited by an administrator as logged in, if they haven't
// already, so anonymous users can view the profile (if allowed).
if (empty($edit['access']) && empty($account->access) && user_access('administer users')) {
@@ -293,7 +293,7 @@ function user_save($account, $edit = array(), $category = 'account') {
}
foreach ($edit as $key => $value) {
// Form fields that don't pertain to the users, user_roles, or
- // Field API are automatically serialized into the user.data
+ // Field API are automatically serialized into the users.data
// column.
if ($key != 'roles' && empty($user_fields[$key]) && empty($field_form[$key])) {
if ($value === NULL) {
@@ -325,7 +325,7 @@ function user_save($account, $edit = array(), $category = 'account') {
$edit['data'] = $data;
$edit['uid'] = $account->uid;
// Save changes to the user table.
- $success = drupal_write_record('user', $edit, 'uid');
+ $success = drupal_write_record('users', $edit, 'uid');
if (!$success) {
// The query failed - better to abort the save than risk further
// data loss.
@@ -333,12 +333,12 @@ function user_save($account, $edit = array(), $category = 'account') {
// TODO: Fields change: I think this is a bug. If no columns in
// the user table are changed, drupal_write_record returns
// FALSE because rowCount() (rows changed) is 0. However,
- // non-user data may have been changed, e.g. fields.
+ // non-users data may have been changed, e.g. fields.
// return FALSE;
}
// If the picture changed or was unset, remove the old one. This step needs
- // to occur after updating the {user} record so that user_file_references()
+ // to occur after updating the {users} record so that user_file_references()
// doesn't report it in use and block the deletion.
if (!empty($account->picture->fid) && ($edit['picture'] != $account->picture->fid)) {
file_delete($account->picture);
@@ -346,11 +346,11 @@ function user_save($account, $edit = array(), $category = 'account') {
// Reload user roles if provided.
if (isset($edit['roles']) && is_array($edit['roles'])) {
- db_query('DELETE FROM {user_role} WHERE uid = %d', $account->uid);
+ db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid);
foreach (array_keys($edit['roles']) as $rid) {
if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) {
- db_query('INSERT INTO {user_role} (uid, rid) VALUES (%d, %d)', $account->uid, $rid);
+ db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $account->uid, $rid);
}
}
}
@@ -396,7 +396,7 @@ function user_save($account, $edit = array(), $category = 'account') {
$edit['access'] = REQUEST_TIME;
}
- $success = drupal_write_record('user', $edit);
+ $success = drupal_write_record('users', $edit);
if (!$success) {
// On a failed INSERT some other existing user's uid may be returned.
// We must abort to avoid overwriting their account.
@@ -415,7 +415,7 @@ function user_save($account, $edit = array(), $category = 'account') {
// fields from being saved there.
$data = array();
foreach ($edit as $key => $value) {
- // Form fields that don't pertain to the user, user_roles, or
+ // Form fields that don't pertain to the users, user_roles, or
// Field API are automatically serialized into the user.data
// column.
if (($key != 'roles') && (empty($user_fields[$key]) && empty($field_form[$key])) && ($value !== NULL)) {
@@ -424,15 +424,15 @@ function user_save($account, $edit = array(), $category = 'account') {
}
if (!empty($data)) {
$data_array = array('uid' => $user->uid, 'data' => $data);
- drupal_write_record('user', $data_array, 'uid');
+ drupal_write_record('users', $data_array, 'uid');
}
// Save user roles (delete just to be safe).
if (isset($edit['roles']) && is_array($edit['roles'])) {
- db_query('DELETE FROM {user_role} WHERE uid = %d', $edit['uid']);
+ db_query('DELETE FROM {users_roles} WHERE uid = %d', $edit['uid']);
foreach (array_keys($edit['roles']) as $rid) {
if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) {
- db_query('INSERT INTO {user_role} (uid, rid) VALUES (%d, %d)', $edit['uid'], $rid);
+ db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $edit['uid'], $rid);
}
}
}
@@ -644,7 +644,7 @@ function user_access($string, $account = NULL, $reset = FALSE) {
* @return boolean TRUE for blocked users, FALSE for active.
*/
function user_is_blocked($name) {
- $deny = db_fetch_object(db_query("SELECT name FROM {user} WHERE status = 0 AND name = LOWER('%s')", $name));
+ $deny = db_fetch_object(db_query("SELECT name FROM {users} WHERE status = 0 AND name = LOWER('%s')", $name));
return $deny;
}
@@ -698,7 +698,7 @@ function user_file_download($filepath) {
*/
function user_file_references($file) {
// Determine if the file is used by this module.
- $count = db_query('SELECT COUNT(*) FROM {user} WHERE picture = :fid', array(':fid' => $file->fid))->fetchField();
+ $count = db_query('SELECT COUNT(*) FROM {users} WHERE picture = :fid', array(':fid' => $file->fid))->fetchField();
if ($count) {
// Return the name of the module and how many references it has to the file.
return array('user' => $count);
@@ -710,7 +710,7 @@ function user_file_references($file) {
*/
function user_file_delete($file) {
// Remove any references to the file.
- db_update('user')
+ db_update('users')
->fields(array('picture' => 0))
->condition('picture', $file->fid)
->execute();
@@ -732,13 +732,13 @@ function user_search($op = 'search', $keys = NULL, $skip_access_check = FALSE) {
$keys = preg_replace('!\*+!', '%', $keys);
if (user_access('administer users')) {
// Administrators can also search in the otherwise private email field.
- $result = pager_query("SELECT name, uid, mail FROM {user} WHERE LOWER(name) LIKE LOWER('%%%s%%') OR LOWER(mail) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys, $keys);
+ $result = pager_query("SELECT name, uid, mail FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%') OR LOWER(mail) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys, $keys);
while ($account = db_fetch_object($result)) {
$find[] = array('title' => $account->name . ' (' . $account->mail . ')', 'link' => url('user/' . $account->uid, array('absolute' => TRUE)));
}
}
else {
- $result = pager_query("SELECT name, uid FROM {user} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys);
+ $result = pager_query("SELECT name, uid FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys);
while ($account = db_fetch_object($result)) {
$find[] = array('title' => $account->name, 'link' => url('user/' . $account->uid, array('absolute' => TRUE)));
}
@@ -807,7 +807,7 @@ function user_user_validate(&$edit, &$account, $category = NULL) {
if ($error = user_validate_name($edit['name'])) {
form_set_error('name', $error);
}
- elseif (db_result(db_query("SELECT COUNT(*) FROM {user} WHERE uid != %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) {
+ elseif (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) {
form_set_error('name', t('The name %name is already taken.', array('%name' => $edit['name'])));
}
}
@@ -816,7 +816,7 @@ function user_user_validate(&$edit, &$account, $category = NULL) {
if ($error = user_validate_mail($edit['mail'])) {
form_set_error('mail', $error);
}
- elseif (db_result(db_query("SELECT COUNT(*) FROM {user} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
+ elseif (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
// Format error message dependent on whether the user is logged in or not.
if ($GLOBALS['user']->uid) {
form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => $edit['mail'])));
@@ -982,7 +982,7 @@ function user_block_view($delta = '') {
case 'new':
if (user_access('access content')) {
// Retrieve a list of new users who have subsequently accessed the site successfully.
- $items = db_query_range('SELECT uid, name FROM {user} WHERE status != 0 AND access != 0 ORDER BY created DESC', array(), 0, variable_get('user_block_whois_new_count', 5))->fetchAll();
+ $items = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', array(), 0, variable_get('user_block_whois_new_count', 5))->fetchAll();
$output = theme('user_list', $items);
$block['subject'] = t('Who\'s new');
@@ -1018,7 +1018,7 @@ function user_block_view($delta = '') {
// Display a list of currently online users.
$max_users = variable_get('user_block_max_list_count', 10);
if ($authenticated_count && $max_users) {
- $items = db_query_range('SELECT u.uid, u.name, MAX(s.timestamp) AS max_timestamp FROM {user} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.timestamp >= :interval AND s.uid > 0 GROUP BY u.uid, u.name ORDER BY max_timestamp DESC', array(':interval' => $interval), 0, $max_users)->fetchAll();
+ $items = db_query_range('SELECT u.uid, u.name, MAX(s.timestamp) AS max_timestamp FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.timestamp >= :interval AND s.uid > 0 GROUP BY u.uid, u.name ORDER BY max_timestamp DESC', array(':interval' => $interval), 0, $max_users)->fetchAll();
$output .= theme('user_list', $items, t('Online users'));
}
@@ -1044,7 +1044,7 @@ function template_preprocess_user_picture(&$variables) {
$account = $variables['account'];
if (!empty($account->picture)) {
// @TODO: Ideally this function would only be passed file objects, but
- // since there's a lot of legacy code that JOINs the {user} table to
+ // since there's a lot of legacy code that JOINs the {users} table to
// {node} or {comments} and passes the results into this function if we
// a numeric value in the picture field we'll assume it's a file id
// and load it for them. Once we've got user_load_multiple() and
@@ -1543,7 +1543,7 @@ function user_authenticate($form_values = array()) {
$password = trim($form_values['pass']);
// Name and pass keys are required.
if (!empty($form_values['name']) && !empty($password)) {
- $account = db_fetch_object(db_query("SELECT * FROM {user} WHERE name = '%s' AND status = 1", $form_values['name']));
+ $account = db_fetch_object(db_query("SELECT * FROM {users} WHERE name = '%s' AND status = 1", $form_values['name']));
if ($account) {
// Allow alternate password hashing schemes.
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
@@ -1551,7 +1551,7 @@ function user_authenticate($form_values = array()) {
if (user_needs_new_hash($account)) {
$new_hash = user_hash_password($password);
if ($new_hash) {
- db_query("UPDATE {user} SET pass = '%s' WHERE uid = %d", $new_hash, $account->uid);
+ db_query("UPDATE {users} SET pass = '%s' WHERE uid = %d", $new_hash, $account->uid);
}
}
$account = user_load(array('uid' => $account->uid, 'status' => 1));
@@ -1578,7 +1578,7 @@ function user_authenticate_finalize(&$edit) {
// Update the user table timestamp noting user has logged in.
// This is also used to invalidate one-time login links.
$user->login = REQUEST_TIME;
- db_query("UPDATE {user} SET login = %d WHERE uid = %d", $user->login, $user->uid);
+ db_query("UPDATE {users} SET login = %d WHERE uid = %d", $user->login, $user->uid);
// Regenerate the session ID to prevent against session fixation attacks.
// This is called before hook_user in case one of those functions fails
// or incorrectly does a redirect which would leave the old session in place.
@@ -1849,7 +1849,7 @@ function _user_cancel($edit, $account, $method) {
if (!empty($edit['user_cancel_notify'])) {
_user_mail_notify('status_blocked', $account);
}
- db_update('user')->fields(array('status' => 0))->condition('uid', $account->uid)->execute();
+ db_update('users')->fields(array('status' => 0))->condition('uid', $account->uid)->execute();
drupal_set_message(t('%name has been disabled.', array('%name' => $account->name)));
watchdog('user', 'Blocked user: %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE);
break;
@@ -1860,8 +1860,8 @@ function _user_cancel($edit, $account, $method) {
if (!empty($edit['user_cancel_notify'])) {
_user_mail_notify('status_canceled', $account);
}
- db_delete('user')->condition('uid', $account->uid)->execute();
- db_delete('user_role')->condition('uid', $account->uid)->execute();
+ db_delete('users')->condition('uid', $account->uid)->execute();
+ db_delete('users_roles')->condition('uid', $account->uid)->execute();
db_delete('authmap')->condition('uid', $account->uid)->execute();
drupal_set_message(t('%name has been deleted.', array('%name' => $account->name)));
watchdog('user', 'Deleted user: %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE);
@@ -2169,7 +2169,7 @@ function user_multiple_cancel_confirm(&$form_state) {
$form['accounts'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
// array_filter() returns only elements with TRUE values.
foreach (array_filter($edit['accounts']) as $uid => $value) {
- $user = db_result(db_query('SELECT name FROM {user} WHERE uid = %d', $uid));
+ $user = db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $uid));
$form['accounts'][$uid] = array('#type' => 'hidden', '#value' => $uid, '#prefix' => '<li>', '#suffix' => check_plain($user) . "</li>\n");
}
@@ -2595,7 +2595,7 @@ function user_block_user_action(&$object, $context = array()) {
global $user;
$uid = $user->uid;
}
- db_query("UPDATE {user} SET status = 0 WHERE uid = %d", $uid);
+ db_query("UPDATE {users} SET status = 0 WHERE uid = %d", $uid);
drupal_session_destroy_uid($uid);
watchdog('action', 'Blocked user %name.', array('%name' => $user->name));
}
diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc
index c96a75251..581ac683a 100644
--- a/modules/user/user.pages.inc
+++ b/modules/user/user.pages.inc
@@ -12,7 +12,7 @@
function user_autocomplete($string = '') {
$matches = array();
if ($string) {
- $result = db_query_range("SELECT name FROM {user} WHERE LOWER(name) LIKE LOWER(:name)", array(':name' => $string .'%'), 0, 10);
+ $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER(:name)", array(':name' => $string .'%'), 0, 10);
while ($user = db_fetch_object($result)) {
$matches[$user->name] = check_plain($user->name);
}
diff --git a/scripts/password-hash.sh b/scripts/password-hash.sh
index 83fe2f148..12e939983 100755
--- a/scripts/password-hash.sh
+++ b/scripts/password-hash.sh
@@ -52,7 +52,7 @@ All arguments are long options.
"<password1>" ["<password2>" ["<password3>" ...]]
One or more plan-text passwords enclosed by double quotes. The
- output hash may be manually entered into the {user}.pass field to
+ output hash may be manually entered into the {users}.pass field to
change a password via SQL to a known value.
To run this script without the --root argument invoke it from the root directory
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index 97162b765..7f03b3a9d 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -124,7 +124,7 @@
*
* $db_prefix = array(
* 'default' => 'main_',
- * 'user' => 'shared_',
+ * 'users' => 'shared_',
* 'sessions' => 'shared_',
* 'role' => 'shared_',
* 'authmap' => 'shared_',
diff --git a/update.php b/update.php
index 15e8bafa4..215727314 100644
--- a/update.php
+++ b/update.php
@@ -592,7 +592,6 @@ function update_prepare_d7_bootstrap() {
drupal_install_init_database();
spl_autoload_unregister('drupal_autoload_class');
spl_autoload_unregister('drupal_autoload_interface');
- update_prepare_d7_bootstrap_rename();
// The new {blocked_ips} table is used in Drupal 7 to store a list of
// banned IP addresses. If this table doesn't exist then we are still
// running on a Drupal 6 database, so suppress the unavoidable errors
@@ -608,23 +607,6 @@ function update_prepare_d7_bootstrap() {
}
/**
- * Rename tables:
- * - {users} to {user}
- * - {users_roles} to {user_role}
- * - {sessions} to {session}
- */
-function update_prepare_d7_bootstrap_rename() {
- $ret = array();
-
- if (db_table_exists('users')) {
- db_rename_table($ret, 'users', 'user');
- db_rename_table($ret, 'users_roles', 'user_role');
- }
-
- return $ret;
-}
-
-/**
* Add the update task list to the current page.
*/
function update_task_list($active = NULL) {