1
|
|
|
<?php |
2
|
|
|
/****************************************************************************** |
3
|
|
|
* Wikipedia Account Creation Assistance tool * |
4
|
|
|
* * |
5
|
|
|
* All code in this file is released into the public domain by the ACC * |
6
|
|
|
* Development Team. Please see team.json for a list of contributors. * |
7
|
|
|
******************************************************************************/ |
8
|
|
|
|
9
|
|
|
namespace Waca\Pages\Statistics; |
10
|
|
|
|
11
|
|
|
use DateTime; |
12
|
|
|
use PDO; |
13
|
|
|
use Waca\DataObjects\User; |
14
|
|
|
use Waca\Helpers\SearchHelpers\UserSearchHelper; |
15
|
|
|
use Waca\Pages\PageUserManagement; |
16
|
|
|
use Waca\Tasks\InternalPageBase; |
17
|
|
|
|
18
|
|
|
class StatsInactiveUsers extends InternalPageBase |
19
|
|
|
{ |
20
|
|
|
public function main() |
21
|
|
|
{ |
22
|
|
|
$this->setHtmlTitle('Inactive Users :: Statistics'); |
23
|
|
|
|
24
|
|
|
$date = new DateTime(); |
25
|
|
|
$date->modify("-45 days"); |
26
|
|
|
|
27
|
|
|
$inactiveUsers = UserSearchHelper::get($this->getDatabase()) |
28
|
|
|
->byStatus('Active') |
29
|
|
|
->lastActiveBefore($date) |
30
|
|
|
->getRoleMap($roleMap) |
31
|
|
|
->fetch(); |
32
|
|
|
|
33
|
|
|
$this->assign('inactiveUsers', $inactiveUsers); |
34
|
|
|
$this->assign('roles', $roleMap); |
35
|
|
|
$this->assign('canSuspend', |
36
|
|
|
$this->barrierTest('suspend', User::getCurrent($this->getDatabase()), PageUserManagement::class)); |
37
|
|
|
|
38
|
|
|
$immuneUsers = $this->getDatabase() |
39
|
|
|
->query("SELECT user FROM userrole WHERE role IN ('toolRoot', 'checkuser') GROUP BY user;") |
40
|
|
|
->fetchAll(PDO::FETCH_COLUMN); |
41
|
|
|
|
42
|
|
|
$this->assign('immune', array_fill_keys($immuneUsers, true)); |
43
|
|
|
|
44
|
|
|
$this->setTemplate('statistics/inactive-users.tpl'); |
45
|
|
|
$this->assign('statsPageTitle', 'Inactive tool users'); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|