You are here

public function UserStorage::updateLastAccessTimestamp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/UserStorage.php \Drupal\user\UserStorage::updateLastAccessTimestamp()

Update the last access timestamp of the user.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user object.

int $timestamp: The last access timestamp.

Overrides UserStorageInterface::updateLastAccessTimestamp

File

core/modules/user/src/UserStorage.php, line 108
Contains \Drupal\user\UserStorage.

Class

UserStorage
Controller class for users.

Namespace

Drupal\user

Code

public function updateLastAccessTimestamp(AccountInterface $account, $timestamp) {
  $this->database
    ->update('users_field_data')
    ->fields(array(
    'access' => $timestamp,
  ))
    ->condition('uid', $account
    ->id())
    ->execute();

  // Ensure that the entity cache is cleared.
  $this
    ->resetCache(array(
    $account
      ->id(),
  ));
}