protected function storeHash(\ElggUser $user, $hash)
{
// This prevents inserting the same hash twice, which seems to be happening in some rare cases
// and for unknown reasons. See https://github.com/Elgg/Elgg/issues/8104
$this->removeHash($hash);
$time = time();
$hash = $this->db->sanitizeString($hash);
$query = "\n\t\t\tINSERT INTO {$this->table} (code, guid, timestamp)\n\t\t VALUES ('{$hash}', {$user->guid}, {$time})\n\t\t";
try {
$this->db->insertData($query);
} catch (\DatabaseException $e) {
$this->handleDbException($e);
}
}