1 | <?php |
||
31 | class UserOnlineTable extends Table |
||
32 | { |
||
33 | use LogTrait; |
||
34 | |||
35 | /** |
||
36 | * Time in seconds until a user is considered offline. |
||
37 | * |
||
38 | * Default: 20 Minutes. |
||
39 | * |
||
40 | * @var int |
||
41 | */ |
||
42 | private $timeUntilOffline = 1200; |
||
43 | |||
44 | /** |
||
45 | * {@inheritDoc} |
||
46 | */ |
||
47 | public function initialize(array $config) |
||
65 | |||
66 | /** |
||
67 | * {@inheritDoc} |
||
68 | */ |
||
69 | public function validationDefault(Validator $validator) |
||
87 | |||
88 | /** |
||
89 | * Sets time in secondes until a user is considered offline. |
||
90 | * |
||
91 | * Adjust to sane values taking JS-frontend status ping time intervall into |
||
92 | * account, which also keeps the user online. |
||
93 | * |
||
94 | * @param int $period Time in seconds |
||
95 | * @return void |
||
96 | */ |
||
97 | public function setOnlinePeriod(int $period): void |
||
101 | |||
102 | /** |
||
103 | * Sets user with `$id` online |
||
104 | * |
||
105 | * @param string $id usually user-ID (logged-in user) or session_id (not logged-in) |
||
106 | * @param bool $loggedIn user is logged-in |
||
107 | * @return void |
||
108 | */ |
||
109 | public function setOnline(string $id, bool $loggedIn): void |
||
161 | |||
162 | /** |
||
163 | * Removes user with uuid `$id` from UserOnline |
||
164 | * |
||
165 | * @param int|string $id id |
||
166 | * @return void |
||
167 | */ |
||
168 | public function setOffline($id): void |
||
173 | |||
174 | /** |
||
175 | * Get all logged-in users |
||
176 | * |
||
177 | * Don't use directly but use \Saito\App\Stats |
||
178 | * |
||
179 | * @td @sm make finder |
||
180 | * |
||
181 | * @return Query |
||
182 | */ |
||
183 | public function getLoggedIn(): Query |
||
203 | |||
204 | /** |
||
205 | * Removes users which weren't online $timeDiff seconds. |
||
206 | * |
||
207 | * @return void |
||
208 | */ |
||
209 | public function gc(): void |
||
213 | |||
214 | /** |
||
215 | * Shortens a string to fit in the uuid table-field. |
||
216 | * |
||
217 | * @param string $id The string to shorten. |
||
218 | * @return string The shoretened string. |
||
219 | */ |
||
220 | protected function getShortendedId(string $id): string |
||
224 | } |
||
225 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.