Completed
Pull Request — master (#526)
by Michael
02:11
created

StatsIdUsers::getPageName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
/**************************************************************************
3
 **********      English Wikipedia Account Request Interface      **********
4
 ***************************************************************************
5
 ** Wikipedia Account Request Graphic Design by Charles Melbye,           **
6
 ** which is licensed under a Creative Commons                            **
7
 ** Attribution-Noncommercial-Share Alike 3.0 United States License.      **
8
 **                                                                       **
9
 ** All other code are released under the Public Domain                   **
10
 ** by the ACC Development Team.                                          **
11
 **                                                                       **
12
 ** See CREDITS for the list of developers.                               **
13
 ***************************************************************************/
14
15
class StatsIdUsers extends StatisticsPage
16
{
17
    protected function execute()
18
    {
19
        return $this->getUserList();
20
    }
21
22
    public function getPageTitle()
23
    {
24
        return "User identification status";
25
    }
26
27
    public function getPageName()
28
    {
29
        return "IdUsers";
30
    }
31
32
    public function isProtected()
33
    {
34
        return true;
35
    }
36
37
    private function getUserList()
38
    {
39
        global $currentIdentificationVersion, $forceIdentification;
40
41
        $query = <<<SQL
42
select username, status, checkuser, identified, case 
43
    when coalesce(identified, 0) = 0 then 'Not identified'
44
    when identified < ${forceIdentification} then 'Expired'
45
    when identified >= ${forceIdentification} and identified < ${currentIdentificationVersion} then 'About to expire'
46
    when identified = ${currentIdentificationVersion} then 'OK'
47
    else 'Unknown'
48
    end
49
from user 
50
where status in ('User', 'Admin', 'New')
51
order by username;
52
SQL;
53
54
        $qb = new QueryBrowser();
55
        $qb->rowFetchMode = PDO::FETCH_NUM;
56
        $qb->overrideTableTitles = array("User name", "Access level", "Checkuser?", "Version", "Identification status");
57
        $r = $qb->executeQueryToTable($query);
58
59
        return $r;
60
    }
61
62
    public function requiresWikiDatabase()
63
    {
64
        return false;
65
    }
66
}
67