Differential D14219 Diff 34352 src/applications/auth/garbagecollector/PhabricatorAuthSessionGarbageCollector.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/garbagecollector/PhabricatorAuthSessionGarbageCollector.php
| <?php | <?php | ||||
| final class PhabricatorAuthSessionGarbageCollector | final class PhabricatorAuthSessionGarbageCollector | ||||
| extends PhabricatorGarbageCollector { | extends PhabricatorGarbageCollector { | ||||
| const COLLECTORCONST = 'auth.sessions'; | const COLLECTORCONST = 'auth.sessions'; | ||||
| public function getCollectorName() { | public function getCollectorName() { | ||||
| return pht('Auth Sessions'); | return pht('Authentication Sessions'); | ||||
| } | } | ||||
| public function hasAutomaticPolicy() { | public function hasAutomaticPolicy() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function collectGarbage() { | protected function collectGarbage() { | ||||
| $session_table = new PhabricatorAuthSession(); | $session_table = new PhabricatorAuthSession(); | ||||
| $conn_w = $session_table->establishConnection('w'); | $conn_w = $session_table->establishConnection('w'); | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'DELETE FROM %T WHERE sessionExpires <= UNIX_TIMESTAMP() LIMIT 100', | 'DELETE FROM %T WHERE sessionExpires <= UNIX_TIMESTAMP() LIMIT 100', | ||||
| $session_table->getTableName()); | $session_table->getTableName()); | ||||
| return ($conn_w->getAffectedRows() == 100); | return ($conn_w->getAffectedRows() == 100); | ||||
| } | } | ||||
| } | } | ||||