CanaryAdapter.php

main 37 lines · 890 bytes Raw
Alex Alex Commit Initial commit 01/10/2026 09:20
1<?php
2/**
3 * Canary. Normalised to the TFS_10 schema for querying (see engine/init.php),
4 * but it is not TFS: the legacy accounts.secret 2FA flow does not apply, which
5 * is why engine/init.php also forces twoFactorAuthenticator off for it.
6 */
7final class CanaryAdapter implements ServerAdapterInterface
8{
9 public function key(): string {
10 return 'CANARY';
11 }
12
13 public function login(string $username, string $password): int|false {
14 return user_login($username, $password);
15 }
16
17 public function accountIdentityColumn(): string {
18 return 'name';
19 }
20
21 public function accountDisplayColumn(): string {
22 return '`a`.`name`';
23 }
24
25 public function supportsLegacyTwoFactor(): bool {
26 return false;
27 }
28
29 public function onlineCount(): int {
30 return znote_sql_count("SELECT COUNT(*) AS `c` FROM `players_online`;");
31 }
32
33 public function normalizedEngine(): string {
34 return 'TFS_10';
35 }
36}
37
Top