Rename and add session update methods
This commit is contained in:
parent
a9a13f186c
commit
cd7be1c3b2
5 changed files with 58 additions and 21 deletions
|
@ -138,7 +138,7 @@
|
|||
* @return void
|
||||
* @throws DatabaseOperationException
|
||||
*/
|
||||
public static function updateAuthenticatedPeer(string $uuid, RegisteredPeerRecord|string $registeredPeerUuid): void
|
||||
public static function updatePeer(string $uuid, RegisteredPeerRecord|string $registeredPeerUuid): void
|
||||
{
|
||||
if($registeredPeerUuid instanceof RegisteredPeerRecord)
|
||||
{
|
||||
|
@ -149,7 +149,7 @@
|
|||
|
||||
try
|
||||
{
|
||||
$statement = Database::getConnection()->prepare("UPDATE sessions SET authenticated_peer_uuid=? WHERE uuid=?");
|
||||
$statement = Database::getConnection()->prepare("UPDATE sessions SET peer_uuid=? WHERE uuid=?");
|
||||
$statement->bindParam(1, $registeredPeerUuid);
|
||||
$statement->bindParam(2, $uuid);
|
||||
$statement->execute();
|
||||
|
@ -160,6 +160,23 @@
|
|||
}
|
||||
}
|
||||
|
||||
public static function updateAuthentication(string $uuid, bool $authenticated): void
|
||||
{
|
||||
Logger::getLogger()->verbose(sprintf("Marking session %s as authenticated: %s", $uuid, $authenticated ? 'true' : 'false'));
|
||||
|
||||
try
|
||||
{
|
||||
$statement = Database::getConnection()->prepare("UPDATE sessions SET authenticated=? WHERE uuid=?");
|
||||
$statement->bindParam(1, $authenticated);
|
||||
$statement->bindParam(2, $uuid);
|
||||
$statement->execute();
|
||||
}
|
||||
catch (PDOException $e)
|
||||
{
|
||||
throw new DatabaseOperationException('Failed to update authenticated peer', $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the last request timestamp for a given session by its UUID.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue