function user_install

Implements hook_install().

File

drupal/core/modules/user/user.install, line 350
Install, update and uninstall functions for the user module.

Code

function user_install() {

  // Insert a row for the anonymous user.
  db_insert('users')
    ->fields(array(
    'uid' => 0,
    'name' => '',
    'mail' => '',
  ))
    ->execute();

  // We need some placeholders here as name and mail are uniques and data is
  // presumed to be a serialized array. This will be changed by the settings
  // form in the installer.
  db_insert('users')
    ->fields(array(
    'uid' => 1,
    'name' => 'placeholder-for-uid-1',
    'mail' => 'placeholder-for-uid-1',
    'created' => REQUEST_TIME,
    'status' => 1,
  ))
    ->execute();

  // Insert built-in roles.
  db_insert('role')
    ->fields(array(
    'rid',
    'name',
    'weight',
  ))
    ->values(array(
    DRUPAL_ANONYMOUS_RID,
    'Anonymous user',
    0,
  ))
    ->values(array(
    DRUPAL_AUTHENTICATED_RID,
    'Authenticated user',
    1,
  ))
    ->execute();
}