Completed
Pull Request — master (#526)
by Michael
01:57
created

StatsPasswordConversion   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 20
dl 0
loc 41
ccs 0
cts 33
cp 0
rs 10
c 1
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A requiresWikiDatabase() 0 3 1
A isProtected() 0 3 1
A getPageName() 0 3 1
A execute() 0 19 1
A getPageTitle() 0 3 1
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 StatsPasswordConversion extends StatisticsPage
16
{
17
	protected function execute()
18
	{
19
		$query = <<<sql
20
SELECT '0' AS 'Version', 'Active' AS 'Type', COUNT(*) AS 'Count' FROM user WHERE password NOT LIKE ':%' AND (status = 'User' OR status = 'Admin')
21
UNION
22
SELECT '0', 'Inactive', COUNT(*) FROM user WHERE password NOT LIKE ':%' AND NOT (status = 'User' OR status = 'Admin')
23
UNION
24
SELECT SUBSTRING(password FROM 2 FOR 1), 'Active', COUNT(*) FROM user WHERE password LIKE ':%' AND (status = 'User' OR status = 'Admin') GROUP BY SUBSTRING(password FROM 2 FOR 1)
25
UNION
26
SELECT SUBSTRING(password FROM 2 FOR 1), 'Inactive', COUNT(*) FROM user WHERE password LIKE ':%' AND NOT (status = 'User' OR status = 'Admin') GROUP BY SUBSTRING(password FROM 2 FOR 1)
27
ORDER BY `Version` ASC, 'Type' ASC
28
;
29
sql;
30
31
		$qb = new QueryBrowser();
32
		$qb->rowFetchMode = PDO::FETCH_NUM;
33
		$r = $qb->executeQueryToTable($query);
34
35
		return $r;
36
	}
37
38
	public function getPageTitle()
39
	{
40
		return "Password conversion status";
41
	}
42
43
	public function getPageName()
44
	{
45
		return "PasswordConversion";
46
	}
47
48
	public function isProtected()
49
	{
50
		return true;
51
	}
52
53
	public function requiresWikiDatabase()
54
	{
55
		return false;
56
	}
57
}
58