Index: update.php =================================================================== RCS file: /cvs/drupal/drupal/update.php,v retrieving revision 1.266 diff -u -p -r1.266 update.php --- update.php 20 Nov 2008 07:07:59 -0000 1.266 +++ update.php 24 Nov 2008 10:02:19 -0000 @@ -696,7 +696,7 @@ drupal_maintenance_theme(); ini_set('display_errors', TRUE); // Access check: -if (!empty($update_free_access) || $user->uid == 1) { +if (!empty($update_free_access) || $user->userid == 1) { include_once DRUPAL_ROOT . '/includes/install.inc'; include_once DRUPAL_ROOT . '/includes/batch.inc'; Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.253 diff -u -p -r1.253 bootstrap.inc --- includes/bootstrap.inc 24 Nov 2008 06:17:40 -0000 1.253 +++ includes/bootstrap.inc 24 Nov 2008 10:02:19 -0000 @@ -662,7 +662,7 @@ function page_get_cache() { $cache = NULL; - if (!$user->uid && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') && count(drupal_set_message()) == 0) { + if (!$user->userid && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') && count(drupal_set_message()) == 0) { $cache = cache_get($base_root . request_uri(), 'cache_page'); if (empty($cache)) { @@ -1040,7 +1040,7 @@ function drupal_is_denied($ip) { */ function drupal_anonymous_user($session = '') { $user = new stdClass(); - $user->uid = 0; + $user->userid = 0; $user->hostname = ip_address(); $user->roles = array(); $user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user'; Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.831 diff -u -p -r1.831 common.inc --- includes/common.inc 23 Nov 2008 16:54:47 -0000 1.831 +++ includes/common.inc 24 Nov 2008 10:02:20 -0000 @@ -881,7 +881,7 @@ function fix_gpc_magic() { * - !variable, which indicates that the text should be inserted as-is. This is * useful for inserting variables into things like e-mail. * @code - * $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", array('absolute' => TRUE)))); + * $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->userid", array('absolute' => TRUE)))); * @endcode * * - @variable, which indicates that the text should be run through check_plain, @@ -1364,7 +1364,7 @@ function format_date($timestamp, $type = static $timezones = array(); if (!isset($timezone)) { global $user; - if (variable_get('configurable_timezones', 1) && $user->uid && $user->timezone) { + if (variable_get('configurable_timezones', 1) && $user->userid && $user->timezone) { $timezone = $user->timezone; } else { @@ -2731,7 +2731,7 @@ function drupal_get_token($value = '') { */ function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) { global $user; - return (($skip_anonymous && $user->uid == 0) || ($token == md5(session_id() . $value . variable_get('drupal_private_key', '')))); + return (($skip_anonymous && $user->userid == 0) || ($token == md5(session_id() . $value . variable_get('drupal_private_key', '')))); } /** @@ -2815,7 +2815,7 @@ function _drupal_bootstrap_full() { function page_set_cache() { global $user, $base_root; - if (!$user->uid && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') && count(drupal_get_messages(NULL, FALSE)) == 0) { + if (!$user->userid && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') && count(drupal_get_messages(NULL, FALSE)) == 0) { // This will fail in some cases, see page_get_cache() for the explanation. if ($data = ob_get_contents()) { $cache = TRUE; Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.145 diff -u -p -r1.145 file.inc --- includes/file.inc 16 Nov 2008 19:41:14 -0000 1.145 +++ includes/file.inc 24 Nov 2008 10:02:20 -0000 @@ -13,7 +13,7 @@ * * Fields on the file object: * - fid - File ID - * - uid - The {users}.uid of the user who is associated with the file. + * - userid - The {users}.userid 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. @@ -760,7 +760,7 @@ function file_unmanaged_delete($path) { /** * Determine total disk space used by a single user or the whole filesystem. * - * @param $uid + * @param $userid * Optional. A user id, specifying NULL returns the total space used by all * non-temporary files. * @param $status @@ -769,9 +769,9 @@ function file_unmanaged_delete($path) { * @return * An integer containing the number of bytes used. */ -function file_space_used($uid = NULL, $status = FILE_STATUS_PERMANENT) { - if (!is_null($uid)) { - return db_query('SELECT SUM(filesize) FROM {files} WHERE uid = :uid AND status & :status', array(':uid' => $uid, ':status' => $status))->fetchField(); +function file_space_used($userid = NULL, $status = FILE_STATUS_PERMANENT) { + if (!is_null($userid)) { + return db_query('SELECT SUM(filesize) FROM {files} WHERE userid = :userid AND status & :status', array(':userid' => $userid, ':status' => $status))->fetchField(); } return db_query('SELECT SUM(filesize) FROM {files} WHERE status & :status', array(':status' => $status))->fetchField(); } @@ -848,7 +848,7 @@ function file_save_upload($source, $vali // Begin building file object. $file = new stdClass(); - $file->uid = $user->uid; + $file->userid = $user->userid; $file->status = FILE_STATUS_TEMPORARY; $file->filename = file_munge_filename(trim(basename($_FILES['files']['name'][$source]), '.'), $extensions); $file->filepath = $_FILES['files']['tmp_name'][$source]; @@ -1009,13 +1009,13 @@ function file_validate_size($file, $file $errors = array(); - // Bypass validation for uid = 1. - if ($user->uid != 1) { + // Bypass validation for userid = 1. + if ($user->userid != 1) { if ($file_limit && $file->filesize > $file_limit) { $errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit))); } - if ($user_limit && (file_space_used($user->uid) + $file->filesize) > $user_limit) { + if ($user_limit && (file_space_used($user->userid) + $file->filesize) > $user_limit) { $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit))); } } @@ -1132,7 +1132,7 @@ function file_save_data($data, $destinat $file->filepath = $filepath; $file->filename = basename($file->filepath); $file->filemime = file_get_mimetype($file->filepath); - $file->uid = $user->uid; + $file->userid = $user->userid; $file->status = FILE_STATUS_PERMANENT; return file_save($file); } Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.307 diff -u -p -r1.307 form.inc --- includes/form.inc 24 Nov 2008 00:40:44 -0000 1.307 +++ includes/form.inc 24 Nov 2008 10:02:21 -0000 @@ -222,7 +222,7 @@ function form_get_cache($form_build_id, if ($cached = cache_get('form_' . $form_build_id, 'cache_form')) { $form = $cached->data; global $user; - if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && !$user->uid)) { + if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && !$user->userid)) { if ($cached = cache_get('storage_' . $form_build_id, 'cache_form')) { $form_state['storage'] = $cached->data; } @@ -238,7 +238,7 @@ function form_set_cache($form_build_id, // 6 hours cache life time for forms should be plenty. $expire = 21600; global $user; - if ($user->uid) { + if ($user->userid) { $form['#cache_token'] = drupal_get_token(); } cache_set('form_' . $form_build_id, $form, 'cache_form', REQUEST_TIME + $expire); @@ -481,14 +481,14 @@ function drupal_prepare_form($form_id, & // requested previously by the user and protects against cross site request // forgeries. if (isset($form['#token'])) { - if ($form['#token'] === FALSE || $user->uid == 0 || $form['#programmed']) { + if ($form['#token'] === FALSE || $user->userid == 0 || $form['#programmed']) { unset($form['#token']); } else { $form['form_token'] = array('#type' => 'token', '#default_value' => drupal_get_token($form['#token'])); } } - elseif (isset($user->uid) && $user->uid && !$form['#programmed']) { + elseif (isset($user->userid) && $user->userid && !$form['#programmed']) { $form['#token'] = $form_id; $form['form_token'] = array( '#id' => form_clean_id('edit-' . $form_id . '-form-token'), @@ -2401,7 +2401,7 @@ function form_clean_id($id = NULL, $flus * $batch = array( * 'title' => t('Exporting'), * 'operations' => array( - * array('my_function_1', array($account->uid, 'story')), + * array('my_function_1', array($account->userid, 'story')), * array('my_function_2', array()), * ), * 'finished' => 'my_finished_callback', @@ -2419,7 +2419,7 @@ function form_clean_id($id = NULL, $flus * Sample batch operations: * @code * // Simple and artificial: load a node of a given type for a given user - * function my_function_1($uid, $type, &$context) { + * function my_function_1($userid, $type, &$context) { * // The $context array gathers batch context information about the execution (read), * // as well as 'return values' for the current operation (write) * // The following keys are provided : @@ -2436,7 +2436,7 @@ function form_clean_id($id = NULL, $flus * // 1 (or no value explicitly set) means the operation is finished * // and the batch processing can continue to the next operation. * - * $node = node_load(array('uid' => $uid, 'type' => $type)); + * $node = node_load(array('userid' => $userid, 'type' => $type)); * $context['results'][] = $node->nid . ' : ' . $node->title; * $context['message'] = $node->title; * } Index: includes/language.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/language.inc,v retrieving revision 1.16 diff -u -p -r1.16 language.inc --- includes/language.inc 14 Apr 2008 17:48:33 -0000 1.16 +++ includes/language.inc 24 Nov 2008 10:02:21 -0000 @@ -53,7 +53,7 @@ function language_initialize() { } // User language. - if ($user->uid && isset($languages[$user->language])) { + if ($user->userid && isset($languages[$user->language])) { return $languages[$user->language]; } Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.306 diff -u -p -r1.306 menu.inc --- includes/menu.inc 15 Nov 2008 11:45:03 -0000 1.306 +++ includes/menu.inc 24 Nov 2008 10:02:21 -0000 @@ -753,7 +753,7 @@ function menu_get_object($type = 'node', * * The tree is expanded based on the current path and dynamic paths are also * changed according to the defined to_arg functions (for example the 'My account' - * link is changed from user/% to a link with the current user's uid). + * link is changed from user/% to a link with the current user's userid). * * @param $menu_name * The name of the menu. Index: includes/password.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/password.inc,v retrieving revision 1.3 diff -u -p -r1.3 password.inc --- includes/password.inc 26 May 2008 17:12:54 -0000 1.3 +++ includes/password.inc 24 Nov 2008 10:02:21 -0000 @@ -189,7 +189,7 @@ function user_hash_password($password, $ * Check whether a plain text password matches a stored hashed password. * * Alternative implementations of this function may use other data in the - * $account object, for example the uid to look up the hash in a custom table + * $account object, for example the userid to look up the hash in a custom table * or remote database. * * @param $password Index: includes/session.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/session.inc,v retrieving revision 1.64 diff -u -p -r1.64 session.inc --- includes/session.inc 24 Nov 2008 06:12:45 -0000 1.64 +++ includes/session.inc 24 Nov 2008 10:02:21 -0000 @@ -83,17 +83,17 @@ 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 {users} 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.userid = s.userid 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) { + if ($user && $user->userid > 0) { // This is done to unserialize the data member of $user. $user = drupal_unpack($user); // 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 {users_roles} 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.userid = :userid", array(':userid' => $user->userid))->fetchAllKeyed(0, 1); } // We didn't find the client's record (session has expired), or they // are an anonymous user. @@ -129,14 +129,14 @@ function _sess_write($key, $value) { // the session table. This reduces memory and server load, and gives more useful // statistics. We can't eliminate anonymous session table rows without breaking // the "Who's Online" block. - if (!drupal_save_session() || ($user->uid == 0 && empty($_COOKIE[session_name()]) && empty($value))) { + if (!drupal_save_session() || ($user->userid == 0 && empty($_COOKIE[session_name()]) && empty($value))) { return TRUE; } db_merge('sessions') ->key(array('sid' => $key)) ->fields(array( - 'uid' => $user->uid, + 'userid' => $user->userid, 'cache' => isset($user->cache) ? $user->cache : 0, 'hostname' => ip_address(), 'session' => $value, @@ -146,12 +146,12 @@ 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)) { + if ($user->userid && REQUEST_TIME - $user->lastaccess > variable_get('session_write_interval', 180)) { db_update('users') ->fields(array( - 'access' => REQUEST_TIME + 'lastaccess' => REQUEST_TIME )) - ->condition('uid', $user->uid) + ->condition('userid', $user->userid) ->execute(); } @@ -195,7 +195,7 @@ function drupal_session_count($timestamp $query = db_select('sessions'); $query->addExpression('COUNT(sid)', 'count'); $query->condition('timestamp', $timestamp, '>='); - $query->condition('uid', 0, $anonymous ? '=' : '>'); + $query->condition('userid', 0, $anonymous ? '=' : '>'); return $query->execute()->fetchField(); } @@ -216,12 +216,12 @@ function _sess_destroy_sid($sid) { /** * End a specific user's session(s). * - * @param string $uid + * @param string $userid * User ID. */ -function drupal_session_destroy_uid($uid) { +function drupal_session_destroy_userid($userid) { db_delete('sessions') - ->condition('uid', $uid) + ->condition('userid', $userid) ->execute(); } Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.453 diff -u -p -r1.453 theme.inc --- includes/theme.inc 23 Nov 2008 16:54:47 -0000 1.453 +++ includes/theme.inc 24 Nov 2008 10:02:22 -0000 @@ -1485,7 +1485,7 @@ function theme_box($title, $content, $re */ function theme_mark($type = MARK_NEW) { global $user; - if ($user->uid) { + if ($user->userid) { if ($type == MARK_NEW) { return ' ' . t('new') . ''; } @@ -1655,7 +1655,7 @@ function theme_blocks($region) { */ function theme_username($object) { - if ($object->uid && $object->name) { + if ($object->userid && $object->name) { // Shorten the name when it is too long or it will break many tables. if (drupal_strlen($object->name) > 20) { $name = drupal_substr($object->name, 0, 15) . '...'; @@ -1665,7 +1665,7 @@ function theme_username($object) { } if (user_access('access user profiles')) { - $output = l($name, 'user/' . $object->uid, array('attributes' => array('title' => t('View user profile.')))); + $output = l($name, 'user/' . $object->userid, array('attributes' => array('title' => t('View user profile.')))); } else { $output = check_plain($name); @@ -1787,7 +1787,7 @@ function template_preprocess(&$variables // Flag front page status. $variables['is_front'] = drupal_is_front_page(); // Tell all templates by which kind of user they're viewed. - $variables['logged_in'] = ($user->uid > 0); + $variables['logged_in'] = ($user->userid > 0); // Provide user object to all templates $variables['user'] = $user; } Index: includes/database/database.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/database.inc,v retrieving revision 1.29 diff -u -p -r1.29 database.inc --- includes/database/database.inc 22 Nov 2008 13:51:38 -0000 1.29 +++ includes/database/database.inc 24 Nov 2008 10:02:22 -0000 @@ -30,12 +30,12 @@ * For example, one might wish to return a list of the most recent 10 nodes * authored by a given user. Instead of directly issuing the SQL query * @code - * SELECT n.nid, n.title, n.created FROM node n WHERE n.uid = $uid LIMIT 0, 10; + * SELECT n.nid, n.title, n.created FROM node n WHERE n.userid = $userid LIMIT 0, 10; * @endcode * one would instead call the Drupal functions: * @code * $result = db_query_range('SELECT n.nid, n.title, n.created - * FROM {node} n WHERE n.uid = :uid', array(':uid' => $uid), 0, 10); + * FROM {node} n WHERE n.userid = :userid', array(':userid' => $userid), 0, 10); * foreach($result as $record) { * // Perform operations on $node->title, etc. here. * } @@ -61,19 +61,19 @@ * * Named placeholders begin with a colon followed by a unique string. Example: * @code - * SELECT nid, title FROM {node} WHERE uid=:uid + * SELECT nid, title FROM {node} WHERE userid=:userid * @endcode * - * ":uid" is a placeholder that will be replaced with a literal value when + * ":userid" is a placeholder that will be replaced with a literal value when * the query is executed. A given placeholder label cannot be repeated in a * given query, even if the value should be the same. When using named * placeholders, the array of arguments to the query must be an associative - * array where keys are a placeholder label (e.g., :uid) and the value is the + * array where keys are a placeholder label (e.g., :userid) and the value is the * corresponding value to use. The array may be in any order. * * Unnamed placeholders are simply a question mark. Example: * @code - * SELECT nid, title FROM {node} WHERE uid=? + * SELECT nid, title FROM {node} WHERE userid=? * @endcode * * In this case, the array of arguments must be an indexed array of values to Index: misc/timezone.js =================================================================== RCS file: /cvs/drupal/drupal/misc/timezone.js,v retrieving revision 1.1 diff -u -p -r1.1 timezone.js --- misc/timezone.js 21 Nov 2008 04:33:28 -0000 1.1 +++ misc/timezone.js 24 Nov 2008 10:02:22 -0000 @@ -49,7 +49,7 @@ Drupal.behaviors.setTimezone = { var path = 'system/timezone/' + abbreviation + '/' + offsetNow + '/' + isDaylightSavingTime; var element = this; $.ajax({ - async: false, + async: false, url: Drupal.settings.basePath, data: { q: path, date: dateString }, dataType: 'json', Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.315 diff -u -p -r1.315 block.module --- modules/block/block.module 15 Nov 2008 08:23:07 -0000 1.315 +++ modules/block/block.module 24 Nov 2008 10:02:23 -0000 @@ -420,7 +420,7 @@ function _block_load_blocks() { } // Use the user's block visibility setting, if necessary. if ($block->custom != 0) { - if ($user->uid && isset($user->block[$block->module][$block->delta])) { + if ($user->userid && isset($user->block[$block->module][$block->delta])) { $enabled = $user->block[$block->module][$block->delta]; } else { @@ -533,7 +533,7 @@ function _block_get_cache_id($block) { // it brings too many chances of having unwanted output get in the cache // and later be served to other users. We therefore exclude user 1 from // block caching. - if (variable_get('block_cache', 0) && $block->cache != BLOCK_NO_CACHE && $user->uid != 1) { + if (variable_get('block_cache', 0) && $block->cache != BLOCK_NO_CACHE && $user->userid != 1) { $cid_parts = array(); // Start with common sub-patterns: block identification, theme, language. @@ -552,7 +552,7 @@ function _block_get_cache_id($block) { $cid_parts[] = 'r.' . implode(',', array_keys($user->roles)); } elseif ($block->cache & BLOCK_CACHE_PER_USER) { - $cid_parts[] = "u.$user->uid"; + $cid_parts[] = "u.$user->userid"; } if ($block->cache & BLOCK_CACHE_PER_PAGE) { Index: modules/blog/blog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v retrieving revision 1.312 diff -u -p -r1.312 blog.module --- modules/blog/blog.module 1 Nov 2008 18:23:12 -0000 1.312 +++ modules/blog/blog.module 24 Nov 2008 10:02:23 -0000 @@ -33,11 +33,11 @@ function blog_access($op, $node, $accoun switch ($op) { case 'create': // Anonymous users cannot post even if they have the permission. - return user_access('create blog content', $account) && $account->uid; + return user_access('create blog content', $account) && $account->userid; case 'update': - return user_access('edit any blog content', $account) || (user_access('edit own blog content', $account) && ($node->uid == $account->uid)); + return user_access('edit any blog content', $account) || (user_access('edit own blog content', $account) && ($node->userid == $account->userid)); case 'delete': - return user_access('delete any blog content', $account) || (user_access('delete own blog content', $account) && ($node->uid == $account->uid)); + return user_access('delete any blog content', $account) || (user_access('delete own blog content', $account) && ($node->userid == $account->userid)); } } @@ -49,7 +49,7 @@ function blog_user_view(&$edit, &$user, $user->content['summary']['blog'] = array( '#type' => 'user_profile_item', '#title' => t('Blog'), - '#markup' => l(t('View recent blog entries'), "blog/$user->uid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => $user->name))))), + '#markup' => l(t('View recent blog entries'), "blog/$user->userid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => $user->name))))), '#attributes' => array('class' => 'blog'), ); } @@ -87,7 +87,7 @@ function blog_form(&$node) { function blog_view($node, $teaser = FALSE, $page = FALSE) { if ($page) { // Breadcrumb navigation. - drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('Blogs'), 'blog'), l(t("!name's blog", array('!name' => $node->name)), 'blog/' . $node->uid))); + drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('Blogs'), 'blog'), l(t("!name's blog", array('!name' => $node->name)), 'blog/' . $node->userid))); } return node_prepare($node, $teaser); @@ -100,10 +100,10 @@ function blog_link($type, $node = NULL, $links = array(); if ($type == 'node' && $node->type == 'blog') { - if (arg(0) != 'blog' || arg(1) != $node->uid) { + if (arg(0) != 'blog' || arg(1) != $node->userid) { $links['blog_usernames_blog'] = array( 'title' => t("!username's blog", array('!username' => $node->name)), - 'href' => "blog/$node->uid", + 'href' => "blog/$node->userid", 'attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => $node->name))), ); } @@ -122,7 +122,7 @@ function blog_menu() { 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, ); - $items['blog/%user_uid_optional'] = array( + $items['blog/%user_userid_optional'] = array( 'title' => 'My blog', 'page callback' => 'blog_page_user', 'page arguments' => array(1), @@ -154,14 +154,14 @@ function blog_page_user_access($account) // The visitor must be able to access the site's content. // For a blog to 'exist' the user must either be able to // create new blog entries, or it must have existing posts. - return $account->uid && user_access('access content') && (user_access('create blog content', $account) || _blog_post_exists($account)); + return $account->userid && user_access('access content') && (user_access('create blog content', $account) || _blog_post_exists($account)); } /** * Helper function to determine if a user has blog posts already. */ function _blog_post_exists($account) { - return (bool)db_result(db_query_range(db_rewrite_sql("SELECT 1 FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1"), $account->uid, 0, 1)); + return (bool)db_result(db_query_range(db_rewrite_sql("SELECT 1 FROM {node} n WHERE n.type = 'blog' AND n.userid = %d AND n.status = 1"), $account->userid, 0, 1)); } /** Index: modules/blog/blog.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v retrieving revision 1.14 diff -u -p -r1.14 blog.pages.inc --- modules/blog/blog.pages.inc 13 Oct 2008 00:33:01 -0000 1.14 +++ modules/blog/blog.pages.inc 24 Nov 2008 10:02:23 -0000 @@ -16,16 +16,16 @@ function blog_page_user($account) { $items = array(); - if (($account->uid == $user->uid) && user_access('create blog content')) { + if (($account->userid == $user->userid) && user_access('create blog content')) { $items[] = l(t('Post new blog entry.'), "node/add/blog"); } - elseif ($account->uid == $user->uid) { + elseif ($account->userid == $user->userid) { $items[] = t('You are not allowed to post a new blog entry.'); } $output = theme('item_list', $items); - $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid); + $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.userid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->userid); $has_posts = FALSE; while ($node = db_fetch_object($result)) { @@ -37,14 +37,14 @@ function blog_page_user($account) { $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); } else { - if ($account->uid == $user->uid) { + if ($account->userid == $user->userid) { drupal_set_message(t('You have not created any blog entries.')); } else { drupal_set_message(t('!author has not created any blog entries.', array('!author' => theme('username', $account)))); } } - drupal_add_feed(url('blog/' . $account->uid . '/feed'), t('RSS - !title', array('!title' => $title))); + drupal_add_feed(url('blog/' . $account->userid . '/feed'), t('RSS - !title', array('!title' => $title))); return $output; } @@ -87,9 +87,9 @@ function blog_page_last() { * Menu callback; displays an RSS feed containing recent blog entries of a given user. */ function blog_feed_user($account) { - $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10)); + $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.userid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->userid, 0, variable_get('feed_default_items', 10)); $channel['title'] = $account->name . "'s blog"; - $channel['link'] = url('blog/' . $account->uid, array('absolute' => TRUE)); + $channel['link'] = url('blog/' . $account->userid, array('absolute' => TRUE)); $items = array(); while ($row = db_fetch_object($result)) { Index: modules/blog/blog.test =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.test,v retrieving revision 1.4 diff -u -p -r1.4 blog.test --- modules/blog/blog.test 30 May 2008 07:30:49 -0000 1.4 +++ modules/blog/blog.test 24 Nov 2008 10:02:23 -0000 @@ -45,12 +45,12 @@ class BlogTestCase extends DrupalWebTest $this->doBasicTests($this->own_user, FALSE); // Create another blog node for the any blog user. - $node = $this->drupalCreateNode(array('type' => 'blog', 'uid' => $this->any_user->uid)); + $node = $this->drupalCreateNode(array('type' => 'blog', 'userid' => $this->any_user->userid)); // Verify the own blog user only has access to the blog view node. $this->verifyBlogs($this->any_user, $node, FALSE, 403); // Create another blog node for the own blog user. - $node = $this->drupalCreateNode(array('type' => 'blog', 'uid' => $this->own_user->uid)); + $node = $this->drupalCreateNode(array('type' => 'blog', 'userid' => $this->own_user->userid)); // Login the any blog user. $this->drupalLogin($this->any_user); // Verify the any blog user has access to all the blog nodes. @@ -69,7 +69,7 @@ class BlogTestCase extends DrupalWebTest // Login the user. $this->drupalLogin($user); // Create blog node. - $node = $this->drupalCreateNode(array('type' => 'blog', 'uid' => $user->uid)); + $node = $this->drupalCreateNode(array('type' => 'blog', 'userid' => $user->userid)); // Verify the user has access to all the blog nodes. $this->verifyBlogs($user, $node, $admin); // Verify the blog links are displayed. @@ -147,7 +147,7 @@ class BlogTestCase extends DrupalWebTest $crumb = '›'; // Confirm blog entries link exists on the user page. - $this->drupalGet('user/' . $user->uid); + $this->drupalGet('user/' . $user->userid); $this->assertResponse(200); $this->assertText(t('View recent blog entries'), t('View recent blog entries link was displayed')); @@ -162,7 +162,7 @@ class BlogTestCase extends DrupalWebTest $this->assertText(t('Home'), t('Breadcrumbs were displayed')); // Confirm a blog page was displayed per user. - $this->drupalGet('blog/' . $user->uid); + $this->drupalGet('blog/' . $user->userid); $this->assertTitle(t("@name's blog | Drupal", array('@name' => $user->name)), t('User blog node was displayed')); $this->assertText(t('Home ' . $crumb . ' Blogs'), t('Breadcrumbs were displayed')); @@ -171,7 +171,7 @@ class BlogTestCase extends DrupalWebTest $this->assertTitle(t('Drupal blogs'), t('Blog feed was displayed')); // Confirm a blog feed was displayed per user. - $this->drupalGet('blog/' . $user->uid . '/feed'); + $this->drupalGet('blog/' . $user->userid . '/feed'); $this->assertTitle(t("@name's blog", array('@name' => $user->name)), t('User blog feed was displayed')); } } Index: modules/blogapi/blogapi.install =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.install,v retrieving revision 1.4 diff -u -p -r1.4 blogapi.install --- modules/blogapi/blogapi.install 15 Nov 2008 13:01:04 -0000 1.4 +++ modules/blogapi/blogapi.install 24 Nov 2008 10:02:23 -0000 @@ -29,12 +29,11 @@ function blogapi_schema() { 'description' => 'Primary Key: Unique file ID.', 'type' => 'serial', ), - 'uid' => array( - 'description' => 'The {users}.uid of the user who is associated with the file.', + 'userid' => array( + 'description' => 'The {users}.userid of the user who is associated with the file.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, ), 'filepath' => array( 'description' => 'Path of the file relative to Drupal root.', @@ -53,7 +52,7 @@ function blogapi_schema() { ), 'primary key' => array('fid'), 'indexes' => array( - 'uid' => array('uid'), + 'userid' => array('userid'), ), ); @@ -93,3 +92,24 @@ function blogapi_update_6001() { * @} End of "defgroup updates-5.x-to-6.x" * The next series of updates should start at 7000. */ + +/** + * @defgroup updates-6.x-to-7.x BlogAPI updates from 6.x to 7.x + * @{ + */ + +/** + * Replace Oracle reserved word 'uid'. + */ +function blogapi_update_7000(() { + $ret = array(); + db_drop_index($ret, 'blogapi_files', 'uid'); + db_change_field($ret, 'blogapi_files', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + db_add_index($ret, 'blogapi_files', 'userid', array('userid')); + return $ret; +} + +/** + * @} End of "defgroup updates-6.x-to-7.x" + * The next series of updates should start at 8000. + */ Index: modules/blogapi/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v retrieving revision 1.133 diff -u -p -r1.133 blogapi.module --- modules/blogapi/blogapi.module 11 Nov 2008 16:49:37 -0000 1.133 +++ modules/blogapi/blogapi.module 24 Nov 2008 10:02:23 -0000 @@ -144,11 +144,11 @@ function blogapi_xmlrpc() { */ function blogapi_blogger_get_users_blogs($appid, $username, $password) { $user = blogapi_validate_user($username, $password); - if ($user->uid) { + if ($user->userid) { $types = _blogapi_get_node_types(); $structs = array(); foreach ($types as $type) { - $structs[] = array('url' => url('blog/' . $user->uid, array('absolute' => TRUE)), 'blogid' => $type, 'blogName' => $user->name . ": " . $type); + $structs[] = array('url' => url('blog/' . $user->userid, array('absolute' => TRUE)), 'blogid' => $type, 'blogName' => $user->name . ": " . $type); } return $structs; @@ -164,15 +164,15 @@ function blogapi_blogger_get_users_blogs function blogapi_blogger_get_user_info($appkey, $username, $password) { $user = blogapi_validate_user($username, $password); - if ($user->uid) { + if ($user->userid) { $name = explode(' ', $user->realname ? $user->realname : $user->name, 2); return array( - 'userid' => $user->uid, + 'userid' => $user->userid, 'lastname' => $name[1], 'firstname' => $name[0], 'nickname' => $user->name, 'email' => $user->mail, - 'url' => url('blog/' . $user->uid, array('absolute' => TRUE))); + 'url' => url('blog/' . $user->userid, array('absolute' => TRUE))); } else { return blogapi_error($user); @@ -184,7 +184,7 @@ function blogapi_blogger_get_user_info($ */ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $content, $publish) { $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } @@ -197,7 +197,7 @@ function blogapi_blogger_new_post($appke $edit['type'] = $blogid; // Get the node type defaults. $node_type_default = variable_get('node_options_' . $edit['type'], array('status', 'promote')); - $edit['uid'] = $user->uid; + $edit['userid'] = $user->userid; $edit['name'] = $user->name; $edit['promote'] = in_array('promote', $node_type_default); $edit['comment'] = variable_get('comment_' . $edit['type'], 2); @@ -253,7 +253,7 @@ function blogapi_blogger_new_post($appke function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $content, $publish) { $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } @@ -312,7 +312,7 @@ function blogapi_blogger_edit_post($appk */ function blogapi_blogger_get_post($appkey, $postid, $username, $password) { $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } @@ -353,7 +353,7 @@ function blogapi_status_error_check($nod */ function blogapi_blogger_delete_post($appkey, $postid, $username, $password, $publish) { $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } @@ -369,7 +369,7 @@ function blogapi_blogger_delete_post($ap function blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password, $number_of_posts, $bodies = TRUE) { // Remove unused appkey (from bloggerAPI). $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } @@ -379,15 +379,15 @@ function blogapi_blogger_get_recent_post } 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_revisions} 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( + $result = db_query_range("SELECT n.nid, n.title, r.body, r.format, n.comment, n.created, u.name FROM {node} n, {node_revisions} r, {users} u WHERE n.userid = u.userid AND n.vid = r.vid AND n.type = :type AND n.userid = :userid ORDER BY n.created DESC", array( ':type' => $blogid, - ':uid' => $user->uid + ':userid' => $user->userid ), 0, $number_of_posts); } else { - $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( + $result = db_query_range("SELECT n.nid, n.title, n.created, u.name FROM {node} n, {users} u WHERE n.userid = u.userid AND n.type = :type AND n.userid = :userid ORDER BY n.created DESC", array( ':type' => $blogid, - ':uid' => $user->uid + ':userid' => $user->userid ), 0, $number_of_posts); } $blogs = array(); @@ -415,7 +415,7 @@ function blogapi_metaweblog_get_post($po */ function blogapi_metaweblog_new_media_object($blogid, $username, $password, $file) { $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } @@ -436,7 +436,7 @@ function blogapi_metaweblog_new_media_ob return blogapi_error(t('It is not possible to upload the file, because it exceeded the maximum filesize of @maxsize.', array('@maxsize' => format_size($uploadsize)))); } - if (_blogapi_space_used($user->uid) + $filesize > $usersize) { + if (_blogapi_space_used($user->userid) + $filesize > $usersize) { return blogapi_error(t('The file can not be attached to this post, because the disk quota of @quota has been reached.', array('@quota' => format_size($usersize)))); } @@ -471,7 +471,7 @@ function blogapi_metaweblog_new_media_ob } $row = new stdClass(); - $row->uid = $user->uid; + $row->userid = $user->userid; $row->filepath = $file; $row->filesize = $filesize; @@ -486,7 +486,7 @@ function blogapi_metaweblog_new_media_ob */ function blogapi_metaweblog_get_category_list($blogid, $username, $password) { $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } @@ -531,7 +531,7 @@ function blogapi_mt_get_category_list($b */ function blogapi_mt_get_post_categories($postid, $username, $password) { $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } @@ -554,7 +554,7 @@ function blogapi_mt_get_post_categories( */ function blogapi_mt_set_post_categories($postid, $username, $password, $categories) { $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } @@ -640,7 +640,7 @@ function blogapi_mt_supported_text_filte function blogapi_mt_publish_post($postid, $username, $password) { $user = blogapi_validate_user($username, $password); - if (!$user->uid) { + if (!$user->userid) { return blogapi_error($user); } $node = node_load($postid); @@ -687,7 +687,7 @@ function blogapi_validate_user($username $user = user_authenticate(array('name' => $username, 'pass' => $password)); - if ($user->uid) { + if ($user->userid) { if (user_access('administer content with blog api', $user)) { return $user; } @@ -968,7 +968,7 @@ function _blogapi_get_node_types() { return $types; } -function _blogapi_space_used($uid) { - return db_query('SELECT SUM(filesize) FROM {blogapi_files} f WHERE f.uid = :uid', array(':uid' => $uid))->fetchField(); +function _blogapi_space_used($userid) { + return db_query('SELECT SUM(filesize) FROM {blogapi_files} f WHERE f.userid = :userid', array(':userid' => $userid))->fetchField(); } Index: modules/comment/comment.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v retrieving revision 1.11 diff -u -p -r1.11 comment.admin.inc --- modules/comment/comment.admin.inc 11 Nov 2008 21:44:01 -0000 1.11 +++ modules/comment/comment.admin.inc 24 Nov 2008 10:02:23 -0000 @@ -68,13 +68,13 @@ function comment_admin_overview($type = array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'), array('data' => t('Operations')), )); - $result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid, n.title as node_title FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid INNER JOIN {node} n ON n.nid = c.nid WHERE c.status = %d' . tablesort_sql($form['header']['#value']), 50, 0, NULL, $status); + $result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.userid, n.title as node_title FROM {comments} c INNER JOIN {users} u ON u.userid = c.userid INNER JOIN {node} n ON n.nid = c.nid WHERE c.status = %d' . tablesort_sql($form['header']['#value']), 50, 0, NULL, $status); // Build a table listing the appropriate comments. $destination = drupal_get_destination(); while ($comment = db_fetch_object($result)) { $comments[$comment->cid] = ''; - $comment->name = $comment->uid ? $comment->registered_name : $comment->name; + $comment->name = $comment->userid ? $comment->registered_name : $comment->name; $form['subject'][$comment->cid] = array( '#markup' => l($comment->subject, 'node/' . $comment->nid, array('attributes' => array('title' => truncate_utf8($comment->comment, 128)), 'fragment' => 'comment-' . $comment->cid)) ); @@ -246,8 +246,8 @@ function comment_multiple_delete_confirm * 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 {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.cid = %d', $cid)); - $comment->name = $comment->uid ? $comment->registered_name : $comment->name; + $comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.userid FROM {comments} c INNER JOIN {users} u ON u.userid = c.userid WHERE c.cid = %d', $cid)); + $comment->name = $comment->userid ? $comment->registered_name : $comment->name; $output = ''; if (is_object($comment) && is_numeric($comment->cid)) { @@ -313,9 +313,9 @@ 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 {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE pid = %d', $comment->cid); + $result = db_query('SELECT c.*, u.name AS registered_name, u.userid FROM {comments} c INNER JOIN {users} u ON u.userid = c.userid WHERE pid = %d', $comment->cid); while ($comment = db_fetch_object($result)) { - $comment->name = $comment->uid ? $comment->registered_name : $comment->name; + $comment->name = $comment->userid ? $comment->registered_name : $comment->name; _comment_delete_thread($comment); } } Index: modules/comment/comment.install =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v retrieving revision 1.27 diff -u -p -r1.27 comment.install --- modules/comment/comment.install 15 Nov 2008 13:01:05 -0000 1.27 +++ modules/comment/comment.install 24 Nov 2008 10:02:23 -0000 @@ -6,7 +6,7 @@ */ function comment_enable() { // Insert records into the node_comment_statistics for nodes that are missing. - db_query("INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) SELECT n.nid, n.changed, NULL, n.uid, 0 FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE c.comment_count IS NULL"); + db_query("INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_userid, comment_count) SELECT n.nid, n.changed, NULL, n.userid, 0 FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE c.comment_count IS NULL"); } /** @@ -109,6 +109,16 @@ function comment_update_7001() { } /** + * Replace Oracle reserved word 'uid'. + */ +function comment_update_7002() { + $ret = array(); + db_change_field($ret, 'comments', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + db_change_field($ret, 'node_comment_statistics', 'last_comment_uid', 'last_comment_userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + return $ret; +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ @@ -137,11 +147,11 @@ function comment_schema() { 'default' => 0, 'description' => 'The {node}.nid to which this comment is a reply.', ), - 'uid' => array( + 'userid' => array( 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, - 'description' => 'The {users}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.', + 'description' => 'The {users}.userid who authored the comment. If set to 0, this comment was created by an anonymous user.', ), 'subject' => array( 'type' => 'varchar', @@ -240,11 +250,11 @@ function comment_schema() { 'not null' => FALSE, 'description' => 'The name of the latest author to post a comment on this node, from {comments}.name.', ), - 'last_comment_uid' => array( + 'last_comment_userid' => array( 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, - 'description' => 'The user ID of the latest author to post a comment on this node, from {comments}.uid.', + 'description' => 'The user ID of the latest author to post a comment on this node, from {comments}.userid.', ), 'comment_count' => array( 'type' => 'int', Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.666 diff -u -p -r1.666 comment.module --- modules/comment/comment.module 23 Nov 2008 16:04:41 -0000 1.666 +++ modules/comment/comment.module 24 Nov 2008 10:02:23 -0000 @@ -604,7 +604,7 @@ function comment_nodeapi_insert(&$node, 'nid' => $node->nid, 'last_comment_timestamp' => $node->changed, 'last_comment_name' => NULL, - 'last_comment_uid' => $node->uid, + 'last_comment_userid' => $node->userid, 'comment_count' => 0 )) ->execute(); } @@ -658,12 +658,12 @@ function comment_nodeapi_rss_item(&$node */ function comment_user_delete(&$edit, &$user, $category = NULL) { db_update('comments') - ->fields(array('uid' => 0)) - ->condition('uid', $user->uid) + ->fields(array('userid' => 0)) + ->condition('userid', $user->userid) ->execute(); db_update('node_comment_statistics') - ->fields(array('last_comment_uid' => 0)) - ->condition('last_comment_uid', $user->uid) + ->fields(array('last_comment_userid' => 0)) + ->condition('last_comment_userid', $user->userid) ->execute(); } @@ -686,7 +686,7 @@ function comment_access($op, $comment) { global $user; if ($op == 'edit') { - return ($user->uid && $user->uid == $comment->uid && comment_num_replies($comment->cid) == 0) || user_access('administer comments'); + return ($user->userid && $user->userid == $comment->userid && comment_num_replies($comment->cid) == 0) || user_access('administer comments'); } } @@ -729,7 +729,7 @@ function comment_save($edit) { 'subject' => $edit['subject'], 'comment' => $edit['comment'], 'format' => $edit['comment_format'], - 'uid' => $edit['uid'], + 'userid' => $edit['userid'], 'name' => $edit['name'], 'mail' => $edit['mail'], 'homepage' => $edit['homepage'] @@ -787,7 +787,7 @@ function comment_save($edit) { $edit['timestamp'] = REQUEST_TIME; } - if ($edit['uid'] === $user->uid && isset($user->name)) { // '===' Need to modify anonymous users as well. + if ($edit['userid'] === $user->userid && isset($user->name)) { // '===' Need to modify anonymous users as well. $edit['name'] = $user->name; } @@ -795,7 +795,7 @@ function comment_save($edit) { ->fields(array( 'nid' => $edit['nid'], 'pid' => empty($edit['pid']) ? 0 : $edit['pid'], - 'uid' => $edit['uid'], + 'userid' => $edit['userid'], 'subject' => $edit['subject'], 'comment' => $edit['comment'], 'format' => $edit['comment_format'], @@ -988,9 +988,9 @@ function comment_render($node, $cid = 0) // Single comment view. $query = db_select('comments', 'c'); $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->fields('u', array( 'userid', 'signature', 'picture', 'data', 'status') ); $query->addField('u', 'name', 'registered_name'); - $query->innerJoin('users', 'u', 'c.uid = u.uid'); + $query->innerJoin('users', 'u', 'c.userid = u.userid'); $query->condition('c.cid', $cid); if (!user_access('administer comments')) { @@ -1000,7 +1000,7 @@ function comment_render($node, $cid = 0) $result = $query->execute(); if ($comment = $result->fetchObject()) { - $comment->name = $comment->uid ? $comment->registered_name : $comment->name; + $comment->name = $comment->userid ? $comment->registered_name : $comment->name; $links = module_invoke_all('link', 'comment', $comment, 1); drupal_alter('link', $links, $node); @@ -1013,7 +1013,7 @@ function comment_render($node, $cid = 0) // Multiple comment view. $query_count = 'SELECT COUNT(*) FROM {comments} 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 {comments} c INNER JOIN {users} 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.userid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM {comments} c INNER JOIN {users} u ON c.userid = u.userid WHERE c.nid = %d'; $query_args = array($nid); if (!user_access('administer comments')) { @@ -1042,7 +1042,7 @@ function comment_render($node, $cid = 0) drupal_add_css(drupal_get_path('module', 'comment') . '/comment.css'); foreach ($result as $comment) { $comment = drupal_unpack($comment); - $comment->name = $comment->uid ? $comment->registered_name : $comment->name; + $comment->name = $comment->userid ? $comment->registered_name : $comment->name; $comment->depth = count(explode('.', $comment->thread)) - 1; if ($mode == COMMENT_MODE_THREADED_COLLAPSED || $mode == COMMENT_MODE_THREADED_EXPANDED) { @@ -1173,7 +1173,7 @@ function comment_num_replies($pid) { function comment_num_new($nid, $timestamp = 0) { global $user; - if ($user->uid) { + if ($user->userid) { // Retrieve the timestamp at which the current user last viewed this node. if (!$timestamp) { $timestamp = node_last_viewed($nid); @@ -1217,12 +1217,12 @@ function comment_validate($edit) { } // Check validity of name, mail and homepage (if given). - if (!$user->uid || isset($edit['is_anonymous'])) { + if (!$user->userid || isset($edit['is_anonymous'])) { $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('users', 'u'); - $query->addField('u', 'uid', 'uid'); + $query->addField('u', 'userid', 'userid'); $taken = $query->where('LOWER(name) = :name', array(':name' => $edit['name'])) ->countQuery() ->execute() @@ -1269,12 +1269,12 @@ function comment_form(&$form_state, $edi $op = isset($_POST['op']) ? $_POST['op'] : ''; $node = node_load($edit['nid']); - if (!$user->uid && variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) { + if (!$user->userid && variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) { drupal_add_js(drupal_get_path('module', 'comment') . '/comment.js'); } $edit += array('name' => '', 'mail' => '', 'homepage' => ''); - if ($user->uid) { + if ($user->userid) { if (!empty($edit['cid']) && user_access('administer comments')) { if (!empty($edit['author'])) { $author = $edit['author']; @@ -1466,9 +1466,9 @@ function comment_form(&$form_state, $edi '#type' => 'value', '#value' => $edit['nid'], ); - $form['uid'] = array( + $form['userid'] = array( '#type' => 'value', - '#value' => !empty($edit['uid']) ? $edit['uid'] : 0, + '#value' => !empty($edit['userid']) ? $edit['userid'] : 0, ); // Only show the save button if comment previews are optional or if we are @@ -1538,12 +1538,12 @@ function comment_form_add_preview($form, if (!empty($edit['author'])) { $account = user_load(array('name' => $edit['author'])); } - elseif ($user->uid && !isset($edit['is_anonymous'])) { + elseif ($user->userid && !isset($edit['is_anonymous'])) { $account = $user; } if (!empty($account)) { - $comment->uid = $account->uid; + $comment->userid = $account->userid; $comment->name = check_plain($account->name); } elseif (empty($comment->name)) { @@ -1564,12 +1564,12 @@ function comment_form_add_preview($form, $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 {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array( + $comment = db_query('SELECT c.*, u.userid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.userid = u.userid WHERE c.cid = :cid AND c.status = :status', array( ':cid' => $edit['pid'], ':status' => COMMENT_PUBLISHED )) ->fetchObject(); $comment = drupal_unpack($comment); - $comment->name = $comment->uid ? $comment->registered_name : $comment->name; + $comment->name = $comment->userid ? $comment->registered_name : $comment->name; $output .= theme('comment_view', $comment, $node); } else { @@ -1591,7 +1591,7 @@ function comment_form_add_preview($form, */ function comment_form_validate($form, &$form_state) { global $user; - if ($user->uid === 0) { + if ($user->userid === 0) { foreach (array('name', 'homepage', 'mail') as $field) { // Set cookie for 365 days. if (isset($form_state['values'][$field])) { @@ -1617,7 +1617,7 @@ function _comment_form_submit(&$comment_ $comment_values['timestamp'] = strtotime($comment_values['date']); if (isset($comment_values['author'])) { $account = user_load(array('name' => $comment_values['author'])); - $comment_values['uid'] = $account->uid; + $comment_values['userid'] = $account->userid; $comment_values['name'] = $comment_values['author']; } @@ -1796,7 +1796,7 @@ function theme_comment_post_forbidden($n global $user; static $authenticated_post_comments; - if (!$user->uid) { + if (!$user->userid) { if (!isset($authenticated_post_comments)) { // We only output any link if we are certain, that users get permission // to post comments by logging in. We also locally cache this information. @@ -1903,7 +1903,7 @@ function _comment_get_display_setting($s * The following fields are contained in the node_comment_statistics table. * - last_comment_timestamp: the timestamp of the last comment for this node or the node create stamp if no comments exist for the node. * - last_comment_name: the name of the anonymous poster for the last comment - * - last_comment_uid: the uid of the poster for the last comment for this node or the node authors uid if no comments exists for the node. + * - last_comment_userid: the userid of the poster for the last comment for this node or the node authors userid if no comments exists for the node. * - comment_count: the total number of approved/published comments on this node. */ function _comment_update_node_statistics($nid) { @@ -1911,25 +1911,25 @@ function _comment_update_node_statistics if ($count > 0) { // Comments exist. - $last_reply = db_query_range('SELECT cid, name, timestamp, uid FROM {comments} WHERE nid = :nid AND status = :status ORDER BY cid DESC', array(':nid' => $nid, ':status' => COMMENT_PUBLISHED), 0, 1)->fetchObject(); + $last_reply = db_query_range('SELECT cid, name, timestamp, userid FROM {comments} WHERE nid = :nid AND status = :status ORDER BY cid DESC', array(':nid' => $nid, ':status' => COMMENT_PUBLISHED), 0, 1)->fetchObject(); db_update('node_comment_statistics') ->fields( array( 'comment_count' => $count, 'last_comment_timestamp' => $last_reply->timestamp, - 'last_comment_name' => $last_reply->uid ? '' : $last_reply->name, - 'last_comment_uid' => $last_reply->uid )) + 'last_comment_name' => $last_reply->userid ? '' : $last_reply->name, + 'last_comment_userid' => $last_reply->userid )) ->condition('nid', $nid) ->execute(); } else { // Comments do not exist. - $node = db_query('SELECT uid, created FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchObject(); + $node = db_query('SELECT userid, created FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchObject(); db_update('node_comment_statistics') ->fields( array( 'comment_count' => 0, 'last_comment_timestamp' => $node->created, 'last_comment_name' => '', - 'last_comment_uid' => $node->uid )) + 'last_comment_userid' => $node->userid )) ->condition('nid', $nid) ->execute(); } Index: modules/comment/comment.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.pages.inc,v retrieving revision 1.9 diff -u -p -r1.9 comment.pages.inc --- modules/comment/comment.pages.inc 16 Nov 2008 19:41:14 -0000 1.9 +++ modules/comment/comment.pages.inc 24 Nov 2008 10:02:23 -0000 @@ -15,9 +15,9 @@ */ function comment_edit($cid) { global $user; - $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid'=>$cid) )->fetchObject(); + $comment = db_query('SELECT c.*, u.userid, u.name AS registered_name, u.data FROM {comments} c INNER JOIN {users} u ON c.userid = u.userid WHERE c.cid = :cid', array(':cid'=>$cid) )->fetchObject(); $comment = drupal_unpack($comment); - $comment->name = $comment->uid ? $comment->registered_name : $comment->name; + $comment->name = $comment->userid ? $comment->registered_name : $comment->name; if (comment_access('edit', $comment)) { return comment_form_box((array)$comment); @@ -69,7 +69,7 @@ function comment_reply($node, $pid = NUL // $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 {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array( + $comment = db_query('SELECT c.*, u.userid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.userid = u.userid WHERE c.cid = :cid AND c.status = :status', array( ':cid'=>$pid, ':status'=>COMMENT_PUBLISHED))->fetchObject(); if ( $comment ) { @@ -82,7 +82,7 @@ function comment_reply($node, $pid = NUL } // Display the parent comment $comment = drupal_unpack($comment); - $comment->name = $comment->uid ? $comment->registered_name : $comment->name; + $comment->name = $comment->userid ? $comment->registered_name : $comment->name; $output .= theme('comment_view', $comment, $node); } else { Index: modules/contact/contact.module =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v retrieving revision 1.111 diff -u -p -r1.111 contact.module --- modules/contact/contact.module 9 Oct 2008 15:15:51 -0000 1.111 +++ modules/contact/contact.module 24 Nov 2008 10:02:23 -0000 @@ -120,9 +120,9 @@ function _contact_user_tab_access($accou $account->contact = FALSE; } return - $account && $user->uid && + $account && $user->userid && ( - ($user->uid != $account->uid && $account->contact) || + ($user->userid != $account->userid && $account->contact) || user_access('administer users') ); } @@ -148,7 +148,7 @@ function contact_user_form(&$edit, &$use $form['contact']['contact'] = array('#type' => 'checkbox', '#title' => t('Personal contact form'), '#default_value' => !empty($edit['contact']) ? $edit['contact'] : FALSE, - '#description' => t('Allow other users to contact you by e-mail via your personal contact form. Note that while your e-mail address is not made public to other members of the community, privileged users such as site administrators are able to contact you even if you choose not to enable this feature.', array('@url' => url("user/$user->uid/contact"))), + '#description' => t('Allow other users to contact you by e-mail via your personal contact form. Note that while your e-mail address is not made public to other members of the community, privileged users such as site administrators are able to contact you even if you choose not to enable this feature.', array('@url' => url("user/$user->userid/contact"))), ); return $form; } @@ -192,8 +192,8 @@ function contact_mail($key, &$message, $ $account = $params['account']; $message['subject'] .= '[' . variable_get('site_name', 'Drupal') . '] ' . $params['subject']; $message['body'][] = "$account->name,"; - $message['body'][] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", array('absolute' => TRUE, 'language' => $language)), '!form-url' => url($_GET['q'], array('absolute' => TRUE, 'language' => $language)), '!site' => variable_get('site_name', 'Drupal')), $language->language); - $message['body'][] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", array('absolute' => TRUE, 'language' => $language))), $language->language); + $message['body'][] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->userid", array('absolute' => TRUE, 'language' => $language)), '!form-url' => url($_GET['q'], array('absolute' => TRUE, 'language' => $language)), '!site' => variable_get('site_name', 'Drupal')), $language->language); + $message['body'][] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->userid", array('absolute' => TRUE, 'language' => $language))), $language->language); $message['body'][] = t('Message:', NULL, $language->language); $message['body'][] = $params['message']; break; Index: modules/contact/contact.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v retrieving revision 1.15 diff -u -p -r1.15 contact.pages.inc --- modules/contact/contact.pages.inc 13 Oct 2008 00:33:02 -0000 1.15 +++ modules/contact/contact.pages.inc 24 Nov 2008 10:02:23 -0000 @@ -37,18 +37,18 @@ function contact_mail_page() { } if (count($categories) > 0) { - $form['#token'] = $user->uid ? $user->name . $user->mail : ''; + $form['#token'] = $user->userid ? $user->name . $user->mail : ''; $form['contact_information'] = array('#markup' => filter_xss_admin(variable_get('contact_form_information', t('You can leave a message using the contact form below.')))); $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 255, - '#default_value' => $user->uid ? $user->name : '', + '#default_value' => $user->userid ? $user->name : '', '#required' => TRUE, ); $form['mail'] = array('#type' => 'textfield', '#title' => t('Your e-mail address'), '#maxlength' => 255, - '#default_value' => $user->uid ? $user->mail : '', + '#default_value' => $user->userid ? $user->mail : '', '#required' => TRUE, ); $form['subject'] = array('#type' => 'textfield', @@ -83,7 +83,7 @@ function contact_mail_page() { ); // We do not allow anonymous users to send themselves a copy // because it can be abused to spam people. - if ($user->uid) { + if ($user->userid) { $form['copy'] = array('#type' => 'checkbox', '#title' => t('Send yourself a copy.'), ); @@ -158,7 +158,7 @@ function contact_user_page($account) { global $user; if (!valid_email_address($user->mail)) { - $output = t('You need to provide a valid e-mail address to contact other users. Please update your user information and try again.', array('@url' => url("user/$user->uid/edit", array('query' => 'destination=' . drupal_get_destination())))); + $output = t('You need to provide a valid e-mail address to contact other users. Please update your user information and try again.', array('@url' => url("user/$user->userid/edit", array('query' => 'destination=' . drupal_get_destination())))); } elseif (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3)) && !user_access('administer site-wide contact form')) { $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3))); @@ -232,5 +232,5 @@ function contact_mail_user_submit($form, drupal_set_message(t('The message has been sent.')); // Back to the requested users profile page. - $form_state['redirect'] = "user/$account->uid"; + $form_state['redirect'] = "user/$account->userid"; } Index: modules/contact/contact.test =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.test,v retrieving revision 1.12 diff -u -p -r1.12 contact.test --- modules/contact/contact.test 17 Sep 2008 06:54:11 -0000 1.12 +++ modules/contact/contact.test 24 Nov 2008 10:02:23 -0000 @@ -306,7 +306,7 @@ class ContactPersonalTestCase extends Dr $this->drupalLogin($web_user1); - $this->drupalGet('user/' . $web_user2->uid . '/contact'); + $this->drupalGet('user/' . $web_user2->userid . '/contact'); $this->assertResponse(200, t('Access to personal contact form granted.')); $edit = array(); @@ -320,13 +320,13 @@ class ContactPersonalTestCase extends Dr // Submit contact form with correct values and check flood interval. for ($i = 0; $i < $flood_control; $i++) { - $this->drupalGet('user/' . $web_user2->uid . '/contact'); + $this->drupalGet('user/' . $web_user2->userid . '/contact'); $this->drupalPost(NULL, $edit, t('Send e-mail')); $this->assertText(t('The message has been sent.'), t('Message sent.')); } // Submit contact form one over limit. - $this->drupalGet('user/' . $web_user2->uid . '/contact'); + $this->drupalGet('user/' . $web_user2->userid . '/contact'); $this->assertRaw(t('You cannot send more than %number messages per hour. Please try again later.', array('%number' => $flood_control)), t('Message threshold reached.')); $this->drupalLogout(); @@ -348,7 +348,7 @@ class ContactPersonalTestCase extends Dr $this->drupalLogin($web_user3); - $this->drupalGet('user/' . $web_user4->uid . '/contact'); + $this->drupalGet('user/' . $web_user4->userid . '/contact'); $this->assertResponse(403, t('Access to personal contact form denied.')); } } Index: modules/dblog/dblog.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.admin.inc,v retrieving revision 1.8 diff -u -p -r1.8 dblog.admin.inc --- modules/dblog/dblog.admin.inc 19 Jul 2008 07:44:45 -0000 1.8 +++ modules/dblog/dblog.admin.inc 24 Nov 2008 10:02:23 -0000 @@ -62,7 +62,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 {users} u ON w.uid = u.uid"; + $sql = "SELECT w.wid, w.userid, w.severity, w.type, w.timestamp, w.message, w.variables, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.userid = u.userid"; $tablesort = tablesort_sql($header); if (!empty($filter['where'])) { $result = pager_query($sql . " WHERE " . $filter['where'] . $tablesort, 50, 0, NULL, $filter['args']); @@ -131,7 +131,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 {users} u ON w.uid = u.uid WHERE w.wid = %d', $id); + $result = db_query('SELECT w.*, u.name, u.userid FROM {watchdog} w INNER JOIN {users} u ON w.userid = u.userid WHERE w.wid = %d', $id); if ($dblog = db_fetch_object($result)) { $rows = array( array( Index: modules/dblog/dblog.install =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.install,v retrieving revision 1.10 diff -u -p -r1.10 dblog.install --- modules/dblog/dblog.install 15 Nov 2008 13:01:05 -0000 1.10 +++ modules/dblog/dblog.install 24 Nov 2008 10:02:23 -0000 @@ -29,11 +29,11 @@ function dblog_schema() { 'not null' => TRUE, 'description' => 'Primary Key: Unique watchdog event ID.', ), - 'uid' => array( + 'userid' => array( 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, - 'description' => 'The {users}.uid of the user who triggered the event.', + 'description' => 'The {users}.userid of the user who triggered the event.', ), 'type' => array( 'type' => 'varchar', @@ -98,7 +98,7 @@ function dblog_schema() { 'primary key' => array('wid'), 'indexes' => array( 'type' => array('type'), - 'uid' => array('uid'), + 'userid' => array('userid'), ), ); Index: modules/dblog/dblog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v retrieving revision 1.30 diff -u -p -r1.30 dblog.module --- modules/dblog/dblog.module 30 Oct 2008 09:16:01 -0000 1.30 +++ modules/dblog/dblog.module 24 Nov 2008 10:02:23 -0000 @@ -104,7 +104,7 @@ function dblog_cron() { * Implementation of hook_user_delete(). */ function dblog_user_delete(&$edit, &$user) { - db_query('UPDATE {watchdog} SET uid = 0 WHERE uid = %d', $user->uid); + db_query('UPDATE {watchdog} SET userid = 0 WHERE userid = %d', $user->userid); } function _dblog_get_message_types() { @@ -121,7 +121,7 @@ function _dblog_get_message_types() { function dblog_watchdog($log = array()) { Database::getConnection('default')->insert('watchdog') ->fields(array( - 'uid' => $log['user']->uid, + 'userid' => $log['user']->userid, 'type' => $log['type'], 'message' => $log['message'], 'variables' => serialize($log['variables']), Index: modules/dblog/dblog.test =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.test,v retrieving revision 1.9 diff -u -p -r1.9 dblog.test --- modules/dblog/dblog.test 17 Sep 2008 07:11:56 -0000 1.9 +++ modules/dblog/dblog.test 24 Nov 2008 10:02:23 -0000 @@ -169,8 +169,8 @@ class DBLogTestCase extends DrupalWebTes $this->doNode('poll'); // When a user is deleted, any content they created remains but the - // uid = 0. Their blog entry shows as "'s blog" on the home page. Records - // in the watchdog table related to that user have the uid set to zero. + // userid = 0. Their blog entry shows as "'s blog" on the home page. Records + // in the watchdog table related to that user have the userid set to zero. } /** @@ -199,30 +199,30 @@ class DBLogTestCase extends DrupalWebTes // Logout user. $this->drupalLogout(); // Fetch row ids in watchdog that relate to the user. - $result = db_query('SELECT wid FROM {watchdog} WHERE uid = %d', $user->uid); + $result = db_query('SELECT wid FROM {watchdog} WHERE userid = %d', $user->userid); while ($row = db_fetch_array($result)) { $ids[] = $row['wid']; } $count_before = (isset($ids)) ? count($ids) : 0; $this->assertTrue($count_before > 0, t('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->name))); // Delete user. - user_delete(array(), $user->uid); - // Count rows that have uids for the user. - $count = db_result(db_query('SELECT COUNT(wid) FROM {watchdog} WHERE uid = %d', $user->uid)); + user_delete(array(), $user->userid); + // Count rows that have userids for the user. + $count = db_result(db_query('SELECT COUNT(wid) FROM {watchdog} WHERE userid = %d', $user->userid)); $this->assertTrue($count == 0, t('DBLog contains @count records for @name', array('@count' => $count, '@name' => $user->name))); // Count rows in watchdog that previously related to the deleted user. $select = db_select('watchdog'); $select->addExpression('COUNT(*)'); - $select->condition('uid', 0); + $select->condition('userid', 0); if ($ids) { $select->condition('wid', $ids, 'IN'); } $count_after = $select->execute()->fetchField(); - $this->assertTrue($count_after == $count_before, t('DBLog contains @count records for @name that now have uid = 0', array('@count' => $count_before, '@name' => $user->name))); + $this->assertTrue($count_after == $count_before, t('DBLog contains @count records for @name that now have userid = 0', array('@count' => $count_before, '@name' => $user->name))); unset($ids); // Fetch row ids in watchdog that relate to the user. - $result = db_query('SELECT wid FROM {watchdog} WHERE uid = %d', $user->uid); + $result = db_query('SELECT wid FROM {watchdog} WHERE userid = %d', $user->userid); while ($row = db_fetch_array($result)) { $ids[] = $row['wid']; } Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.473 diff -u -p -r1.473 forum.module --- modules/forum/forum.module 11 Nov 2008 16:49:37 -0000 1.473 +++ modules/forum/forum.module 24 Nov 2008 10:02:23 -0000 @@ -371,9 +371,9 @@ function forum_access($op, $node, $accou case 'create': return user_access('create forum content', $account); case 'update': - return user_access('edit any forum content', $account) || (user_access('edit own forum content', $account) && ($account->uid == $node->uid)); + return user_access('edit any forum content', $account) || (user_access('edit own forum content', $account) && ($account->userid == $node->userid)); case 'delete': - return user_access('delete any forum content', $account) || (user_access('delete own forum content', $account) && ($account->uid == $node->uid)); + return user_access('delete any forum content', $account) || (user_access('delete own forum content', $account) && ($account->userid == $node->userid)); } } @@ -586,7 +586,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 {users} u1 ON n.uid = u1.uid INNER JOIN {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 = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_userid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_userid FROM {node} n INNER JOIN {users} u1 ON n.userid = u1.userid INNER JOIN {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_userid=u2.userid 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)); @@ -594,7 +594,7 @@ function forum_get_forums($tid = 0) { if (!empty($topic->last_comment_timestamp)) { $last_post->timestamp = $topic->last_comment_timestamp; $last_post->name = $topic->last_comment_name; - $last_post->uid = $topic->last_comment_uid; + $last_post->userid = $topic->last_comment_userid; } $forum->last_post = $last_post; @@ -608,10 +608,10 @@ function forum_get_forums($tid = 0) { * Calculate the number of nodes the user has not yet read and are newer * than NODE_NEW_LIMIT. */ -function _forum_topics_unread($term, $uid) { - $sql = "SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid AND tn.tid = %d LEFT JOIN {history} h ON n.nid = h.nid AND h.uid = %d WHERE n.status = 1 AND n.created > %d AND h.nid IS NULL"; +function _forum_topics_unread($term, $userid) { + $sql = "SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid AND tn.tid = %d LEFT JOIN {history} h ON n.nid = h.nid AND h.userid = %d WHERE n.status = 1 AND n.created > %d AND h.nid IS NULL"; $sql = db_rewrite_sql($sql); - return db_result(db_query($sql, $term, $uid, NODE_NEW_LIMIT)); + return db_result(db_query($sql, $term, $userid, NODE_NEW_LIMIT)); } function forum_get_topics($tid, $sortby, $forum_per_page) { @@ -632,7 +632,7 @@ function forum_get_topics($tid, $sortby, } } - $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 {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 = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.userid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_userid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_userid, 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_userid = cu.userid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.userid = u.userid 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. @@ -641,7 +641,7 @@ function forum_get_topics($tid, $sortby, $result = pager_query($sql, $forum_per_page, 0, $sql_count, $tid); $topics = array(); while ($topic = db_fetch_object($result)) { - if ($user->uid) { + if ($user->userid) { // folder is new if topic is new or there are new comments since last visit if ($topic->tid != $tid) { $topic->new = 0; @@ -662,7 +662,7 @@ function forum_get_topics($tid, $sortby, $last_reply = new stdClass(); $last_reply->timestamp = $topic->last_comment_timestamp; $last_reply->name = $topic->last_comment_name; - $last_reply->uid = $topic->last_comment_uid; + $last_reply->userid = $topic->last_comment_userid; $topic->last_reply = $last_reply; } $topics[] = $topic; @@ -677,9 +677,9 @@ function forum_get_topics($tid, $sortby, function _forum_new($tid) { global $user; - $sql = "SELECT n.nid FROM {node} n LEFT JOIN {history} h ON n.nid = h.nid AND h.uid = %d INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND h.nid IS NULL AND n.created > %d ORDER BY created"; + $sql = "SELECT n.nid FROM {node} n LEFT JOIN {history} h ON n.nid = h.nid AND h.userid = %d INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND h.nid IS NULL AND n.created > %d ORDER BY created"; $sql = db_rewrite_sql($sql); - $nid = db_result(db_query_range($sql, $user->uid, $tid, NODE_NEW_LIMIT, 0, 1)); + $nid = db_result(db_query_range($sql, $user->userid, $tid, NODE_NEW_LIMIT, 0, 1)); return $nid ? $nid : 0; } @@ -739,7 +739,7 @@ function template_preprocess_forums(&$va if (empty($forum_types)) { // The user is logged-in; but denied access to create any new forum content type. - if ($user->uid) { + if ($user->userid) { $forum_types['disallowed'] = array('title' => t('You are not allowed to post new content in forum.')); } // The user is not logged-in; and denied access to create any new forum content type. @@ -816,8 +816,8 @@ function template_preprocess_forum_list( $variables['forums'][$id]->new_url = ''; $variables['forums'][$id]->new_topics = 0; $variables['forums'][$id]->old_topics = $forum->num_topics; - if ($user->uid) { - $variables['forums'][$id]->new_topics = _forum_topics_unread($forum->tid, $user->uid); + if ($user->userid) { + $variables['forums'][$id]->new_topics = _forum_topics_unread($forum->tid, $user->userid); if ($variables['forums'][$id]->new_topics) { $variables['forums'][$id]->new_text = format_plural($variables['forums'][$id]->new_topics, '1 new', '@count new'); $variables['forums'][$id]->new_url = url("forum/$forum->tid", array('fragment' => 'new')); @@ -972,7 +972,7 @@ function template_preprocess_forum_topic * @see theme_forum_submitted() */ function template_preprocess_forum_submitted(&$variables) { - $variables['author'] = isset($variables['topic']->uid) ? theme('username', $variables['topic']) : ''; + $variables['author'] = isset($variables['topic']->userid) ? theme('username', $variables['topic']) : ''; $variables['time'] = isset($variables['topic']->timestamp) ? format_interval(REQUEST_TIME - $variables['topic']->timestamp) : ''; } @@ -981,7 +981,7 @@ function _forum_user_last_visit($nid) { static $history = array(); if (empty($history)) { - $result = db_query('SELECT nid, timestamp FROM {history} WHERE uid = %d', $user->uid); + $result = db_query('SELECT nid, timestamp FROM {history} WHERE userid = %d', $user->userid); while ($t = db_fetch_object($result)) { $history[$t->nid] = $t->timestamp > NODE_NEW_LIMIT ? $t->timestamp : NODE_NEW_LIMIT; } Index: modules/forum/forum.test =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.test,v retrieving revision 1.6 diff -u -p -r1.6 forum.test --- modules/forum/forum.test 5 Nov 2008 12:47:23 -0000 1.6 +++ modules/forum/forum.test 24 Nov 2008 10:02:23 -0000 @@ -51,7 +51,7 @@ class ForumTestCase extends DrupalWebTes // Do basic tests for the any forum user. $this->doBasicTests($this->any_user, TRUE); // Create another forum node for the any forum user. -// $node = $this->drupalCreateNode(array('type' => 'forum', 'uid' => $this->any_user->uid)); +// $node = $this->drupalCreateNode(array('type' => 'forum', 'userid' => $this->any_user->userid)); $node = $this->createForumTopic($this->forum, FALSE); // Do basic tests for the own forum user. @@ -59,7 +59,7 @@ class ForumTestCase extends DrupalWebTes // Verify the own forum user only has access to the forum view node. $this->verifyForums($this->any_user, $node, FALSE, 403); // Create another forum node for the own forum user. -// $node = $this->drupalCreateNode(array('type' => 'forum', 'uid' => $this->own_user->uid)); +// $node = $this->drupalCreateNode(array('type' => 'forum', 'userid' => $this->own_user->userid)); $node = $this->createForumTopic($this->forum, FALSE); // Login the any forum user. Index: modules/menu/menu.test =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.test,v retrieving revision 1.3 diff -u -p -r1.3 menu.test --- modules/menu/menu.test 13 Nov 2008 05:54:35 -0000 1.3 +++ modules/menu/menu.test 24 Nov 2008 10:02:23 -0000 @@ -143,8 +143,8 @@ class MenuTestCase extends DrupalWebTest */ function doMenuTests($menu_name = 'navigation') { // Add nodes to use as links for menu items. - $node1 = $this->drupalCreateNode(array('type' => 'article', 'uid' => $this->big_user->uid)); - $node2 = $this->drupalCreateNode(array('type' => 'article', 'uid' => $this->big_user->uid)); + $node1 = $this->drupalCreateNode(array('type' => 'article', 'userid' => $this->big_user->userid)); + $node2 = $this->drupalCreateNode(array('type' => 'article', 'userid' => $this->big_user->userid)); // Add menu items. $item1 = $this->addMenuItem(0, 'node/' . $node1->nid, $menu_name); Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.30 diff -u -p -r1.30 node.admin.inc --- modules/node/node.admin.inc 22 Nov 2008 14:09:41 -0000 1.30 +++ modules/node/node.admin.inc 24 Nov 2008 10:02:23 -0000 @@ -476,7 +476,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 {users} 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.userid = u.userid '. $filter['where'] . $sort), 50, 0, NULL, $filter['args']); // Build the 'Update options' form. $form['options'] = array( Index: modules/node/node.install =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.install,v retrieving revision 1.8 diff -u -p -r1.8 node.install --- modules/node/node.install 15 Nov 2008 13:01:08 -0000 1.8 +++ modules/node/node.install 24 Nov 2008 10:02:23 -0000 @@ -42,11 +42,11 @@ function node_schema() { 'not null' => TRUE, 'default' => '', ), - 'uid' => array( - 'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.', + 'userid' => array( + 'description' => 'The {users}.userid that owns this node; initially, this is the user that created it.', 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, ), 'status' => array( 'description' => 'Boolean indicating whether the node is published (visible to non-administrators).', @@ -112,7 +112,7 @@ function node_schema() { 'node_status_type' => array('status', 'type', 'nid'), 'node_title_type' => array('title', array('type', 4)), 'node_type' => array(array('type', 4)), - 'uid' => array('uid'), + 'userid' => array('userid'), 'tnid' => array('tnid'), 'translate' => array('translate'), ), @@ -226,11 +226,11 @@ function node_schema() { 'unsigned' => TRUE, 'not null' => TRUE, ), - 'uid' => array( - 'description' => 'The {users}.uid that created this version.', + 'userid' => array( + 'description' => 'The {users}.userid that created this version.', 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, ), 'title' => array( 'description' => 'The title of this version.', @@ -272,7 +272,7 @@ function node_schema() { ), 'indexes' => array( 'nid' => array('nid'), - 'uid' => array('uid'), + 'userid' => array('userid'), ), 'primary key' => array('vid'), ); Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.998 diff -u -p -r1.998 node.module --- modules/node/node.module 22 Nov 2008 14:09:41 -0000 1.998 +++ modules/node/node.module 24 Nov 2008 10:02:23 -0000 @@ -189,12 +189,12 @@ function theme_node_list($items, $title function node_tag_new($nid) { global $user; - if ($user->uid) { + if ($user->userid) { if (node_last_viewed($nid)) { - db_query('UPDATE {history} SET timestamp = %d WHERE uid = %d AND nid = %d', REQUEST_TIME, $user->uid, $nid); + db_query('UPDATE {history} SET timestamp = %d WHERE userid = %d AND nid = %d', REQUEST_TIME, $user->userid, $nid); } else { - @db_query('INSERT INTO {history} (uid, nid, timestamp) VALUES (%d, %d, %d)', $user->uid, $nid, REQUEST_TIME); + @db_query('INSERT INTO {history} (userid, nid, timestamp) VALUES (%d, %d, %d)', $user->userid, $nid, REQUEST_TIME); } } } @@ -208,7 +208,7 @@ function node_last_viewed($nid) { static $history; if (!isset($history[$nid])) { - $history[$nid] = db_fetch_object(db_query("SELECT timestamp FROM {history} WHERE uid = %d AND nid = %d", $user->uid, $nid)); + $history[$nid] = db_fetch_object(db_query("SELECT timestamp FROM {history} WHERE userid = %d AND nid = %d", $user->userid, $nid)); } return (isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0); @@ -228,7 +228,7 @@ function node_mark($nid, $timestamp) { global $user; static $cache; - if (!$user->uid) { + if (!$user->userid) { return MARK_READ; } if (!isset($cache[$nid])) { @@ -784,17 +784,17 @@ function node_load($param = array(), $re $fields = implode(', ', $fields); // Rename timestamp field for clarity. $fields = str_replace('r.timestamp', 'r.timestamp AS revision_timestamp', $fields); - // Change name of revision uid so it doesn't conflict with n.uid. - $fields = str_replace('r.uid', 'r.uid AS revision_uid', $fields); + // Change name of revision userid so it doesn't conflict with n.userid. + $fields = str_replace('r.userid', 'r.userid AS revision_userid', $fields); // Retrieve the node. // No db_rewrite_sql is applied so as to get complete indexing for search. if ($revision) { array_unshift($arguments, $revision); - $node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE ' . $cond, $arguments)); + $node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.userid = n.userid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE ' . $cond, $arguments)); } else { - $node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE ' . $cond, $arguments)); + $node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.userid = n.userid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE ' . $cond, $arguments)); } if ($node && $node->nid) { @@ -887,10 +887,10 @@ function node_submit($node) { if (user_access('administer nodes')) { // Populate the "authored by" field. if ($account = user_load(array('name' => $node->name))) { - $node->uid = $account->uid; + $node->userid = $account->userid; } else { - $node->uid = 0; + $node->userid = 0; } } $node->created = !empty($node->date) ? strtotime($node->date) : REQUEST_TIME; @@ -956,16 +956,16 @@ function node_save(&$node) { // Generate the node table query and the node_revisions table query. if ($node->is_new) { drupal_write_record('node', $node); - _node_save_revision($node, $user->uid); + _node_save_revision($node, $user->userid); $op = 'insert'; } else { drupal_write_record('node', $node, 'nid'); if (!empty($node->revision)) { - _node_save_revision($node, $user->uid); + _node_save_revision($node, $user->userid); } else { - _node_save_revision($node, $user->uid, 'vid'); + _node_save_revision($node, $user->userid, 'vid'); $update_node = FALSE; } $op = 'update'; @@ -988,21 +988,21 @@ function node_save(&$node) { } /** - * Helper function to save a revision with the uid of the current user. + * Helper function to save a revision with the userid of the current user. * * Node is taken by reference, becuse drupal_write_record() updates the * $node with the revision id, and we need to pass that back to the caller. */ -function _node_save_revision(&$node, $uid, $update = NULL) { - $temp_uid = $node->uid; - $node->uid = $uid; +function _node_save_revision(&$node, $userid, $update = NULL) { + $temp_userid = $node->userid; + $node->userid = $userid; if (isset($update)) { drupal_write_record('node_revisions', $node, $update); } else { drupal_write_record('node_revisions', $node); } - $node->uid = $temp_uid; + $node->userid = $temp_userid; } /** @@ -1416,8 +1416,8 @@ function node_ranking() { * Implementation of hook_user_delete(). */ function node_user_delete(&$edit, &$user) { - db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid); - db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid); + db_query('UPDATE {node} SET userid = 0 WHERE userid = %d', $user->userid); + db_query('UPDATE {node_revisions} SET userid = 0 WHERE userid = %d', $user->userid); } /** @@ -1699,7 +1699,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_revisions} 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); + $result = db_query('SELECT r.vid, r.title, r.log, r.userid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revisions} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {users} u ON u.userid = r.userid WHERE r.nid = %d ORDER BY r.timestamp DESC', $node->nid); while ($revision = db_fetch_object($result)) { $revisions[$revision->vid] = $revision; } @@ -2142,7 +2142,7 @@ function node_access($op, $node, $accoun } // Let authors view their own nodes. - if ($op == 'view' && $account->uid == $node->uid && $account->uid != 0) { + if ($op == 'view' && $account->userid == $node->userid && $account->userid != 0) { return TRUE; } @@ -2539,13 +2539,13 @@ function node_content_access($op, $node, } if ($op == 'update') { - if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->uid == $node->uid))) { + if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->userid == $node->userid))) { return TRUE; } } if ($op == 'delete') { - if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->uid == $node->uid))) { + if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->userid == $node->userid))) { return TRUE; } } @@ -2796,23 +2796,23 @@ function node_save_action($node) { * Assigns ownership of a node to a user. */ function node_assign_owner_action(&$node, $context) { - $node->uid = $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)); + $node->userid = $context['owner_userid']; + $owner_name = db_result(db_query("SELECT name FROM {users} WHERE userid = %d", $context['owner_userid'])); + watchdog('action', 'Changed owner of @type %title to userid %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 {users}")); $owner_name = ''; - if (isset($context['owner_uid'])) { - $owner_name = db_result(db_query("SELECT name FROM {users} WHERE uid = %d", $context['owner_uid'])); + if (isset($context['owner_userid'])) { + $owner_name = db_result(db_query("SELECT name FROM {users} WHERE userid = %d", $context['owner_userid'])); } // 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 {users} WHERE uid > 0 ORDER BY name"); + $result = db_query("SELECT userid, name FROM {users} WHERE userid > 0 ORDER BY name"); while ($data = db_fetch_object($result)) { $options[$data->name] = $data->name; } @@ -2847,8 +2847,8 @@ function node_assign_owner_action_valida 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 {users} WHERE name = '%s'", $form_state['values']['owner_name'])); - return array('owner_uid' => $uid); + $userid = db_result(db_query("SELECT userid from {users} WHERE name = '%s'", $form_state['values']['owner_name'])); + return array('owner_userid' => $userid); } function node_unpublish_by_keyword_action_form($context) { Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.45 diff -u -p -r1.45 node.pages.inc --- modules/node/node.pages.inc 13 Oct 2008 00:33:03 -0000 1.45 +++ modules/node/node.pages.inc 24 Nov 2008 10:02:23 -0000 @@ -57,7 +57,7 @@ function node_add($type) { // If a node type has been specified, validate its existence. if (isset($types[$type]) && node_access('create', $type)) { // Initialize settings: - $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => ''); + $node = array('userid' => $user->userid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => ''); drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH); $output = drupal_get_form($type . '_node_form', $node); @@ -79,7 +79,7 @@ function node_object_prepare(&$node) { $node->$key = in_array($key, $node_options); } global $user; - $node->uid = $user->uid; + $node->userid = $user->userid; $node->created = REQUEST_TIME; } else { @@ -123,7 +123,7 @@ function node_form(&$form_state, $node) // Basic node information. // These elements are just values so they are not even sent to the client. - foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) { + foreach (array('nid', 'vid', 'userid', 'created', 'type', 'language') as $key) { $form[$key] = array( '#type' => 'value', '#value' => isset($node->$key) ? $node->$key : NULL, @@ -225,7 +225,7 @@ function node_form(&$form_state, $node) ); // These values are used when the user has no administrator access. - foreach (array('uid', 'created') as $key) { + foreach (array('userid', 'created') as $key) { $form[$key] = array( '#type' => 'value', '#value' => $node->$key, @@ -349,15 +349,15 @@ function node_preview($node) { // The use of isset() is mandatory in the context of user IDs, because // user ID 0 denotes the anonymous user. if ($user = user_load(array('name' => $node->name))) { - $node->uid = $user->uid; + $node->userid = $user->userid; $node->picture = $user->picture; } else { - $node->uid = 0; // anonymous user + $node->userid = 0; // anonymous user } } - elseif ($node->uid) { - $user = user_load(array('uid' => $node->uid)); + elseif ($node->userid) { + $user = user_load(array('userid' => $node->userid)); $node->name = $user->name; $node->picture = $user->picture; } Index: modules/node/node.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.tpl.php,v retrieving revision 1.5 diff -u -p -r1.5 node.tpl.php --- modules/node/node.tpl.php 13 Oct 2008 12:31:42 -0000 1.5 +++ modules/node/node.tpl.php 24 Nov 2008 10:02:23 -0000 @@ -24,7 +24,7 @@ * - $node: Full node object. Contains data that may not be safe. * - $type: Node type, i.e. story, page, blog, etc. * - $comment_count: Number of comments attached to the node. - * - $uid: User ID of the node author. + * - $userid: User ID of the node author. * - $created: Time the node was published formatted in Unix timestamp. * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in * teaser listings. @@ -70,4 +70,4 @@ - \ No newline at end of file + Index: modules/openid/openid.module =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v retrieving revision 1.33 diff -u -p -r1.33 openid.module --- modules/openid/openid.module 22 Nov 2008 10:32:42 -0000 1.33 +++ modules/openid/openid.module 24 Nov 2008 10:02:24 -0000 @@ -386,7 +386,7 @@ function openid_authentication($response $identity = $response['openid.claimed_id']; $account = user_external_load($identity); - if (isset($account->uid)) { + if (isset($account->userid)) { if (!variable_get('user_email_verification', TRUE) || $account->login) { user_external_login($account, $_SESSION['openid']['user_login_values']); } Index: modules/openid/openid.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.pages.inc,v retrieving revision 1.12 diff -u -p -r1.12 openid.pages.inc --- modules/openid/openid.pages.inc 22 Nov 2008 10:32:42 -0000 1.12 +++ modules/openid/openid.pages.inc 24 Nov 2008 10:02:24 -0000 @@ -35,16 +35,16 @@ function openid_user_identities($account $result = openid_complete(); if ($result['status'] == 'success') { $identity = $result['openid.claimed_id']; - db_query("INSERT INTO {authmap} (uid, authname, module) VALUES (%d, '%s','openid')", $account->uid, $identity); + db_query("INSERT INTO {authmap} (userid, authname, module) VALUES (%d, '%s','openid')", $account->userid, $identity); drupal_set_message(t('Successfully added %identity', array('%identity' => $identity))); } $header = array(t('OpenID'), t('Operations')); $rows = array(); - $result = db_query("SELECT * FROM {authmap} WHERE module='openid' AND uid=%d", $account->uid); + $result = db_query("SELECT * FROM {authmap} WHERE module='openid' AND userid=%d", $account->userid); while ($identity = db_fetch_object($result)) { - $rows[] = array(check_plain($identity->authname), l(t('Delete'), 'user/' . $account->uid . '/openid/delete/' . $identity->aid)); + $rows[] = array(check_plain($identity->authname), l(t('Delete'), 'user/' . $account->userid . '/openid/delete/' . $identity->aid)); } $output = theme('table', $header, $rows); @@ -83,15 +83,15 @@ function openid_user_add_validate($form, * Menu callback; Delete the specified OpenID identity from the system. */ function openid_user_delete_form($form_state, $account, $aid = 0) { - $authname = db_result(db_query('SELECT authname FROM {authmap} WHERE uid = %d AND aid = %d', $account->uid, $aid)); - return confirm_form(array(), t('Are you sure you want to delete the OpenID %authname for %user?', array('%authname' => $authname, '%user' => $account->name)), 'user/'. $account->uid .'/openid'); + $authname = db_result(db_query('SELECT authname FROM {authmap} WHERE userid = %d AND aid = %d', $account->userid, $aid)); + return confirm_form(array(), t('Are you sure you want to delete the OpenID %authname for %user?', array('%authname' => $authname, '%user' => $account->name)), 'user/'. $account->userid .'/openid'); } function openid_user_delete_form_submit(&$form_state, $form_values) { - db_query("DELETE FROM {authmap} WHERE uid = %d AND aid = %d AND module = 'openid'", $form_state['#parameters'][2]->uid, $form_state['#parameters'][3]); + db_query("DELETE FROM {authmap} WHERE userid = %d AND aid = %d AND module = 'openid'", $form_state['#parameters'][2]->userid, $form_state['#parameters'][3]); if (db_affected_rows()) { drupal_set_message(t('OpenID deleted.')); } - $form_state['#redirect'] = 'user/'. $form_state['#parameters'][2]->uid .'/openid'; + $form_state['#redirect'] = 'user/'. $form_state['#parameters'][2]->userid .'/openid'; } Index: modules/php/php.module =================================================================== RCS file: /cvs/drupal/drupal/modules/php/php.module,v retrieving revision 1.11 diff -u -p -r1.11 php.module --- modules/php/php.module 19 Sep 2008 07:53:59 -0000 1.11 +++ modules/php/php.module 24 Nov 2008 10:02:24 -0000 @@ -51,7 +51,7 @@ print t(\'Welcome visitor! Thank you for $output .= '
  • ' . t('

    To display the name of a registered user, use this instead:

     global $user;
    -if ($user->uid) {
    +if ($user->userid) {
       print t(\'Welcome @name! Thank you for visiting.\', array(\'@name\' => $user->name));
     }
     else {
    Index: modules/php/php.test
    ===================================================================
    RCS file: /cvs/drupal/drupal/modules/php/php.test,v
    retrieving revision 1.5
    diff -u -p -r1.5 php.test
    --- modules/php/php.test	20 Oct 2008 13:04:27 -0000	1.5
    +++ modules/php/php.test	24 Nov 2008 10:02:24 -0000
    @@ -28,7 +28,7 @@ class PHPTestCase extends DrupalWebTestC
        * @return stdObject Node object.
        */
       function createNodeWithCode($user) {
    -    $node = $this->drupalCreateNode(array('uid' => $user->uid));
    +    $node = $this->drupalCreateNode(array('userid' => $user->userid));
         $edit = array();
         $edit['body'] = '';
         $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
    @@ -115,4 +115,4 @@ class PHPAccessTestCase extends PHPTestC
         $this->drupalGet('node/' . $node->nid . '/edit');
         $this->assertNoFieldByName('body_format', '3', t('Format not available.'));
       }
    -}
    \ No newline at end of file
    +}
    Index: modules/poll/poll.install
    ===================================================================
    RCS file: /cvs/drupal/drupal/modules/poll/poll.install,v
    retrieving revision 1.16
    diff -u -p -r1.16 poll.install
    --- modules/poll/poll.install	15 Nov 2008 13:01:08 -0000	1.16
    +++ modules/poll/poll.install	24 Nov 2008 10:02:24 -0000
    @@ -106,12 +106,11 @@ function poll_schema() {
             'not null' => TRUE,
             'description' => 'The {poll} node this vote is for.',
           ),
    -      'uid' => array(
    +      'userid' => array(
             'type' => 'int',
             'unsigned' => TRUE,
             'not null' => TRUE,
    -        'default' => 0,
    -        'description' => 'The {users}.uid this vote is from unless the voter was anonymous.',
    +        'description' => 'The {users}.userid this vote is from unless the voter was anonymous.',
           ),
           'hostname' => array(
             'type' => 'varchar',
    @@ -121,13 +120,36 @@ function poll_schema() {
             'description' => 'The IP address this vote is from unless the voter was logged in.',
           ),
         ),
    -    'primary key' => array('nid', 'uid', 'hostname'),
    +    'primary key' => array('nid', 'userid', 'hostname'),
         'indexes' => array(
           'chid'     => array('chid'),
           'hostname' => array('hostname'),
    -      'uid' => array('uid'),
    +      'userid' => array('userid'),
         ),
       );
     
       return $schema;
     }
    +
    +/**
    + * @defgroup updates-6.x-to-7.x Poll updates from 6.x to 7.x
    + * @{
    + */
    +
    +/**
    + * Replace Oracle reserved word 'uid'.
    + */
    +function poll_update_7000(() {
    +  $ret = array();
    +  db_drop_primary_key($ret, 'poll_votes');
    +  db_drop_index($ret, 'poll_votes', 'uid');
    +  db_change_field($ret, 'poll_votes', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE));
    +  db_add_index($ret, 'poll_votes', 'userid', array('userid'));
    +  db_add_primary_key($ret, 'poll_votes', array('nid', 'userid', 'hostname'));
    +  return $ret;
    +}
    +
    +/**
    + * @} End of "defgroup updates-6.x-to-7.x"
    + * The next series of updates should start at 8000.
    + */
    Index: modules/poll/poll.module
    ===================================================================
    RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v
    retrieving revision 1.277
    diff -u -p -r1.277 poll.module
    --- modules/poll/poll.module	12 Oct 2008 04:30:07 -0000	1.277
    +++ modules/poll/poll.module	24 Nov 2008 10:02:24 -0000
    @@ -81,9 +81,9 @@ function poll_access($op, $node, $accoun
         case 'create':
           return user_access('create poll content', $account);
         case 'update':
    -      return user_access('edit any poll content', $account) || (user_access('edit own poll content', $account) && ($node->uid == $account->uid));
    +      return user_access('edit any poll content', $account) || (user_access('edit own poll content', $account) && ($node->userid == $account->userid));
         case 'delete':
    -      return user_access('delete any poll content', $account) || (user_access('delete own poll content', $account) && ($node->uid == $account->uid));
    +      return user_access('delete any poll content', $account) || (user_access('delete own poll content', $account) && ($node->userid == $account->userid));
       }
     }
     
    @@ -197,7 +197,7 @@ function poll_node_info() {
     function poll_form(&$node, $form_state) {
       global $user;
     
    -  $admin = user_access('administer nodes') || user_access('edit any poll content') || (user_access('edit own poll content') && $user->uid == $node->uid);
    +  $admin = user_access('administer nodes') || user_access('edit any poll content') || (user_access('edit own poll content') && $user->userid == $node->userid);
     
       $type = node_get_types('type', $node);
     
    @@ -465,8 +465,8 @@ function poll_load($node) {
       // Determine whether or not this user is allowed to vote.
       $poll->allowvotes = FALSE;
       if (user_access('vote on polls') && $poll->active) {
    -    if ($user->uid) {
    -      $result = db_fetch_object(db_query('SELECT chid FROM {poll_votes} WHERE nid = %d AND uid = %d', $node->nid, $user->uid));
    +    if ($user->userid) {
    +      $result = db_fetch_object(db_query('SELECT chid FROM {poll_votes} WHERE nid = %d AND userid = %d', $node->nid, $user->userid));
         }
         else {
           $result = db_fetch_object(db_query("SELECT chid FROM {poll_votes} WHERE nid = %d AND hostname = '%s'", $node->nid, ip_address()));
    @@ -647,8 +647,8 @@ function poll_vote($form, &$form_state) 
       $choice = $form_state['values']['choice'];
     
       global $user;
    -  if ($user->uid) {
    -    db_query('INSERT INTO {poll_votes} (nid, chid, uid) VALUES (%d, %d, %d)', $node->nid, $choice, $user->uid);
    +  if ($user->userid) {
    +    db_query('INSERT INTO {poll_votes} (nid, chid, userid) VALUES (%d, %d, %d)', $node->nid, $choice, $user->userid);
       }
       else {
         db_query("INSERT INTO {poll_votes} (nid, chid, hostname) VALUES (%d, %d, '%s')", $node->nid, $choice, ip_address());
    @@ -822,8 +822,8 @@ function poll_cancel($form, &$form_state
       $node = node_load($form['#nid']);
       global $user;
     
    -  if ($user->uid) {
    -    db_query('DELETE FROM {poll_votes} WHERE nid = %d and uid = %d', $node->nid, $user->uid);
    +  if ($user->userid) {
    +    db_query('DELETE FROM {poll_votes} WHERE nid = %d and userid = %d', $node->nid, $user->userid);
       }
       else {
         db_query("DELETE FROM {poll_votes} WHERE nid = %d and hostname = '%s'", $node->nid, ip_address());
    @@ -837,6 +837,6 @@ function poll_cancel($form, &$form_state
      * Implementation of hook_user_delete().
      */
     function poll_user_delete(&$edit, &$user) {
    -  db_query('UPDATE {poll_votes} SET uid = 0 WHERE uid = %d', $user->uid);
    +  db_query('UPDATE {poll_votes} SET userid = 0 WHERE userid = %d', $user->userid);
     }
     
    Index: modules/poll/poll.pages.inc
    ===================================================================
    RCS file: /cvs/drupal/drupal/modules/poll/poll.pages.inc,v
    retrieving revision 1.9
    diff -u -p -r1.9 poll.pages.inc
    --- modules/poll/poll.pages.inc	13 Oct 2008 00:33:03 -0000	1.9
    +++ modules/poll/poll.pages.inc	24 Nov 2008 10:02:24 -0000
    @@ -35,7 +35,7 @@ function poll_votes($node) {
       $header[] = array('data' => t('Vote'), 'field' => 'pv.chorder');
       $header[] = array('data' => t('Vote'), 'field' => 'pc.weight');
     
    -  $result = pager_query("SELECT pv.chid, pv.uid, pv.hostname, u.name FROM {poll_votes} pv INNER JOIN {poll_choices} 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);
    +  $result = pager_query("SELECT pv.chid, pv.userid, pv.hostname, u.name FROM {poll_votes} pv INNER JOIN {poll_choices} pc ON pv.chid = pc.chid LEFT JOIN {users} u ON pv.userid = u.userid WHERE pv.nid = %d". tablesort_sql($header), 20, 0, NULL, $node->nid);
       $rows = array();
       while ($vote = db_fetch_object($result)) {
         $rows[] = array(
    Index: modules/profile/profile.install
    ===================================================================
    RCS file: /cvs/drupal/drupal/modules/profile/profile.install,v
    retrieving revision 1.14
    diff -u -p -r1.14 profile.install
    --- modules/profile/profile.install	15 Nov 2008 13:01:08 -0000	1.14
    +++ modules/profile/profile.install	24 Nov 2008 10:02:24 -0000
    @@ -127,12 +127,11 @@ function profile_schema() {
             'default' => 0,
             'description' => 'The {profile_fields}.fid of the field.',
           ),
    -      'uid' => array(
    +      'userid' => array(
             'type' => 'int',
             'unsigned' => TRUE,
             'not null' => TRUE,
    -        'default' => 0,
    -        'description' => 'The {users}.uid of the profile user.',
    +        'description' => 'The {users}.userid of the profile user.',
           ),
           'value' => array(
             'type' => 'text',
    @@ -140,7 +139,7 @@ function profile_schema() {
             'description' => 'The value for the field.',
           ),
         ),
    -    'primary key' => array('uid', 'fid'),
    +    'primary key' => array('userid', 'fid'),
         'indexes' => array(
           'fid' => array('fid'),
         ),
    @@ -148,3 +147,24 @@ function profile_schema() {
     
       return $schema;
     }
    +
    +/**
    + * @defgroup updates-6.x-to-7.x Profile updates from 6.x to 7.x
    + * @{
    + */
    +
    +/**
    + * Replace Oracle reserved word 'uid'.
    + */
    +function profile_update_7000(() {
    +  $ret = array();
    +  db_drop_primary_key($ret, 'profile_values');
    +  db_change_field($ret, 'profile_values', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE));
    +  db_add_primary_key($ret, 'profile_values', array('userid', 'fid'));
    +  return $ret;
    +}
    +
    +/**
    + * @} End of "defgroup updates-6.x-to-7.x"
    + * The next series of updates should start at 8000.
    + */
    Index: modules/profile/profile.module
    ===================================================================
    RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
    retrieving revision 1.246
    diff -u -p -r1.246 profile.module
    --- modules/profile/profile.module	12 Oct 2008 04:30:08 -0000	1.246
    +++ modules/profile/profile.module	24 Nov 2008 10:02:24 -0000
    @@ -160,7 +160,7 @@ function profile_block($op = 'list', $de
           $output = '';
           if ((arg(0) == 'node') && is_numeric(arg(1)) && (arg(2) == NULL)) {
             $node = node_load(arg(1));
    -        $account = user_load(array('uid' => $node->uid));
    +        $account = user_load(array('userid' => $node->userid));
     
             if ($use_fields = variable_get('profile_block_author_fields', array())) {
               // Compile a list of fields to show.
    @@ -180,7 +180,7 @@ function profile_block($op = 'list', $de
             }
     
             if (isset($use_fields['user_profile']) && $use_fields['user_profile']) {
    -          $output .= '
    ' . l(t('View full user profile'), 'user/' . $account->uid) . '
    '; + $output .= '
    ' . l(t('View full user profile'), 'user/' . $account->userid) . '
    '; } } @@ -253,11 +253,11 @@ function profile_user_categories(&$edit, * Implementation of hook_user_delete(). */ function profile_user_delete(&$edit, &$user, $category = NULL) { - db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid); + db_query('DELETE FROM {profile_values} WHERE userid = %d', $user->userid); } function profile_load_profile(&$user) { - $result = db_query('SELECT f.name, f.type, v.value FROM {profile_fields} f INNER JOIN {profile_values} v ON f.fid = v.fid WHERE uid = %d', $user->uid); + $result = db_query('SELECT f.name, f.type, v.value FROM {profile_fields} f INNER JOIN {profile_values} v ON f.fid = v.fid WHERE userid = %d', $user->userid); while ($field = db_fetch_object($result)) { if (empty($user->{$field->name})) { $user->{$field->name} = _profile_field_serialize($field->type) ? unserialize($field->value) : $field->value; @@ -271,8 +271,8 @@ function profile_save_profile(&$edit, &$ if (_profile_field_serialize($field->type)) { $edit[$field->name] = serialize($edit[$field->name]); } - db_query("DELETE FROM {profile_values} WHERE fid = %d AND uid = %d", $field->fid, $user->uid); - db_query("INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')", $field->fid, $user->uid, $edit[$field->name]); + db_query("DELETE FROM {profile_values} WHERE fid = %d AND userid = %d", $field->fid, $user->userid); + db_query("INSERT INTO {profile_values} (fid, userid, value) VALUES (%d, %d, '%s')", $field->fid, $user->userid, $edit[$field->name]); // Mark field as handled (prevents saving to user->data). $edit[$field->name] = NULL; } @@ -330,7 +330,7 @@ function profile_view_profile(&$user) { profile_load_profile($user); // Show private fields to administrators and people viewing their own account. - if (user_access('administer users') || $GLOBALS['user']->uid == $user->uid) { + if (user_access('administer users') || $GLOBALS['user']->userid == $user->userid) { $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_HIDDEN); } else { @@ -498,7 +498,7 @@ function profile_categories() { * Menu item access callback - check if a user has access to a profile category. */ function profile_category_access($account, $category) { - if (user_access('administer users') && $account->uid > 0) { + if (user_access('administer users') && $account->userid > 0) { return TRUE; } else { Index: modules/profile/profile.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.pages.inc,v retrieving revision 1.9 diff -u -p -r1.9 profile.pages.inc --- modules/profile/profile.pages.inc 2 Nov 2008 16:11:31 -0000 1.9 +++ modules/profile/profile.pages.inc 24 Nov 2008 10:02:24 -0000 @@ -55,11 +55,11 @@ function profile_browse() { } // Extract the affected users: - $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_values} 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.userid, u.access FROM {users} u INNER JOIN {profile_values} v ON u.userid = v.userid 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)) { - $account = user_load(array('uid' => $account->uid)); + $account = user_load(array('userid' => $account->userid)); $profile = _profile_update_user_fields($fields, $account); $content .= theme('profile_listing', $account, $profile); } @@ -88,11 +88,11 @@ function profile_browse() { } // Extract the affected users: - $result = pager_query('SELECT uid, access FROM {users} WHERE uid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL); + $result = pager_query('SELECT userid, access FROM {users} WHERE userid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL); $content = ''; while ($account = db_fetch_object($result)) { - $account = user_load(array('uid' => $account->uid)); + $account = user_load(array('userid' => $account->userid)); $profile = _profile_update_user_fields($fields, $account); $content .= theme('profile_listing', $account, $profile); } Index: modules/profile/profile.test =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.test,v retrieving revision 1.7 diff -u -p -r1.7 profile.test --- modules/profile/profile.test 10 Oct 2008 07:49:49 -0000 1.7 +++ modules/profile/profile.test 24 Nov 2008 10:02:24 -0000 @@ -41,7 +41,7 @@ class ProfileTestCase extends DrupalWebT $this->assertTrue($fid, t('New Profile field has been entered in the database')); // Check that the new field is appearing on the user edit form. - $this->drupalGet('user/' . $this->admin_user->uid . '/edit/' . $category); + $this->drupalGet('user/' . $this->admin_user->userid . '/edit/' . $category); // Checking field. if ($type == 'date') { @@ -86,10 +86,10 @@ class ProfileTestCase extends DrupalWebT $edit = array( $field['form_name'] => $value, ); - $this->drupalPost('user/' . $this->normal_user->uid . '/edit/' . $field['category'], $edit, t('Save')); + $this->drupalPost('user/' . $this->normal_user->userid . '/edit/' . $field['category'], $edit, t('Save')); // Check profile page. - $content = $this->drupalGet('user/' . $this->normal_user->uid); + $content = $this->drupalGet('user/' . $this->normal_user->userid); $this->assertText($field['title'], t('Found profile field with title %title', array('%title' => $field['title']))); if ($field['type'] != 'checkbox') { @@ -206,10 +206,10 @@ class ProfileTestDate extends ProfileTes $field['form_name'] . '[year]' => 1983, ); - $this->drupalPost('user/' . $this->normal_user->uid . '/edit/' . $field['category'], $edit, t('Save')); + $this->drupalPost('user/' . $this->normal_user->userid . '/edit/' . $field['category'], $edit, t('Save')); // Check profile page. - $this->drupalGet('user/' . $this->normal_user->uid); + $this->drupalGet('user/' . $this->normal_user->userid); $this->assertText($field['title'], t('Found profile field with title %title', array('%title' => $field['title']))); $this->assertText('01/09/1983', t('Found date profile field.')); @@ -240,10 +240,10 @@ class ProfileTestWeights extends Profile $this->setProfileField($field1, $this->randomName(4, 'first_')); $this->setProfileField($field2, $this->randomName(4, 'second_')); - $profile_edit = $this->drupalGet('user/' . $this->normal_user->uid . '/edit/' . $category); + $profile_edit = $this->drupalGet('user/' . $this->normal_user->userid . '/edit/' . $category); $this->assertTrue(strpos($profile_edit, $field1['title']) > strpos($profile_edit, $field2['title']), t('Profile field weights are respected on the user edit form.')); - $profile_page = $this->drupalGet('user/' . $this->normal_user->uid); + $profile_page = $this->drupalGet('user/' . $this->normal_user->userid); $this->assertTrue(strpos($profile_page, $field1['title']) > strpos($profile_page, $field2['title']), t('Profile field weights are respected on the user profile page.')); } } @@ -283,7 +283,7 @@ class ProfileTestAutocomplete extends Pr $field_html = ''; // Check that autocompletion html is found on the user's profile edit page. - $this->drupalGet('user/' . $this->admin_user->uid . '/edit/' . $category); + $this->drupalGet('user/' . $this->admin_user->userid . '/edit/' . $category); $this->assertRaw($autocomplete_html, t('Autocomplete found.')); $this->assertRaw('misc/autocomplete.js', t('Autocomplete JavaScript found.')); $this->assertRaw('class="form-text form-autocomplete"', t('Autocomplete form element class found.')); @@ -299,7 +299,7 @@ class ProfileTestAutocomplete extends Pr $this->drupalLogin($this->normal_user); // Check that autocompletion html is not found on the user's profile edit page. - $this->drupalGet('user/' . $this->normal_user->uid . '/edit/' . $category); + $this->drupalGet('user/' . $this->normal_user->userid . '/edit/' . $category); $this->assertNoRaw($autocomplete_html, t('Autocomplete not found.')); // User should be denied access to the profile autocomplete path. Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.59 diff -u -p -r1.59 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 24 Nov 2008 04:22:02 -0000 1.59 +++ modules/simpletest/drupal_web_test_case.php 24 Nov 2008 10:02:24 -0000 @@ -387,9 +387,9 @@ class DrupalWebTestCase { if (isset($defaults['created'])) { $defaults['date'] = format_date($defaults['created'], 'custom', 'Y-m-d H:i:s O'); } - if (empty($settings['uid'])) { + if (empty($settings['userid'])) { global $user; - $defaults['uid'] = $user->uid; + $defaults['userid'] = $user->userid; } $node = ($settings + $defaults); $node = (object)$node; @@ -397,7 +397,7 @@ class DrupalWebTestCase { node_save($node); // small hack to link revisions to our test user - db_query('UPDATE {node_revisions} SET uid = %d WHERE vid = %d', $node->uid, $node->vid); + db_query('UPDATE {node_revisions} SET userid = %d WHERE vid = %d', $node->userid, $node->vid); return $node; } @@ -547,8 +547,8 @@ class DrupalWebTestCase { $account = user_save('', $edit); - $this->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login')); - if (empty($account->uid)) { + $this->assertTrue(!empty($account->userid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login')); + if (empty($account->userid)) { return FALSE; } Index: modules/simpletest/tests/file.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/file.test,v retrieving revision 1.12 diff -u -p -r1.12 file.test --- modules/simpletest/tests/file.test 16 Nov 2008 19:41:14 -0000 1.12 +++ modules/simpletest/tests/file.test 24 Nov 2008 10:02:24 -0000 @@ -83,7 +83,7 @@ class FileTestCase extends DrupalWebTest $file->filepath = $filepath; $file->filename = basename($file->filepath); $file->filemime = 'text/plain'; - $file->uid = 1; + $file->userid = 1; $file->timestamp = REQUEST_TIME; $file->filesize = filesize($file->filepath); $file->status = FILE_STATUS_TEMPORARY; @@ -267,13 +267,13 @@ class FileValidatorTest extends DrupalWe $original_user = $user; drupal_save_session(FALSE); - // Run these test as uid = 1. - $user = user_load(array('uid' => 1)); + // Run these test as userid = 1. + $user = user_load(array('userid' => 1)); $file = new stdClass(); $file->filesize = 999999; $errors = file_validate_size($file, 1, 1); - $this->assertEqual(count($errors), 0, t('No size limits enforced on uid=1.'), 'File'); + $this->assertEqual(count($errors), 0, t('No size limits enforced on userid=1.'), 'File'); // Run these tests as a regular user. $user = $this->drupalCreateUser(); @@ -944,7 +944,7 @@ class FileLoadTest extends FileHookTestC function testFileLoad() { // Create a new file object. $file = array( - 'uid' => 1, + 'userid' => 1, 'filename' => 'druplicon.png', 'filepath' => 'misc/druplicon.png', 'filemime' => 'image/png', @@ -992,7 +992,7 @@ class FileSaveTest extends FileHookTestC function testFileSave() { // Create a new file object. $file = array( - 'uid' => 1, + 'userid' => 1, 'filename' => 'druplicon.png', 'filepath' => 'misc/druplicon.png', 'filemime' => 'image/png', @@ -1112,4 +1112,4 @@ class FileSaveDataTest extends FileHookT $file = file_save_data($contents, 'asdf.txt', FILE_EXISTS_ERROR); $this->assertFalse($file, t("Overwriting a file fails when FILE_EXISTS_ERROR is specified.")); } -} \ No newline at end of file +} Index: modules/simpletest/tests/menu.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu.test,v retrieving revision 1.3 diff -u -p -r1.3 menu.test --- modules/simpletest/tests/menu.test 20 Nov 2008 07:18:59 -0000 1.3 +++ modules/simpletest/tests/menu.test 24 Nov 2008 10:02:24 -0000 @@ -51,7 +51,7 @@ class MenuRebuildTestCase extends Drupal 'group' => t('Menu'), ); } - + /** * Test if the 'menu_rebuild_needed' variable triggers a menu_rebuild() call. */ @@ -75,5 +75,5 @@ class MenuRebuildTestCase extends Drupal $admin_exists = db_result(db_query("SELECT path from {menu_router} WHERE path = 'admin'")); $this->assertEqual($admin_exists, 'admin', t("The menu has been rebuilt, the path 'admin' now exists again.")); } - + } Index: modules/simpletest/tests/session.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/session.test,v retrieving revision 1.5 diff -u -p -r1.5 session.test --- modules/simpletest/tests/session.test 24 Nov 2008 06:12:45 -0000 1.5 +++ modules/simpletest/tests/session.test 24 Nov 2008 10:02:24 -0000 @@ -91,7 +91,7 @@ class SessionTestCase extends DrupalWebT function testDataPersistence() { $user = $this->drupalCreateUser(array('access content')); // Enable sessions. - $this->sessionReset($user->uid); + $this->sessionReset($user->userid); $this->drupalLogin($user); $this->session_count_authenticated = $this->session_count++; @@ -112,7 +112,7 @@ class SessionTestCase extends DrupalWebT // Switch browser cookie to anonymous user, then back to user 1. $this->sessionReset(); - $this->sessionReset($user->uid); + $this->sessionReset($user->userid); $this->assertText($value_1, t('Session data persists through browser close.'), t('Session')); // Logout the user and make sure the stored value no longer persists. @@ -138,13 +138,13 @@ class SessionTestCase extends DrupalWebT // Logout and get first user back in. Sessions shouldn't persist through // logout, so the data won't be on the page. $this->drupalLogin($user); - $this->sessionReset($user->uid); + $this->sessionReset($user->userid); $this->drupalGet('session-test/get'); $this->assertNoText($value_1, t('Session has persisted for an authenticated user after logging out and then back in.'), t('Session')); // Logout and create another user. $user2 = $this->drupalCreateUser(array('access content')); - $this->sessionReset($user2->uid); + $this->sessionReset($user2->userid); $this->drupalLogin($user2); $this->session_count_authenticated = $this->session_count++; @@ -168,14 +168,14 @@ class SessionTestCase extends DrupalWebT /** * Reset the cookie file so that it refers to the specified user. * - * @param $uid User id to set as the active session. + * @param $userid User id to set as the active session. */ - function sessionReset($uid = 0) { + function sessionReset($userid = 0) { // Close the internal browser. $this->curlClose(); // Change cookie file for user. - $this->cookie_file = file_directory_temp() . '/cookie.' . $uid . '.txt'; + $this->cookie_file = file_directory_temp() . '/cookie.' . $userid . '.txt'; $this->curl_options[CURLOPT_COOKIEFILE] = $this->cookie_file; $this->curl_options[CURLOPT_COOKIESESSION] = TRUE; $this->drupalGet('session-test/get'); Index: modules/statistics/statistics.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v retrieving revision 1.14 diff -u -p -r1.14 statistics.admin.inc --- modules/statistics/statistics.admin.inc 13 Oct 2008 00:33:04 -0000 1.14 +++ modules/statistics/statistics.admin.inc 24 Nov 2008 10:02:24 -0000 @@ -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 {users} u ON u.uid = a.uid' . tablesort_sql($header); + $sql = 'SELECT a.aid, a.path, a.title, a.userid, u.name, a.timestamp FROM {accesslog} a LEFT JOIN {users} u ON u.userid = a.userid' . tablesort_sql($header); $result = pager_query($sql, 30); $rows = array(); @@ -82,15 +82,15 @@ 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 {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(uid, hostname))) FROM {accesslog}"; + $sql = "SELECT COUNT(a.userid) AS hits, a.userid, 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.userid = u.userid GROUP BY a.hostname, a.userid, u.name, bl.iid" . tablesort_sql($header); + $sql_cnt = "SELECT COUNT(DISTINCT(CONCAT(userid, hostname))) FROM {accesslog}"; $result = pager_query($sql, 30, 0, $sql_cnt); $rows = array(); while ($account = db_fetch_object($result)) { $qs = drupal_get_destination(); $ban_link = $account->iid ? l(t('unblock IP address'), "admin/settings/ip-blocking/delete/$account->iid", array('query' => $qs)) : l(t('block IP address'), "admin/settings/ip-blocking/$account->hostname", array('query' => $qs)); - $rows[] = array($account->hits, ($account->uid ? theme('username', $account) : $account->hostname), format_interval(round($account->total / 1000)), (user_access('block IP addresses') && !$account->uid) ? $ban_link : ''); + $rows[] = array($account->hits, ($account->userid ? theme('username', $account) : $account->hostname), format_interval(round($account->total / 1000)), (user_access('block IP addresses') && !$account->userid) ? $ban_link : ''); } if (empty($rows)) { @@ -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 {users} 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.userid = u.userid WHERE aid = %d', $aid); if ($access = db_fetch_object($result)) { $rows[] = array( array('data' => t('URL'), 'header' => TRUE), Index: modules/statistics/statistics.install =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.install,v retrieving revision 1.14 diff -u -p -r1.14 statistics.install --- modules/statistics/statistics.install 15 Nov 2008 13:01:09 -0000 1.14 +++ modules/statistics/statistics.install 24 Nov 2008 10:02:24 -0000 @@ -87,12 +87,11 @@ function statistics_schema() { 'not null' => FALSE, 'description' => 'Hostname of user that visited the page.', ), - 'uid' => array( + 'userid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, - 'default' => 0, - 'description' => 'User {users}.uid that visited the page.', + 'description' => 'User {users}.userid that visited the page.', ), 'timer' => array( 'type' => 'int', @@ -111,7 +110,7 @@ function statistics_schema() { ), 'indexes' => array( 'accesslog_timestamp' => array('timestamp'), - 'uid' => array('uid'), + 'userid' => array('userid'), ), 'primary key' => array('aid'), ); @@ -119,3 +118,23 @@ function statistics_schema() { return $schema; } +/** + * @defgroup updates-6.x-to-7.x Statistics updates from 6.x to 7.x + * @{ + */ + +/** + * Replace Oracle reserved word 'uid'. + */ +function statistics_update_7000(() { + $ret = array(); + db_drop_index($ret, 'accesslog', 'uid'); + db_change_field($ret, 'accesslog', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE)); + db_add_index($ret, 'accesslog', 'userid', array('userid')); + return $ret; +} + +/** + * @} End of "defgroup updates-6.x-to-7.x" + * The next series of updates should start at 8000. + */ Index: modules/statistics/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v retrieving revision 1.286 diff -u -p -r1.286 statistics.module --- modules/statistics/statistics.module 9 Oct 2008 15:15:53 -0000 1.286 +++ modules/statistics/statistics.module 24 Nov 2008 10:02:24 -0000 @@ -71,7 +71,7 @@ function statistics_exit() { 'path' => $_GET['q'], 'url' => $_SERVER['HTTP_REFERER'], 'hostname' => ip_address(), - 'uid' => $user->uid, + 'userid' => $user->userid, 'sid' => session_id(), 'timer' => timer_read('page'), 'timestamp' => REQUEST_TIME, @@ -183,7 +183,7 @@ function statistics_menu() { * Implementation of hook_user_delete(). */ function statistics_user_delete(&$edit, &$user, $category) { - db_query('UPDATE {accesslog} SET uid = 0 WHERE uid = %d', $user->uid); + db_query('UPDATE {accesslog} SET userid = 0 WHERE userid = %d', $user->userid); } /** @@ -215,12 +215,12 @@ function statistics_cron() { * number of rows to be returned. * * @return - * A query result containing n.nid, n.title, u.uid, u.name of the selected node(s) + * A query result containing n.nid, n.title, u.userid, u.name of the selected node(s) * or FALSE if the query could not be executed correctly. */ 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 {users} 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.userid, u.name FROM {node} n INNER JOIN {node_counter} s ON n.nid = s.nid INNER JOIN {users} u ON n.userid = u.userid WHERE s." . $dbfield . " != 0 AND n.status = 1 ORDER BY s." . $dbfield . " DESC"), 0, $dbrows); } return FALSE; } Index: modules/statistics/statistics.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.pages.inc,v retrieving revision 1.6 diff -u -p -r1.6 statistics.pages.inc --- modules/statistics/statistics.pages.inc 13 Oct 2008 00:33:04 -0000 1.6 +++ modules/statistics/statistics.pages.inc 24 Nov 2008 10:02:24 -0000 @@ -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 {users} 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.userid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.userid = u.userid WHERE a.path LIKE \'node/%d%%\'' . tablesort_sql($header), 30, 0, NULL, $node->nid); $rows = array(); while ($log = db_fetch_object($result)) { $rows[] = array( @@ -40,14 +40,14 @@ function statistics_node_tracker() { } function statistics_user_tracker() { - if ($account = user_load(array('uid' => arg(1)))) { + if ($account = user_load(array('userid' => arg(1)))) { $header = array( array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'), array('data' => t('Page'), 'field' => 'path'), array('data' => t('Operations'))); - $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d' . tablesort_sql($header), 30, 0, NULL, $account->uid); + $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE userid = %d' . tablesort_sql($header), 30, 0, NULL, $account->userid); $rows = array(); while ($log = db_fetch_object($result)) { $rows[] = array( Index: modules/statistics/statistics.test =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.test,v retrieving revision 1.4 diff -u -p -r1.4 statistics.test --- modules/statistics/statistics.test 17 Sep 2008 07:11:58 -0000 1.4 +++ modules/statistics/statistics.test 24 Nov 2008 10:02:24 -0000 @@ -23,7 +23,7 @@ class StatisticsBlockVisitorsTestCase ex $this->blocking_user = $this->drupalCreateUser(array('block IP addresses', 'access statistics')); // Insert dummy access by anonymous user into access log. - db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", 'test', 'node/1', 'http://example.com', '192.168.1.1', '0', '10', '10', REQUEST_TIME); + db_query("INSERT INTO {accesslog} (title, path, url, hostname, userid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", 'test', 'node/1', 'http://example.com', '192.168.1.1', '0', '10', '10', REQUEST_TIME); } /** Index: modules/syslog/syslog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/syslog/syslog.module,v retrieving revision 1.18 diff -u -p -r1.18 syslog.module --- modules/syslog/syslog.module 31 Aug 2008 09:15:13 -0000 1.18 +++ modules/syslog/syslog.module 24 Nov 2008 10:02:24 -0000 @@ -101,7 +101,7 @@ function theme_syslog_format($entry) { $message .= '|' . $entry['ip']; $message .= '|' . $entry['request_uri']; $message .= '|' . $entry['referer']; - $message .= '|' . $entry['user']->uid; + $message .= '|' . $entry['user']->userid; $message .= '|' . strip_tags($entry['link']); $message .= '|' . strip_tags(is_null($entry['variables']) ? $entry['message'] : strtr($entry['message'], $entry['variables'])); Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.107 diff -u -p -r1.107 system.admin.inc --- modules/system/system.admin.inc 24 Nov 2008 00:40:45 -0000 1.107 +++ modules/system/system.admin.inc 24 Nov 2008 10:02:24 -0000 @@ -1798,9 +1798,9 @@ function system_status($check = FALSE) { if ($check) { return drupal_requirements_severity($requirements) == REQUIREMENT_ERROR; } - // MySQL import might have set the uid of the anonymous user to autoincrement + // MySQL import might have set the userid of the anonymous user to autoincrement // value. Let's try fixing it. See http://drupal.org/node/204411 - db_query("UPDATE {users} SET uid = uid - uid WHERE name = '' AND pass = '' AND status = 0"); + db_query("UPDATE {users} SET userid = userid - userid WHERE name = '' AND pass = '' AND status = 0"); return theme('status_report', $requirements); } Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.286 diff -u -p -r1.286 system.install --- modules/system/system.install 24 Nov 2008 04:22:02 -0000 1.286 +++ modules/system/system.install 24 Nov 2008 10:02:24 -0000 @@ -347,21 +347,21 @@ function system_install() { // Load system theme data appropriately. system_theme_data(); - // Inserting uid 0 here confuses MySQL -- the next user might be created as - // 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 + // Inserting userid 0 here confuses MySQL -- the next user might be created as + // userid 2 which is not what we want. So we insert the first user here, the + // anonymous user. userid is 1 here for now, but very soon it will be changed // to 0. 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 + // presumed to be a serialized array. Install will change userid 1 immediately + // anyways. So we insert the superuser here, the userid is 2 here for now, but // very soon it will be changed to 1. - 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 + db_query("INSERT INTO {users} (name, mail, created, status, data) VALUES('%s', '%s', %d, %d, '%s')", 'placeholder-for-userid-1', 'placeholder-for-userid-1', REQUEST_TIME, 1, serialize(array())); + // This sets the above two users userid 0 (anonymous). We avoid an explicit 0 // otherwise MySQL might insert the next auto_increment value. - 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 {users} SET uid = 1 WHERE name = '%s'", 'placeholder-for-uid-1'); + db_query("UPDATE {users} SET userid = userid - userid WHERE name = '%s'", ''); + // This sets userid 1 (superuser). We skip userid 2 but that's not a big problem. + db_query("UPDATE {users} SET userid = 1 WHERE name = '%s'", 'placeholder-for-userid-1'); // Built-in roles. db_query("INSERT INTO {role} (name) VALUES ('%s')", 'anonymous user'); @@ -619,12 +619,11 @@ function system_schema() { 'unsigned' => TRUE, 'not null' => TRUE, ), - 'uid' => array( - 'description' => 'The {users}.uid of the user who is associated with the file.', + 'userid' => array( + 'description' => 'The {users}.userid of the user who is associated with the file.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, ), 'filename' => array( 'description' => '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.', @@ -669,7 +668,7 @@ function system_schema() { ), ), 'indexes' => array( - 'uid' => array('uid'), + 'userid' => array('userid'), 'status' => array('status'), 'timestamp' => array('timestamp'), ), @@ -714,11 +713,11 @@ function system_schema() { $schema['history'] = array( 'description' => 'A record of which {users} have read which {node}s.', 'fields' => array( - 'uid' => array( - 'description' => 'The {users}.uid that read the {node} nid.', + 'userid' => array( + 'description' => 'The {users}.userid that read the {node} nid.', 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, ), 'nid' => array( 'description' => 'The {node}.nid that was read.', @@ -733,7 +732,7 @@ function system_schema() { 'default' => 0, ), ), - 'primary key' => array('uid', 'nid'), + 'primary key' => array('userid', 'nid'), 'indexes' => array( 'nid' => array('nid'), ), @@ -754,7 +753,7 @@ function system_schema() { 'not null' => TRUE, ), 'to_arg_functions' => array( - 'description' => 'A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.', + 'description' => 'A serialized array of function names (like user_userid_optional_to_arg) to be called to replace a part of the router path with another string.', 'type' => 'text', 'not null' => TRUE, ), @@ -1125,8 +1124,8 @@ function system_schema() { $schema['sessions'] = array( '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 {users}.uid corresponding to a session, or 0 for anonymous user.', + 'userid' => array( + 'description' => 'The {users}.userid corresponding to a session, or 0 for anonymous user.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, @@ -1167,7 +1166,7 @@ function system_schema() { 'primary key' => array('sid'), 'indexes' => array( 'timestamp' => array('timestamp'), - 'uid' => array('uid'), + 'userid' => array('userid'), ), ); @@ -3131,6 +3130,52 @@ function system_update_7013() { } /** + * Replace Oracle reserved words 'uid' and 'access'. + */ +function system_update_7014() { + $ret = array(); + + db_drop_index($ret, 'watchdog', 'uid'); + db_change_field($ret, 'watchdog', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + db_add_index($ret, 'watchdog', 'userid', array('userid')); + + db_drop_index($ret, 'node', 'uid'); + db_change_field($ret, 'node', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + db_add_index($ret, 'node', 'userid', array('userid')); + + db_drop_index($ret, 'node_revisions', 'uid'); + db_change_field($ret, 'node_revisions', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + db_add_index($ret, 'node_revisions', 'userid', array('userid')); + + db_drop_index($ret, 'files', 'uid'); + db_change_field($ret, 'files', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + db_add_index($ret, 'files', 'userid', array('userid')); + + db_drop_primary_key($ret, 'history'); + db_change_field($ret, 'history', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + db_add_primary_key($ret, 'history', array('userid', 'nid')); + + db_drop_index($ret, 'sessions', 'uid'); + db_change_field($ret, 'sessions', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + db_add_index($ret, 'sessions', 'userid', array('userid')); + + db_change_field($ret, 'authmap', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + + db_drop_primary_key($ret, 'users'); + db_drop_index($ret, 'users', 'access'); + db_change_field($ret, 'users', 'uid', 'userid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE)); + db_change_field($ret, 'users', 'access', 'lastaccess', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); + db_add_index($ret, 'users', 'lastaccess', array('lastaccess')); + db_add_primary_key($ret, 'users', array('userid')); + + db_drop_primary_key($ret, 'users_roles'); + db_change_field($ret, 'users_roles', 'uid', 'userid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE)); + db_add_primary_key($ret, 'users_roles', array('userid', 'rid')); + + return $ret; +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.645 diff -u -p -r1.645 system.module --- modules/system/system.module 24 Nov 2008 00:40:45 -0000 1.645 +++ modules/system/system.module 24 Nov 2008 10:02:24 -0000 @@ -807,7 +807,7 @@ function system_user_register(&$edit, &$ function system_user_login(&$edit, &$user, $category = NULL) { // If the user has a NULL time zone, notify them to set a time zone. if (!$user->timezone && variable_get('configurable_timezones', 1) && variable_get('empty_timezone_message', 0)) { - drupal_set_message(t('Please configure your account time zone setting.', array('@user-edit' => url("user/$user->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone'))))); + drupal_set_message(t('Please configure your account time zone setting.', array('@user-edit' => url("user/$user->userid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone'))))); } } @@ -825,11 +825,11 @@ function system_user_timezone(&$edit, &$ $form['timezone']['timezone'] = array( '#type' => 'select', '#title' => t('Time zone'), - '#default_value' => $edit['timezone'] ? $edit['timezone'] : ($edit['uid'] == $user->uid ? variable_get('date_default_timezone', '') : ''), - '#options' => system_time_zones(($edit['uid'] != $user->uid)), + '#default_value' => $edit['timezone'] ? $edit['timezone'] : ($edit['userid'] == $user->userid ? variable_get('date_default_timezone', '') : ''), + '#options' => system_time_zones(($edit['userid'] != $user->userid)), '#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'), ); - if (!$edit['timezone'] && $edit['uid'] == $user->uid) { + if (!$edit['timezone'] && $edit['userid'] == $user->userid) { $form['timezone']['#description'] = t('Your time zone setting will be automatically detected if possible. Please confirm the selection and click save.'); $form['timezone']['timezone']['#attributes'] = array('class' => 'timezone-detect'); drupal_add_js('misc/timezone.js'); @@ -1968,7 +1968,7 @@ function system_send_email_action($objec if (isset($node)) { if (!isset($account)) { - $account = user_load(array('uid' => $node->uid)); + $account = user_load(array('userid' => $node->userid)); } if ($recipient == '%author') { $recipient = $account->mail; @@ -2020,7 +2020,7 @@ function system_mail($key, &$message, $p if (isset($params['node'])) { $node = $params['node']; $variables += array( - '%uid' => $node->uid, + '%userid' => $node->userid, '%node_url' => url('node/' . $node->nid, array('absolute' => TRUE)), '%node_type' => node_get_types('name', $node), '%title' => $node->title, @@ -2094,7 +2094,7 @@ function system_message_action(&$object, if (isset($node) && is_object($node)) { $variables = array_merge($variables, array( - '%uid' => $node->uid, + '%userid' => $node->userid, '%node_url' => url('node/' . $node->nid, array('absolute' => TRUE)), '%node_type' => check_plain(node_get_types('name', $node)), '%title' => filter_xss($node->title), Index: modules/tracker/tracker.module =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.module,v retrieving revision 1.157 diff -u -p -r1.157 tracker.module --- modules/tracker/tracker.module 6 May 2008 12:18:51 -0000 1.157 +++ modules/tracker/tracker.module 24 Nov 2008 10:02:24 -0000 @@ -33,7 +33,7 @@ function tracker_menu() { 'title' => 'All recent posts', 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items['tracker/%user_uid_optional'] = array( + $items['tracker/%user_userid_optional'] = array( 'title' => 'My recent posts', 'access callback' => '_tracker_myrecent_access', 'access arguments' => array(1), @@ -57,11 +57,11 @@ function tracker_menu() { } /** - * Access callback for tracker/%user_uid_optional + * Access callback for tracker/%user_userid_optional */ function _tracker_myrecent_access($account) { // This path is only allowed for authenticated users looking at their own posts. - return $account->uid && ($GLOBALS['user']->uid == $account->uid) && user_access('access content'); + return $account->userid && ($GLOBALS['user']->userid == $account->userid) && user_access('access content'); } /** Index: modules/tracker/tracker.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v retrieving revision 1.12 diff -u -p -r1.12 tracker.pages.inc --- modules/tracker/tracker.pages.inc 26 Oct 2008 18:06:39 -0000 1.12 +++ modules/tracker/tracker.pages.inc 24 Nov 2008 10:02:25 -0000 @@ -22,14 +22,14 @@ function tracker_page($account = NULL, $ 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 {users} u ON n.uid = u.uid LEFT JOIN {comments} 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.userid, 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.userid = u.userid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.userid = %d OR c.userid = %d) ORDER BY last_updated DESC'; $sql = db_rewrite_sql($sql); - $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} 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 = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.userid = %d OR c.userid = %d)'; $sql_count = db_rewrite_sql($sql_count); - $result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $account->uid, $account->uid); + $result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $account->userid, $account->userid); } 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 {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 = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.userid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {users} u ON n.userid = u.userid 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); Index: modules/tracker/tracker.test =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.test,v retrieving revision 1.4 diff -u -p -r1.4 tracker.test --- modules/tracker/tracker.test 21 Sep 2008 22:15:52 -0000 1.4 +++ modules/tracker/tracker.test 24 Nov 2008 10:02:25 -0000 @@ -58,18 +58,18 @@ class TrackerTest extends DrupalWebTestC $page1 = array( 'title' => $this->randomName(4, 'published_'), - 'uid' => $this->user->uid, + 'userid' => $this->user->userid, 'status' => 1, ); $page2 = array( 'title' => $this->randomName(4, 'unpublished_'), - 'uid' => $this->user->uid, + 'userid' => $this->user->userid, 'status' => 0, ); $this->drupalCreateNode($page1); $this->drupalCreateNode($page2); - $this->drupalGet('user/' . $this->user->uid . '/track'); + $this->drupalGet('user/' . $this->user->userid . '/track'); $this->assertText($page1['title'], t("Nodes show up in the author's tracker listing.")); $this->assertNoText($page2['title'], t("Unpublished nodes do not show up in the author's tracker listing.")); } Index: modules/trigger/trigger.module =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.module,v retrieving revision 1.22 diff -u -p -r1.22 trigger.module --- modules/trigger/trigger.module 11 Nov 2008 16:49:38 -0000 1.22 +++ modules/trigger/trigger.module 24 Nov 2008 10:02:25 -0000 @@ -195,7 +195,7 @@ function _trigger_normalize_node_context // An action that works on users is being called in a node context. // Load the user object of the node's author. case 'user': - return user_load(array('uid' => $node->uid)); + return user_load(array('userid' => $node->userid)); } } @@ -299,7 +299,7 @@ function _trigger_normalize_comment_cont // An action that works on users is being called in a comment context. case 'user': - return user_load(array('uid' => is_array($comment) ? $comment['uid'] : $comment->uid)); + return user_load(array('userid' => is_array($comment) ? $comment['userid'] : $comment->userid)); } } Index: modules/upload/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v retrieving revision 1.217 diff -u -p -r1.217 upload.module --- modules/upload/upload.module 24 Nov 2008 00:40:45 -0000 1.217 +++ modules/upload/upload.module 24 Nov 2008 10:02:25 -0000 @@ -429,13 +429,13 @@ function theme_upload_attachments($files /** * Determine how much disk space is occupied by a user's uploaded files. * - * @param $uid + * @param $userid * The integer user id of a user. * @return * The amount of disk space used by the user in bytes. */ -function upload_space_used($uid) { - return file_space_used($uid); +function upload_space_used($userid) { + return file_space_used($userid); } /** @@ -525,7 +525,7 @@ function _upload_form($node) { $limit_description .= t('Images may not be larger than %resolution. ', array('%resolution' => $limits['resolution'])); } } - if ($user->uid != 1) { + if ($user->userid != 1) { $limit_description .= t('Only files with the following extensions may be uploaded: %extensions. ', array('%extensions' => $limits['extensions'])); } Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.33 diff -u -p -r1.33 user.admin.inc --- modules/user/user.admin.inc 16 Nov 2008 15:10:49 -0000 1.33 +++ modules/user/user.admin.inc 24 Nov 2008 10:02:25 -0000 @@ -135,13 +135,13 @@ function user_admin_account() { array('data' => t('Status'), 'field' => 'u.status'), t('Roles'), array('data' => t('Member for'), 'field' => 'u.created', 'sort' => 'desc'), - array('data' => t('Last access'), 'field' => 'u.access'), + array('data' => t('Last access'), 'field' => 'u.lastaccess'), t('Operations') ); - $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 = 'SELECT DISTINCT u.userid, u.name, u.status, u.created, u.lastaccess FROM {users} u LEFT JOIN {users_roles} ur ON u.userid = ur.userid ' . $filter['join'] . ' WHERE u.userid != 0 ' . $filter['where']; $sql .= tablesort_sql($header); - $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']; + $query_count = 'SELECT COUNT(DISTINCT u.userid) FROM {users} u LEFT JOIN {users_roles} ur ON u.userid = ur.userid ' . $filter['join'] . ' WHERE u.userid != 0 ' . $filter['where']; $result = pager_query($sql, 50, 0, $query_count, $filter['args']); $form['options'] = array( @@ -170,19 +170,19 @@ function user_admin_account() { $roles = user_roles(TRUE); $accounts = array(); while ($account = db_fetch_object($result)) { - $accounts[$account->uid] = ''; - $form['name'][$account->uid] = array('#markup' => theme('username', $account)); - $form['status'][$account->uid] = array('#markup' => $status[$account->status]); + $accounts[$account->userid] = ''; + $form['name'][$account->userid] = array('#markup' => theme('username', $account)); + $form['status'][$account->userid] = array('#markup' => $status[$account->status]); $users_roles = array(); - $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = %d', $account->uid); + $roles_result = db_query('SELECT rid FROM {users_roles} WHERE userid = %d', $account->userid); while ($user_role = db_fetch_object($roles_result)) { $users_roles[] = $roles[$user_role->rid]; } 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))); + $form['roles'][$account->userid][0] = array('#markup' => theme('item_list', $users_roles)); + $form['member_for'][$account->userid] = array('#markup' => format_interval(REQUEST_TIME - $account->created)); + $form['lastaccess'][$account->userid] = array('#markup' => $account->lastaccess ? t('@time ago', array('@time' => format_interval(REQUEST_TIME - $account->lastaccess))) : t('never')); + $form['operations'][$account->userid] = array('#markup' => l(t('edit'), "user/$account->userid/edit", array('query' => $destination))); } $form['accounts'] = array( '#type' => 'checkboxes', @@ -712,7 +712,7 @@ function theme_user_admin_account($form) array('data' => t('Status'), 'field' => 'u.status'), t('Roles'), array('data' => t('Member for'), 'field' => 'u.created', 'sort' => 'desc'), - array('data' => t('Last access'), 'field' => 'u.access'), + array('data' => t('Last access'), 'field' => 'u.lastaccess'), t('Operations') ); @@ -725,7 +725,7 @@ function theme_user_admin_account($form) drupal_render($form['status'][$key]), drupal_render($form['roles'][$key]), drupal_render($form['member_for'][$key]), - drupal_render($form['last_access'][$key]), + drupal_render($form['lastaccess'][$key]), drupal_render($form['operations'][$key]), ); } Index: modules/user/user.install =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.install,v retrieving revision 1.15 diff -u -p -r1.15 user.install --- modules/user/user.install 20 Nov 2008 06:56:17 -0000 1.15 +++ modules/user/user.install 24 Nov 2008 10:02:25 -0000 @@ -14,11 +14,11 @@ function user_schema() { 'unsigned' => TRUE, 'not null' => TRUE, ), - 'uid' => array( + 'userid' => array( 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, - 'description' => "User's {users}.uid.", + 'description' => "User's {users}.id.", ), 'authname' => array( 'type' => 'varchar', @@ -90,7 +90,7 @@ function user_schema() { $schema['users'] = array( 'description' => 'Stores user data.', 'fields' => array( - 'uid' => array( + 'userid' => array( 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, @@ -137,7 +137,7 @@ function user_schema() { 'default' => 0, 'description' => 'Timestamp for when user was created.', ), - 'access' => array( + 'lastaccess' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, @@ -192,25 +192,24 @@ function user_schema() { ), ), 'indexes' => array( - 'access' => array('access'), + 'lastaccess' => array('lastaccess'), 'created' => array('created'), 'mail' => array('mail'), ), 'unique keys' => array( 'name' => array('name'), ), - 'primary key' => array('uid'), + 'primary key' => array('userid'), ); $schema['users_roles'] = array( 'description' => 'Maps users to roles.', 'fields' => array( - 'uid' => array( + 'userid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0, - 'description' => 'Primary Key: {users}.uid for user.', + 'description' => 'Primary Key: {users}.id for user.', ), 'rid' => array( 'type' => 'int', @@ -220,7 +219,7 @@ function user_schema() { 'description' => 'Primary Key: {role}.rid for role.', ), ), - 'primary key' => array('uid', 'rid'), + 'primary key' => array('userid', 'rid'), 'indexes' => array( 'rid' => array('rid'), ), @@ -230,7 +229,7 @@ function user_schema() { } /** - * @defgroup user-updates-6.x-to-7.x User updates from 6.x to 7.x + * @defgroup updates-6.x-to-7.x User updates from 6.x to 7.x * @{ */ @@ -360,7 +359,6 @@ function user_update_7002(&$sandbox) { } /** - * @} End of "defgroup user-updates-6.x-to-7.x" + * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ - Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.941 diff -u -p -r1.941 user.module --- modules/user/user.module 24 Nov 2008 06:12:46 -0000 1.941 +++ modules/user/user.module 24 Nov 2008 10:02:25 -0000 @@ -83,7 +83,7 @@ function user_theme() { } function user_external_load($authname) { - $result = db_query("SELECT uid FROM {authmap} WHERE authname = '%s'", $authname); + $result = db_query("SELECT userid FROM {authmap} WHERE authname = '%s'", $authname); if ($user = db_fetch_array($result)) { return user_load($user); @@ -149,14 +149,14 @@ function user_load($array = array()) { $params = array(); if (is_numeric($array)) { - $array = array('uid' => $array); + $array = array('userid' => $array); } elseif (!is_array($array)) { return FALSE; } foreach ($array as $key => $value) { - if ($key == 'uid' || $key == 'status') { + if ($key == 'userid' || $key == 'status') { $query[] = "$key = %d"; $params[] = $value; } @@ -175,13 +175,13 @@ function user_load($array = array()) { $user = drupal_unpack($user); $user->roles = array(); - if ($user->uid) { + if ($user->userid) { $user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; } else { $user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user'; } - $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); + $result = db_query('SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.userid = %d', $user->userid); while ($role = db_fetch_object($result)) { $user->roles[$role->rid] = $role->name; } @@ -198,7 +198,7 @@ function user_load($array = array()) { * Save changes to a user account or add a new user. * * @param $account - * The $user object for the user to modify or add. If $user->uid is + * The $user object for the user to modify or add. If $user->userid is * omitted, a new user will be added. * * @param $edit @@ -232,13 +232,13 @@ function user_save($account, $edit = arr unset($edit['pass']); } - if (is_object($account) && $account->uid) { + if (is_object($account) && $account->userid) { user_module_invoke('update', $edit, $account, $category); - $data = unserialize(db_result(db_query('SELECT data FROM {users} WHERE uid = %d', $account->uid))); + $data = unserialize(db_result(db_query('SELECT data FROM {users} WHERE userid = %d', $account->userid))); // 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')) { - $edit['access'] = REQUEST_TIME; + if (empty($edit['lastaccess']) && empty($account->lastaccess) && user_access('administer users')) { + $edit['lastaccess'] = REQUEST_TIME; } foreach ($edit as $key => $value) { // Fields that don't pertain to the users or user_roles @@ -254,9 +254,9 @@ function user_save($account, $edit = arr } $edit['data'] = $data; - $edit['uid'] = $account->uid; + $edit['userid'] = $account->userid; // Save changes to the users table. - $success = drupal_write_record('users', $edit, 'uid'); + $success = drupal_write_record('users', $edit, 'userid'); if (!$success) { // The query failed - better to abort the save than risk further data loss. return FALSE; @@ -264,29 +264,29 @@ function user_save($account, $edit = arr // Reload user roles if provided. if (isset($edit['roles']) && is_array($edit['roles'])) { - db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid); + db_query('DELETE FROM {users_roles} WHERE userid = %d', $account->userid); foreach (array_keys($edit['roles']) as $rid) { if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) { - db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $account->uid, $rid); + db_query('INSERT INTO {users_roles} (userid, rid) VALUES (%d, %d)', $account->userid, $rid); } } } // Delete a blocked user's sessions to kick them if they are online. if (isset($edit['status']) && $edit['status'] == 0) { - drupal_session_destroy_uid($account->uid); + drupal_session_destroy_userid($account->userid); } // If the password changed, delete all open sessions and recreate // the current one. if (!empty($edit['pass'])) { - drupal_session_destroy_uid($account->uid); + drupal_session_destroy_userid($account->userid); drupal_session_regenerate(); } // Refresh user object. - $user = user_load(array('uid' => $account->uid)); + $user = user_load(array('userid' => $account->userid)); // Send emails after we have the new user object. if (isset($edit['status']) && $edit['status'] != $account->status) { @@ -304,19 +304,19 @@ function user_save($account, $edit = arr } // Consider users created by an administrator as already logged in, so // anonymous users can view the profile (if allowed). - if (empty($edit['access']) && user_access('administer users')) { - $edit['access'] = REQUEST_TIME; + if (empty($edit['lastaccess']) && user_access('administer users')) { + $edit['lastaccess'] = REQUEST_TIME; } $success = drupal_write_record('users', $edit); if (!$success) { - // On a failed INSERT some other existing user's uid may be returned. + // On a failed INSERT some other existing user's userid may be returned. // We must abort to avoid overwriting their account. return FALSE; } // Build the initial user object. - $user = user_load(array('uid' => $edit['uid'])); + $user = user_load(array('userid' => $edit['userid'])); user_module_invoke('insert', $edit, $user, $category); @@ -329,22 +329,22 @@ function user_save($account, $edit = arr } } if (!empty($data)) { - $data_array = array('uid' => $user->uid, 'data' => $data); - drupal_write_record('users', $data_array, 'uid'); + $data_array = array('userid' => $user->userid, 'data' => $data); + drupal_write_record('users', $data_array, 'userid'); } // Save user roles (delete just to be safe). if (isset($edit['roles']) && is_array($edit['roles'])) { - db_query('DELETE FROM {users_roles} WHERE uid = %d', $edit['uid']); + db_query('DELETE FROM {users_roles} WHERE userid = %d', $edit['userid']); foreach (array_keys($edit['roles']) as $rid) { if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) { - db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $edit['uid'], $rid); + db_query('INSERT INTO {users_roles} (userid, rid) VALUES (%d, %d)', $edit['userid'], $rid); } } } // Build the finished user object. - $user = user_load(array('uid' => $edit['uid'])); + $user = user_load(array('userid' => $edit['userid'])); } return $user; @@ -412,7 +412,7 @@ function user_validate_picture(&$form, & // files table as a temporary file. We'll make a copy and let the garbage // collector delete the original upload. $info = image_get_info($file->filepath); - $destination = file_create_path(variable_get('user_picture_path', 'pictures') . '/picture-' . $form['#uid'] . '.' . $info['extension']); + $destination = file_create_path(variable_get('user_picture_path', 'pictures') . '/picture-' . $form['#userid'] . '.' . $info['extension']); if ($filepath = file_unmanaged_copy($file->filepath, $destination, FILE_EXISTS_REPLACE)) { $form_state['values']['picture'] = $filepath; } @@ -534,23 +534,23 @@ function user_access($string, $account = } // User #1 has all privileges: - if ($account->uid == 1) { + if ($account->userid == 1) { return TRUE; } // To reduce the number of SQL queries, we cache the user's permissions // in a static variable. - if (!isset($perm[$account->uid])) { + if (!isset($perm[$account->userid])) { $role_permissions = user_role_permissions($account->roles, $reset); $perms = array(); foreach ($role_permissions as $one_role) { $perms += $one_role; } - $perm[$account->uid] = $perms; + $perm[$account->userid] = $perms; } - return isset($perm[$account->uid][$string]); + return isset($perm[$account->userid][$string]); } /** @@ -616,15 +616,15 @@ function user_search($op = 'search', $ke $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 {users} WHERE LOWER(name) LIKE LOWER('%%%s%%') OR LOWER(mail) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys, $keys); + $result = pager_query("SELECT name, userid, 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))); + $find[] = array('title' => $account->name . ' (' . $account->mail . ')', 'link' => url('user/' . $account->userid, array('absolute' => TRUE))); } } else { - $result = pager_query("SELECT name, uid FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys); + $result = pager_query("SELECT name, userid 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))); + $find[] = array('title' => $account->name, 'link' => url('user/' . $account->userid, array('absolute' => TRUE))); } } return $find; @@ -784,7 +784,7 @@ function user_block($op = 'list', $delta switch ($delta) { case 'login': // For usability's sake, avoid showing two login forms on one page. - if (!$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))) { + if (!$user->userid && !(arg(0) == 'user' && !is_numeric(arg(1)))) { $block['subject'] = t('User login'); $block['content'] = drupal_get_form('user_login_block'); @@ -793,7 +793,7 @@ function user_block($op = 'list', $delta case 'navigation': if ($menu = menu_tree()) { - $block['subject'] = $user->uid ? check_plain($user->name) : t('Navigation'); + $block['subject'] = $user->userid ? check_plain($user->name) : t('Navigation'); $block['content'] = $menu; } return $block; @@ -801,7 +801,7 @@ function user_block($op = 'list', $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 {users} 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 userid, name FROM {users} WHERE status != 0 AND lastaccess != 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'); @@ -817,7 +817,7 @@ function user_block($op = 'list', $delta // Perform database queries to gather online user lists. We use s.timestamp // rather than u.access because it is much faster. $anonymous_count = drupal_session_count($interval); - $authenticated_count = db_query("SELECT COUNT(DISTINCT s.uid) FROM {sessions} s WHERE s.timestamp >= :timestamp AND s.uid > 0", array(':timestamp' => $interval))->fetchField(); + $authenticated_count = db_query("SELECT COUNT(DISTINCT s.userid) FROM {sessions} s WHERE s.timestamp >= :timestamp AND s.userid > 0", array(':timestamp' => $interval))->fetchField(); // Format the output with proper grammar. if ($anonymous_count == 1 && $authenticated_count == 1) { @@ -830,7 +830,7 @@ function user_block($op = 'list', $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 {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(); + $items = db_query_range('SELECT u.userid, u.name, MAX(s.timestamp) AS max_timestamp FROM {users} u INNER JOIN {sessions} s ON u.userid = s.userid WHERE s.timestamp >= :interval AND s.userid > 0 GROUP BY u.userid, u.name ORDER BY max_timestamp DESC', array(':interval' => $interval), 0, $max_users)->fetchAll(); $output .= theme('user_list', $items, t('Online users')); } @@ -864,9 +864,9 @@ function template_preprocess_user_pictur if (isset($picture)) { $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous')))); $variables['picture'] = theme('image', $picture, $alt, $alt, '', FALSE); - if (!empty($account->uid) && user_access('access user profiles')) { + if (!empty($account->userid) && user_access('access user profiles')) { $attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE); - $variables['picture'] = l($variables['picture'], "user/$account->uid", $attributes); + $variables['picture'] = l($variables['picture'], "user/$account->userid", $attributes); } } } @@ -876,7 +876,7 @@ function template_preprocess_user_pictur * Make a list of users. * * @param $users - * An array with user objects. Should contain at least the name and uid. + * An array with user objects. Should contain at least the name and userid. * @param $title * (optional) Title to pass on to theme_item_list(). * @@ -893,11 +893,11 @@ function theme_user_list($users, $title function user_is_anonymous() { // Menu administrators can see items for anonymous when administering. - return !$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']); + return !$GLOBALS['user']->userid || !empty($GLOBALS['menu_admin']); } function user_is_logged_in() { - return (bool)$GLOBALS['user']->uid; + return (bool)$GLOBALS['user']->userid; } function user_register_access() { @@ -905,14 +905,14 @@ function user_register_access() { } function user_view_access($account) { - return $account && $account->uid && + return $account && $account->userid && ( // Always let users view their own profile. - ($GLOBALS['user']->uid == $account->uid) || + ($GLOBALS['user']->userid == $account->userid) || // Administrators can view all accounts. user_access('administer users') || // The user is not blocked and logged in at least once. - ($account->access && $account->status && user_access('access user profiles')) + ($account->lastaccess && $account->status && user_access('access user profiles')) ); } @@ -920,11 +920,11 @@ function user_view_access($account) { * Access callback for user account editing. */ function user_edit_access($account) { - return (($GLOBALS['user']->uid == $account->uid) || user_access('administer users')) && $account->uid > 0; + return (($GLOBALS['user']->userid == $account->userid) || user_access('administer users')) && $account->userid > 0; } function user_load_self($arg) { - $arg[1] = user_load($GLOBALS['user']->uid); + $arg[1] = user_load($GLOBALS['user']->userid); return $arg; } @@ -1040,7 +1040,7 @@ function user_menu() { 'weight' => 10, ); - $items['user/%user_uid_optional'] = array( + $items['user/%user_userid_optional'] = array( 'title' => 'My account', 'title callback' => 'user_page_title', 'title arguments' => array(1), @@ -1109,22 +1109,22 @@ function user_init() { drupal_add_css(drupal_get_path('module', 'user') . '/user.css'); } -function user_uid_optional_load($arg) { - return user_load(isset($arg) ? $arg : $GLOBALS['user']->uid); +function user_userid_optional_load($arg) { + return user_load(isset($arg) ? $arg : $GLOBALS['user']->userid); } /** * Return a user object after checking if any profile category in the path exists. */ -function user_category_load($uid, &$map, $index) { +function user_category_load($userid, &$map, $index) { static $user_categories, $accounts; // Cache $account - this load function will get called for each profile tab. - if (!isset($accounts[$uid])) { - $accounts[$uid] = user_load($uid); + if (!isset($accounts[$userid])) { + $accounts[$userid] = user_load($userid); } $valid = TRUE; - if ($account = $accounts[$uid]) { + if ($account = $accounts[$userid]) { // Since the path is like user/%/edit/category_name, the category name will // be at a position 2 beyond the index corresponding to the % wildcard. $category_index = $index + 2; @@ -1155,18 +1155,18 @@ function user_category_load($uid, &$map, /** * Returns the user id of the currently logged in user. */ -function user_uid_optional_to_arg($arg) { - // Give back the current user uid when called from eg. tracker, aka. - // with an empty arg. Also use the current user uid when called from +function user_userid_optional_to_arg($arg) { + // Give back the current user userid when called from eg. tracker, aka. + // with an empty arg. Also use the current user userid when called from // the menu with a % for the current account link. - return empty($arg) || $arg == '%' ? $GLOBALS['user']->uid : $arg; + return empty($arg) || $arg == '%' ? $GLOBALS['user']->userid : $arg; } /** * Menu item title callback - use the user name if it's not the current user. */ function user_page_title($account) { - if ($account->uid == $GLOBALS['user']->uid) { + if ($account->userid == $GLOBALS['user']->userid) { return t('My account'); } return $account->name; @@ -1209,7 +1209,7 @@ function user_set_authmaps($account, $au if ($value) { db_merge('authmap') ->key(array( - 'uid' => $account->uid, + 'userid' => $account->userid, 'module' => $module[1], )) ->fields(array( @@ -1218,7 +1218,7 @@ function user_set_authmaps($account, $au ->execute(); } else { - db_delete('authmap')->condition('uid', $account->uid)->condition('module', $module[1])->execute(); + db_delete('authmap')->condition('userid', $account->userid)->condition('module', $module[1])->execute(); } } } @@ -1232,8 +1232,8 @@ function user_login(&$form_state) { global $user; // If we are already logged on, go to the user page instead. - if ($user->uid) { - drupal_goto('user/' . $user->uid); + if ($user->userid) { + drupal_goto('user/' . $user->userid); } // Display login form: @@ -1303,7 +1303,7 @@ function user_login_authenticate_validat */ function user_login_final_validate($form, &$form_state) { global $user; - if (!$user->uid) { + if (!$user->userid) { form_set_error('name', t('Sorry, unrecognized username or password. Have you forgotten your password?', array('@password' => url('user/password')))); watchdog('user', 'Login attempt failed for %user.', array('%user' => $form_state['values']['name'])); } @@ -1333,10 +1333,10 @@ function user_authenticate($form_values if (user_needs_new_hash($account)) { $new_hash = user_hash_password($password); if ($new_hash) { - db_query("UPDATE {users} SET pass = '%s' WHERE uid = %d", $new_hash, $account->uid); + db_query("UPDATE {users} SET pass = '%s' WHERE userid = %d", $new_hash, $account->userid); } } - $account = user_load(array('uid' => $account->uid, 'status' => 1)); + $account = user_load(array('userid' => $account->userid, 'status' => 1)); $user = $account; user_authenticate_finalize($form_values); return $user; @@ -1360,7 +1360,7 @@ function user_authenticate_finalize(&$ed // 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 {users} SET login = %d WHERE uid = %d", $user->login, $user->uid); + db_query("UPDATE {users} SET login = %d WHERE userid = %d", $user->login, $user->userid); // 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. @@ -1376,8 +1376,8 @@ function user_authenticate_finalize(&$ed */ function user_login_submit($form, &$form_state) { global $user; - if ($user->uid) { - $form_state['redirect'] = 'user/' . $user->uid; + if ($user->userid) { + $form_state['redirect'] = 'user/' . $user->userid; return; } } @@ -1391,7 +1391,7 @@ function user_external_login_register($n global $user; $existing_user = user_load(array('name' => $name)); - if (isset($existing_user->uid)) { + if (isset($existing_user->userid)) { $user = $existing_user; } else { @@ -1401,7 +1401,7 @@ function user_external_login_register($n 'pass' => user_password(), 'init' => $name, 'status' => 1, - 'access' => REQUEST_TIME + 'lastaccess' => REQUEST_TIME ); $account = user_save('', $userinfo); // Terminate if an error occured during user_save(). @@ -1411,20 +1411,20 @@ function user_external_login_register($n } user_set_authmaps($account, array("authname_$module" => $name)); $user = $account; - watchdog('user', 'New external user: %name using module %module.', array('%name' => $name, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $user->uid . '/edit')); + watchdog('user', 'New external user: %name using module %module.', array('%name' => $name, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $user->userid . '/edit')); } } function user_pass_reset_url($account) { $timestamp = REQUEST_TIME; - return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE)); + return url("user/reset/$account->userid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE)); } function user_pass_rehash($password, $timestamp, $login) { return md5($timestamp . $password . $login); } -function user_edit_form(&$form_state, $uid, $edit, $register = FALSE) { +function user_edit_form(&$form_state, $userid, $edit, $register = FALSE) { _user_password_dynamic_validation(); $admin = user_access('administer users'); @@ -1529,19 +1529,19 @@ function user_edit_form(&$form_state, $u $form['picture']['picture_upload'] = array('#type' => 'file', '#title' => t('Upload picture'), '#size' => 48, '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) . ' ' . variable_get('user_picture_guidelines', '')); $form['#validate'][] = 'user_validate_picture'; } - $form['#uid'] = $uid; + $form['#userid'] = $userid; return $form; } -function _user_edit_validate($uid, &$edit) { - $user = user_load(array('uid' => $uid)); +function _user_edit_validate($userid, &$edit) { + $user = user_load(array('userid' => $userid)); // Validate the username: - if (user_access('change own username') || user_access('administer users') || !$user->uid) { + if (user_access('change own username') || user_access('administer users') || !$user->userid) { if ($error = user_validate_name($edit['name'])) { form_set_error('name', $error); } - elseif (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) { + elseif (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE userid != %d AND LOWER(name) = LOWER('%s')", $userid, $edit['name'])) > 0) { form_set_error('name', t('The name %name is already taken.', array('%name' => $edit['name']))); } } @@ -1550,13 +1550,13 @@ function _user_edit_validate($uid, &$edi if ($error = user_validate_mail($edit['mail'])) { form_set_error('mail', $error); } - elseif (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) { + elseif (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE userid != %d AND LOWER(mail) = LOWER('%s')", $userid, $edit['mail'])) > 0) { form_set_error('mail', t('The e-mail address %email is already registered. Have you forgotten your password?', array('%email' => $edit['mail'], '@password' => url('user/password')))); } } -function _user_edit_submit($uid, &$edit) { - $user = user_load(array('uid' => $uid)); +function _user_edit_submit($userid, &$edit) { + $user = user_load(array('userid' => $userid)); // Delete picture if requested, and if no replacement picture was given. if (!empty($edit['picture_delete'])) { if ($user->picture && file_exists($user->picture)) { @@ -1573,16 +1573,16 @@ function _user_edit_submit($uid, &$edit) * Delete a user. * * @param $edit An array of submitted form values. - * @param $uid The user ID of the user to delete. + * @param $userid The user ID of the user to delete. */ -function user_delete($edit, $uid) { - $account = user_load(array('uid' => $uid)); - drupal_session_destroy_uid($uid); +function user_delete($edit, $userid) { + $account = user_load(array('userid' => $userid)); + drupal_session_destroy_userid($userid); _user_mail_notify('status_deleted', $account); module_invoke_all('user_delete', $edit, $account); - db_query('DELETE FROM {users} WHERE uid = %d', $uid); - db_query('DELETE FROM {users_roles} WHERE uid = %d', $uid); - db_query('DELETE FROM {authmap} WHERE uid = %d', $uid); + db_query('DELETE FROM {users} WHERE userid = %d', $userid); + db_query('DELETE FROM {users_roles} WHERE userid = %d', $userid); + db_query('DELETE FROM {authmap} WHERE userid = %d', $userid); $variables = array('%name' => $account->name, '%email' => '<' . $account->mail . '>'); watchdog('user', 'Deleted user: %name %email.', $variables, WATCHDOG_NOTICE); } @@ -1787,8 +1787,8 @@ function user_user_operations($form_stat * Callback function for admin mass unblocking users. */ function user_user_operations_unblock($accounts) { - foreach ($accounts as $uid) { - $account = user_load(array('uid' => (int)$uid)); + foreach ($accounts as $userid) { + $account = user_load(array('userid' => (int)$userid)); // Skip unblocking user if they are already unblocked. if ($account !== FALSE && $account->status == 0) { user_save($account, array('status' => 1)); @@ -1800,8 +1800,8 @@ function user_user_operations_unblock($a * Callback function for admin mass blocking users. */ function user_user_operations_block($accounts) { - foreach ($accounts as $uid) { - $account = user_load(array('uid' => (int)$uid)); + foreach ($accounts as $userid) { + $account = user_load(array('userid' => (int)$userid)); // Skip blocking user if they are already blocked. if ($account !== FALSE && $account->status == 1) { user_save($account, array('status' => 0)); @@ -1819,8 +1819,8 @@ function user_multiple_role_edit($accoun switch ($operation) { case 'add_role': - foreach ($accounts as $uid) { - $account = user_load(array('uid' => (int)$uid)); + foreach ($accounts as $userid) { + $account = user_load(array('userid' => (int)$userid)); // Skip adding the role to the user if they already have it. if ($account !== FALSE && !isset($account->roles[$rid])) { $roles = $account->roles + array($rid => $role_name); @@ -1829,8 +1829,8 @@ function user_multiple_role_edit($accoun } break; case 'remove_role': - foreach ($accounts as $uid) { - $account = user_load(array('uid' => (int)$uid)); + foreach ($accounts as $userid) { + $account = user_load(array('userid' => (int)$userid)); // Skip removing the role from the user if they already don't have it. if ($account !== FALSE && isset($account->roles[$rid])) { $roles = array_diff($account->roles, array($rid => $role_name)); @@ -1846,9 +1846,9 @@ function user_multiple_delete_confirm(&$ $form['accounts'] = array('#prefix' => '', '#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 {users} WHERE uid = %d', $uid)); - $form['accounts'][$uid] = array('#type' => 'hidden', '#value' => $uid, '#prefix' => '
  • ', '#suffix' => check_plain($user) . "
  • \n"); + foreach (array_filter($edit['accounts']) as $userid => $value) { + $user = db_result(db_query('SELECT name FROM {users} WHERE userid = %d', $userid)); + $form['accounts'][$userid] = array('#type' => 'hidden', '#value' => $userid, '#prefix' => '
  • ', '#suffix' => check_plain($user) . "
  • \n"); } $form['operation'] = array('#type' => 'hidden', '#value' => 'delete'); @@ -1860,8 +1860,8 @@ function user_multiple_delete_confirm(&$ function user_multiple_delete_confirm_submit($form, &$form_state) { if ($form_state['values']['confirm']) { - foreach ($form_state['values']['accounts'] as $uid => $value) { - user_delete($form_state['values'], $uid); + foreach ($form_state['values']['accounts'] as $userid => $value) { + user_delete($form_state['values'], $userid); } drupal_set_message(t('The users have been deleted.')); } @@ -1954,7 +1954,7 @@ function user_filters() { $filters['permission'] = array( 'title' => t('permission'), 'join' => 'LEFT JOIN {role_permission} p ON ur.rid = p.rid', - 'where' => " (p.permission = '%s' OR u.uid = 1) ", + 'where' => " (p.permission = '%s' OR u.userid = 1) ", 'options' => $options, ); @@ -1982,7 +1982,7 @@ function user_build_filter_query() { // skip adding it to the filter query. if ($key == 'permission') { $account = new stdClass(); - $account->uid = 'user_filter'; + $account->userid = 'user_filter'; $account->roles = array(DRUPAL_AUTHENTICATED_RID => 1); if (user_access($value, $account)) { continue; @@ -2048,7 +2048,7 @@ function theme_user_signature($signature * * @param $account * The user object of the account being notified. Must contain at - * least the fields 'uid', 'name', and 'mail'. + * least the fields 'userid', 'name', and 'mail'. * @param $language * Language object to generate the tokens with. * @return @@ -2065,7 +2065,7 @@ function user_mail_tokens($account, $lan '!mailto' => $account->mail, '!date' => format_date(REQUEST_TIME, 'medium', '', NULL, $language->language), '!login_uri' => url('user', array('absolute' => TRUE, 'language' => $language)), - '!edit_uri' => url('user/' . $account->uid . '/edit', array('absolute' => TRUE, 'language' => $language)), + '!edit_uri' => url('user/' . $account->userid . '/edit', array('absolute' => TRUE, 'language' => $language)), ); if (!empty($account->password)) { $tokens['!password'] = $account->password; @@ -2115,7 +2115,7 @@ function user_preferred_language($accoun * * @param $account * The user object of the account being notified. Must contain at - * least the fields 'uid', 'name', and 'mail'. + * least the fields 'userid', 'name', and 'mail'. * @param $language * Optional language to use for the notification, overriding account language. * @return @@ -2220,18 +2220,18 @@ function user_action_info() { * Blocks the current user. */ function user_block_user_action(&$object, $context = array()) { - if (isset($object->uid)) { - $uid = $object->uid; + if (isset($object->userid)) { + $userid = $object->userid; } - elseif (isset($context['uid'])) { - $uid = $context['uid']; + elseif (isset($context['userid'])) { + $userid = $context['userid']; } else { global $user; - $uid = $user->uid; + $userid = $user->userid; } - db_query("UPDATE {users} SET status = 0 WHERE uid = %d", $uid); - drupal_session_destroy_uid($uid); + db_query("UPDATE {users} SET status = 0 WHERE userid = %d", $userid); + drupal_session_destroy_userid($userid); watchdog('action', 'Blocked user %name.', array('%name' => check_plain($user->name))); } @@ -2263,7 +2263,7 @@ function user_register_submit($form, &$f $roles = array(); } - if (!$admin && array_intersect(array_keys($form_state['values']), array('uid', 'roles', 'init', 'session', 'status'))) { + if (!$admin && array_intersect(array_keys($form_state['values']), array('userid', 'roles', 'init', 'session', 'status'))) { watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING); $form_state['redirect'] = 'user/register'; return; @@ -2286,10 +2286,10 @@ function user_register_submit($form, &$f } $form_state['user'] = $account; - watchdog('user', 'New user: %name (%email).', array('%name' => $name, '%email' => $mail), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $account->uid . '/edit')); + watchdog('user', 'New user: %name (%email).', array('%name' => $name, '%email' => $mail), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $account->userid . '/edit')); // The first user may login immediately, and receives a customized welcome e-mail. - if ($account->uid == 1) { + if ($account->userid == 1) { drupal_set_message(t('Welcome to Drupal. You are now logged in as user #1, which gives you full control over your website.')); if (variable_get('user_email_verification', TRUE)) { drupal_set_message(t('

    Your password is %pass. You may change your password below.

    ', array('%pass' => $pass))); @@ -2304,7 +2304,7 @@ function user_register_submit($form, &$f // Add plain text password into user account to generate mail tokens. $account->password = $pass; if ($admin && !$notify) { - drupal_set_message(t('Created a new user account for %name. No e-mail has been sent.', array('@url' => url("user/$account->uid"), '%name' => $account->name))); + drupal_set_message(t('Created a new user account for %name. No e-mail has been sent.', array('@url' => url("user/$account->userid"), '%name' => $account->name))); } elseif (!variable_get('user_email_verification', TRUE) && $account->status && !$admin) { // No e-mail verification is required, create new user account, and login @@ -2321,7 +2321,7 @@ function user_register_submit($form, &$f $op = $notify ? 'register_admin_created' : 'register_no_approval_required'; _user_mail_notify($op, $account); if ($notify) { - drupal_set_message(t('Password and further instructions have been e-mailed to the new user %name.', array('@url' => url("user/$account->uid"), '%name' => $account->name))); + drupal_set_message(t('Password and further instructions have been e-mailed to the new user %name.', array('@url' => url("user/$account->userid"), '%name' => $account->name))); } else { drupal_set_message(t('Your password and further instructions have been sent to your e-mail address.')); @@ -2353,8 +2353,8 @@ function user_register() { $admin = user_access('administer users'); // If we aren't admin but already logged on, go to the user page instead. - if (!$admin && $user->uid) { - drupal_goto('user/' . $user->uid); + if (!$admin && $user->userid) { + drupal_goto('user/' . $user->userid); } $form = array(); Index: modules/user/user.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v retrieving revision 1.24 diff -u -p -r1.24 user.pages.inc --- modules/user/user.pages.inc 24 Nov 2008 00:40:45 -0000 1.24 +++ modules/user/user.pages.inc 24 Nov 2008 10:02:25 -0000 @@ -49,7 +49,7 @@ function user_pass_validate($form, &$for // No success, try to load by name. $account = user_load(array('name' => $name, 'status' => 1)); } - if (isset($account->uid)) { + if (isset($account->userid)) { form_set_value(array('#parents' => array('account')), $account, $form_state); } else { @@ -73,11 +73,11 @@ function user_pass_submit($form, &$form_ /** * Menu callback; process one time login link and redirects to the user page on success. */ -function user_pass_reset(&$form_state, $uid, $timestamp, $hashed_pass, $action = NULL) { +function user_pass_reset(&$form_state, $userid, $timestamp, $hashed_pass, $action = NULL) { global $user; // Check if the user is already logged in. The back button is often the culprit here. - if ($user->uid) { + if ($user->userid) { drupal_set_message(t('You have already used this one-time login link. It is not necessary to use this link to login anymore. You are already logged in.')); drupal_goto(); } @@ -86,13 +86,13 @@ function user_pass_reset(&$form_state, $ $timeout = 86400; $current = REQUEST_TIME; // Some redundant checks for extra security ? - if ($timestamp < $current && $account = user_load(array('uid' => $uid, 'status' => 1)) ) { + if ($timestamp < $current && $account = user_load(array('userid' => $userid, 'status' => 1)) ) { // No time out for first time login. if ($account->login && $current - $timestamp > $timeout) { drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.')); drupal_goto('user/password'); } - elseif ($account->uid && $timestamp > $account->login && $timestamp < $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) { + elseif ($account->userid && $timestamp > $account->login && $timestamp < $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) { // First stage is a confirmation form, then login if ($action == 'login') { watchdog('user', 'User %name used one-time login link at time %timestamp.', array('%name' => $account->name, '%timestamp' => $timestamp)); @@ -102,13 +102,13 @@ function user_pass_reset(&$form_state, $ // user, which invalidates further use of the one-time login link. user_authenticate_finalize($form_state['values']); drupal_set_message(t('You have just used your one-time login link. It is no longer necessary to use this link to login. Please change your password.')); - drupal_goto('user/' . $user->uid . '/edit'); + drupal_goto('user/' . $user->userid . '/edit'); } else { $form['message'] = array('#markup' => t('

    This is a one-time login for %user_name and will expire on %expiration_date.

    Click on this button to login to the site and change your password.

    ', array('%user_name' => $account->name, '%expiration_date' => format_date($timestamp + $timeout)))); $form['help'] = array('#markup' => '

    ' . t('This login can be used only once.') . '

    '); $form['submit'] = array('#type' => 'submit', '#value' => t('Log in')); - $form['#action'] = url("user/reset/$uid/$timestamp/$hashed_pass/login"); + $form['#action'] = url("user/reset/$userid/$timestamp/$hashed_pass/login"); return $form; } } @@ -257,7 +257,7 @@ function user_profile_form($form_state, function user_profile_form_validate($form, &$form_state) { user_module_invoke('validate', $form_state['values'], $form_state['values']['_account'], $form_state['values']['_category']); // Validate input to ensure that non-privileged users can't alter protected data. - if ((!user_access('administer users') && array_intersect(array_keys($form_state['values']), array('uid', 'init', 'session'))) || (!user_access('administer permissions') && isset($form_state['values']['roles']))) { + if ((!user_access('administer users') && array_intersect(array_keys($form_state['values']), array('userid', 'init', 'session'))) || (!user_access('administer permissions') && isset($form_state['values']['roles']))) { watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING); // set this to a value type field form_set_error('category', t('Detected malicious attempt to alter protected user fields.')); @@ -290,8 +290,8 @@ function user_edit_delete_submit($form, $destination = drupal_get_destination(); unset($_REQUEST['destination']); } - // Note: We redirect from user/uid/edit to user/uid/delete to make the tabs disappear. - $form_state['redirect'] = array("user/" . $form_state['values']['_account']->uid . "/delete", $destination); + // Note: We redirect from user/userid/edit to user/userid/delete to make the tabs disappear. + $form_state['redirect'] = array("user/" . $form_state['values']['_account']->userid . "/delete", $destination); } /** @@ -306,7 +306,7 @@ function user_confirm_delete(&$form_stat return confirm_form($form, t('Are you sure you want to delete the account %name?', array('%name' => $account->name)), - 'user/' . $account->uid, + 'user/' . $account->userid, t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'), t('Delete'), t('Cancel')); } @@ -315,7 +315,7 @@ function user_confirm_delete(&$form_stat * Submit function for the confirm form for user deletion. */ function user_confirm_delete_submit($form, &$form_state) { - user_delete($form_state['values'], $form_state['values']['_account']->uid); + user_delete($form_state['values'], $form_state['values']['_account']->userid); drupal_set_message(t('%name has been deleted.', array('%name' => $form_state['values']['_account']->name))); if (!isset($_REQUEST['destination'])) { @@ -326,7 +326,7 @@ function user_confirm_delete_submit($for function user_edit_validate($form, &$form_state) { user_module_invoke('validate', $form_state['values'], $form_state['values']['_account'], $form_state['values']['_category']); // Validate input to ensure that non-privileged users can't alter protected data. - if ((!user_access('administer users') && array_intersect(array_keys($form_state['values']), array('uid', 'init', 'session'))) || (!user_access('administer permissions') && isset($form_state['values']['roles']))) { + if ((!user_access('administer users') && array_intersect(array_keys($form_state['values']), array('userid', 'init', 'session'))) || (!user_access('administer permissions') && isset($form_state['values']['roles']))) { watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING); // set this to a value type field form_set_error('category', t('Detected malicious attempt to alter protected user fields.')); @@ -355,8 +355,8 @@ function user_edit_submit($form, &$form_ */ function user_page() { global $user; - if ($user->uid) { - menu_set_active_item('user/' . $user->uid); + if ($user->userid) { + menu_set_active_item('user/' . $user->userid); return menu_execute_active_handler(); } else { Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.21 diff -u -p -r1.21 user.test --- modules/user/user.test 23 Nov 2008 15:55:43 -0000 1.21 +++ modules/user/user.test 24 Nov 2008 10:02:25 -0000 @@ -36,7 +36,7 @@ class UserRegistrationTestCase extends D // Check database for created user. $user = user_load($edit); $this->assertTrue($user, t('User found in database.')); - $this->assertTrue($user->uid > 0, t('User has valid user id.')); + $this->assertTrue($user->userid > 0, t('User has valid user id.')); // Check user fields. $this->assertEqual($user->name, $name, t('Username matches.')); @@ -77,7 +77,7 @@ class UserRegistrationTestCase extends D // Make sure password changes are present in database. require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc'); - $user = user_load(array('uid' => $user->uid)); + $user = user_load(array('userid' => $user->userid)); $this->assertTrue(user_check_password($new_pass, $user), t('Correct password in database.')); // Logout of user account. @@ -190,7 +190,7 @@ class UserDeleteTestCase extends DrupalW $this->drupalLogin($admin_user); // Delete user. - $this->drupalGet('user/' . $user->uid . '/edit'); + $this->drupalGet('user/' . $user->userid . '/edit'); $this->drupalPost(NULL, NULL, t('Delete')); $this->assertRaw(t('Are you sure you want to delete the account %name?', array('%name' => $user->name)), t('[confirm deletion] Asks for confirmation.')); $this->assertText(t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'), t('[confirm deletion] Inform that all submissions will be attributed to anonymouse account.')); @@ -407,11 +407,11 @@ class UserPictureTestCase extends Drupal function saveUserPicture($image) { $edit = array('files[picture_upload]' => realpath($image->filename)); - $this->drupalPost('user/' . $this->user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $this->user->userid.'/edit', $edit, t('Save')); $img_info = image_get_info($image->filename); $picture_dir = variable_get('user_picture_path', 'pictures'); - $pic_path = file_directory_path() . '/' . $picture_dir . '/picture-' . $this->user->uid . '.' . $img_info['extension']; + $pic_path = file_directory_path() . '/' . $picture_dir . '/picture-' . $this->user->userid . '.' . $img_info['extension']; return $pic_path; } @@ -517,7 +517,7 @@ class UserAdminTestCase extends DrupalWe $this->assertEqual($account->status, 1, 'User B not blocked'); $edit = array(); $edit['operation'] = 'block'; - $edit['accounts['. $account->uid .']'] = TRUE; + $edit['accounts['. $account->userid .']'] = TRUE; $this->drupalPost('admin/user/user', $edit, t('Update')); $account = user_load(array('name' => $user_b->name)); $this->assertEqual($account->status, 0, 'User B blocked'); @@ -571,7 +571,7 @@ class UserTimeZoneFunctionalTest extends $edit = array(); $edit['mail'] = $web_user->mail; $edit['timezone'] = 'America/Santiago'; - $this->drupalPost("user/$web_user->uid/edit", $edit, t('Save')); + $this->drupalPost("user/$web_user->userid/edit", $edit, t('Save')); $this->assertText(t('The changes have been saved.'), t('Time zone changed to Santiago time.')); // Confirm date format and time zone.