-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathWatchAnalyticsWikiTablePager.php
More file actions
86 lines (69 loc) · 2.05 KB
/
Copy pathWatchAnalyticsWikiTablePager.php
File metadata and controls
86 lines (69 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
class WatchAnalyticsWikiTablePager extends WatchAnalyticsTablePager {
protected $isSortable = [
'tracking_timestamp' => true,
'num_pages' => true,
'num_watches' => true,
'num_pending' => true,
'max_pending_minutes' => true,
'avg_pending_minutes' => true,
'num_unwatched' => true,
'num_one_watched' => true,
'num_unreviewed' => true,
'num_one_reviewed' => true,
'content_num_pages' => true,
'content_num_watches' => true,
'content_num_pending' => true,
'content_max_pending_minutes' => true,
'content_avg_pending_minutes' => true,
'content_num_unwatched' => true,
'content_num_one_watched' => true,
'content_num_unreviewed' => true,
'content_num_one_reviewed' => true,
];
public function __construct( $page, $conds ) {
$this->watchQuery = new WikiWatchesQuery();
parent::__construct( $page, $conds );
global $wgRequest;
$sortField = $wgRequest->getVal( 'sort' );
if ( ! isset( $sortField ) ) {
$this->mDefaultDirection = false;
}
$this->mExtraSortFields = [];
}
public function getQueryInfo() {
return $this->watchQuery->getQueryInfo();
}
public function formatValue( $fieldName, $value ) {
$timeDiffFields = [
'max_pending_minutes',
'avg_pending_minutes',
'content_max_pending_minutes',
'content_avg_pending_minutes',
];
if ( in_array( $fieldName, $timeDiffFields ) ) {
return ( $value === null ) ? null : $this->watchQuery->createTimeStringFromMinutes( $value );
} elseif ( $fieldName === 'tracking_timestamp' ) {
$ts = new MWTimestamp( $value );
return $ts->format( 'Y-m-d' ) . '<br />' . $ts->format( 'H:i:s' );
} else {
return $value;
}
}
public function getFieldNames() {
return $this->watchQuery->getFieldNames();
}
public function getDefaultSort() {
return 'tracking_timestamp';
}
/**
* Overrides default which builds a form allowing to select by category and
* user group. These selections don't make sense for the all-wiki data, and
* thus the method returns blank.
*
* @return string empty string
*/
public function buildForm() {
return '';
}
}