protected function getExistingSession(string $sessionID): bool
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_session
+ FROM wcf1_user_session
WHERE sessionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$sessionID,
]);
// The former two fields are not going to rapidly change and the latter is just
// used for session expiry, where accuracy to the second is not required.
if ($row['lastActivityTime'] < (TIME_NOW - 60)) {
- $sql = "UPDATE wcf" . WCF_N . "_user_session
+ $sql = "UPDATE wcf1_user_session
SET ipAddress = ?,
userAgent = ?,
lastActivityTime = ?
WHERE sessionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
UserUtil::getIpAddress(),
UserUtil::getUserAgent(),
}
$sql = "SELECT *
- FROM wcf" . WCF_N . "_session
- " . $condition;
- $legacySessionStatement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_session
+ {$condition}";
+ $legacySessionStatement = WCF::getDB()->prepare($sql);
$legacySessionStatement->execute($condition->getParameters());
$this->legacySession = $legacySessionStatement->fetchSingleObject(LegacySession::class);
];
// Create new session.
- $sql = "INSERT INTO wcf" . WCF_N . "_user_session
+ $sql = "INSERT INTO wcf1_user_session
(sessionID, ipAddress, userAgent, creationTime, lastActivityTime, sessionVariables)
VALUES (?, ?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->sessionID,
UserUtil::getIpAddress(),
$spiderID = $this->getSpiderID(UserUtil::getUserAgent());
if ($spiderID) {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_session
+ FROM wcf1_session
WHERE spiderID = ?
AND userID IS NULL
ORDER BY lastActivityTime DESC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$spiderID]);
$this->legacySession = $statement->fetchSingleObject(LegacySession::class);
}
// work-around for setup process (package wcf does not exist yet)
if (!PACKAGE_ID) {
$sql = "SELECT groupID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->user->userID]);
$groupIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
} else {
// work-around for setup process (package wcf does not exist yet)
if (!PACKAGE_ID) {
$sql = "SELECT languageID
- FROM wcf" . WCF_N . "_user_to_language
+ FROM wcf1_user_to_language
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->user->userID]);
$this->languageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
} else {
$this->create();
// ... delete the newly created legacy session ...
- $sql = "DELETE FROM wcf" . WCF_N . "_session
+ $sql = "DELETE FROM wcf1_session
WHERE sessionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->sessionID]);
// ... perform the login ...
- $sql = "UPDATE wcf" . WCF_N . "_user_session
+ $sql = "UPDATE wcf1_user_session
SET userID = ?
WHERE sessionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$user->userID,
$this->sessionID,
// ... delete any user sessions exceeding the limit ...
$sql = "SELECT all_sessions.sessionID
- FROM wcf" . WCF_N . "_user_session all_sessions
+ FROM wcf1_user_session all_sessions
LEFT JOIN (
SELECT sessionID
- FROM wcf" . WCF_N . "_user_session
+ FROM wcf1_user_session
WHERE userID = ?
ORDER BY lastActivityTime DESC
LIMIT " . self::USER_SESSION_LIMIT . "
ON newest_sessions.sessionID = all_sessions.sessionID
WHERE all_sessions.userID = ?
AND newest_sessions.sessionID IS NULL";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$user->userID,
$user->userID,
}
if ($this->variablesChanged) {
- $sql = "UPDATE wcf" . WCF_N . "_user_session
+ $sql = "UPDATE wcf1_user_session
SET sessionVariables = ?
WHERE sessionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
\serialize($this->variables),
$this->sessionID,
*/
public function prune()
{
- $sql = "DELETE FROM wcf" . WCF_N . "_user_session
+ $sql = "DELETE FROM wcf1_user_session
WHERE (lastActivityTime < ? AND userID IS NULL)
OR (lastActivityTime < ? AND userID IS NOT NULL)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
TIME_NOW - self::GUEST_SESSION_LIFETIME,
TIME_NOW - self::USER_SESSION_LIFETIME,
]);
// Legacy sessions live 120 minutes, they will be re-created on demand.
- $sql = "DELETE FROM wcf" . WCF_N . "_session
+ $sql = "DELETE FROM wcf1_session
WHERE lastActivityTime < ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
TIME_NOW - (3600 * 2),
]);
}
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_session
+ FROM wcf1_user_session
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$user->userID]);
$sessions = [];
$conditionBuilder->add('sessionID <> ?', [$sessionID]);
}
- $sql = "DELETE FROM wcf" . WCF_N . "_user_session
- " . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $sql = "DELETE FROM wcf1_user_session
+ {$conditionBuilder}";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
// Delete legacy session.
- $sql = "DELETE FROM wcf" . WCF_N . "_session
- " . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $sql = "DELETE FROM wcf1_session
+ {$conditionBuilder}";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
}
*/
public function deleteUserSession(string $sessionID): void
{
- $sql = "DELETE FROM wcf" . WCF_N . "_user_session
+ $sql = "DELETE FROM wcf1_user_session
WHERE sessionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$sessionID]);
// Delete legacy session.
- $sql = "DELETE FROM wcf" . WCF_N . "_session
+ $sql = "DELETE FROM wcf1_session
WHERE sessionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$sessionID]);
}
}