Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
LogoutWorkstations | n/a |
0 / 0 |
n/a |
0 / 0 |
4 | n/a |
0 / 0 |
|||
init | n/a |
0 / 0 |
n/a |
0 / 0 |
4 |
1 | <?php |
2 | |
3 | namespace BO\Zmsdb\Helper; |
4 | |
5 | /** |
6 | * @codeCoverageIgnore |
7 | */ |
8 | class LogoutWorkstations |
9 | { |
10 | /** |
11 | * logout all workstations |
12 | * |
13 | * @return Entity |
14 | */ |
15 | |
16 | public static function init($verbose) |
17 | { |
18 | $query = new \BO\Zmsdb\Query\Workstation(\BO\Zmsdb\Query\Base::SELECT); |
19 | $query |
20 | ->addEntityMapping() |
21 | ->addResolvedReferences(1); |
22 | $parameters = $query->getParameters(); |
23 | $connection = \BO\Zmsdb\Connection\Select::getWriteConnection(); |
24 | $statement = $connection->prepare("$query"); |
25 | $statement->execute($parameters); |
26 | while ($data = $statement->fetch(\PDO::FETCH_ASSOC)) { |
27 | $dataEntity = new \BO\Zmsentities\Workstation(); |
28 | $dataEntity->exchangeArray($query->postProcessJoins($data)); |
29 | $dataEntity->setResolveLevel($query->getResolveLevel()); |
30 | if ($dataEntity->useraccount->lastLogin) { |
31 | if ($verbose) { |
32 | //var_export($data); |
33 | error_log("Logout: $dataEntity->id " . $dataEntity->useraccount->id); |
34 | } |
35 | (new \BO\Zmsdb\Workstation())->writeEntityLogoutByName($dataEntity->useraccount->id); |
36 | } |
37 | } |
38 | \BO\Zmsdb\Connection\Select::writeCommit(); |
39 | } |
40 | } |