MediaWiki
REL1_40
ProtectedTitlesPager.php
Go to the documentation of this file.
1
<?php
22
use
MediaWiki\Cache\LinkBatchFactory
;
23
use
MediaWiki\Title\Title
;
24
use
Wikimedia\Rdbms\ILoadBalancer
;
25
29
class
ProtectedTitlesPager
extends
AlphabeticPager
{
30
34
public
$mForm
;
35
39
public
$mConds
;
40
42
private
$level;
43
45
private
$namespace;
46
48
private
$linkBatchFactory;
49
61
public
function
__construct
(
62
SpecialProtectedtitles
$form,
63
LinkBatchFactory
$linkBatchFactory,
64
ILoadBalancer
$loadBalancer,
65
$conds,
66
$type
,
67
$level,
68
$namespace,
69
$sizetype,
70
$size
71
) {
72
// Set database before parent constructor to avoid setting it there with wfGetDB
73
$this->mDb = $loadBalancer->
getConnectionRef
( ILoadBalancer::DB_REPLICA );
74
$this->mForm = $form;
75
$this->mConds = $conds;
76
$this->level = $level;
77
$this->
namespace
= $namespace;
78
parent::__construct( $form->
getContext
() );
79
$this->linkBatchFactory = $linkBatchFactory;
80
}
81
82
protected
function
getStartBody
() {
83
# Do a link batch query
84
$this->mResult->seek( 0 );
85
$lb = $this->linkBatchFactory->newLinkBatch();
86
87
foreach
( $this->mResult as $row ) {
88
$lb->add( $row->pt_namespace, $row->pt_title );
89
}
90
91
$lb->execute();
92
93
return
''
;
94
}
95
99
public
function
getTitle
() {
100
return
$this->mForm->getPageTitle();
101
}
102
103
public
function
formatRow
( $row ) {
104
return
$this->mForm->formatRow( $row );
105
}
106
110
public
function
getQueryInfo
() {
111
$dbr
= $this->
getDatabase
();
112
$conds =
$this->mConds
;
113
$conds[] =
'pt_expiry > '
.
$dbr
->addQuotes( $this->mDb->timestamp() ) .
114
' OR pt_expiry IS NULL'
;
115
if
( $this->level ) {
116
$conds[
'pt_create_perm'
] = $this->level;
117
}
118
119
if
( $this->
namespace
!==
null
) {
120
$conds[] =
'pt_namespace='
.
$dbr
->addQuotes( $this->
namespace
);
121
}
122
123
return
[
124
'tables'
=>
'protected_titles'
,
125
'fields'
=> [
'pt_namespace'
,
'pt_title'
,
'pt_create_perm'
,
126
'pt_expiry'
,
'pt_timestamp'
],
127
'conds'
=> $conds
128
];
129
}
130
131
public
function
getIndexField
() {
132
return
[ [
'pt_timestamp'
,
'pt_namespace'
,
'pt_title'
] ];
133
}
134
}
AlphabeticPager
IndexPager with an alphabetic list and a formatted navigation bar.
Definition
AlphabeticPager.php:27
IndexPager\getDatabase
getDatabase()
Get the Database object in use.
Definition
IndexPager.php:250
MediaWiki\Cache\LinkBatchFactory
Definition
LinkBatchFactory.php:41
MediaWiki\Title\Title
Represents a title within MediaWiki.
Definition
Title.php:82
ProtectedTitlesPager
Definition
ProtectedTitlesPager.php:29
ProtectedTitlesPager\__construct
__construct(SpecialProtectedtitles $form, LinkBatchFactory $linkBatchFactory, ILoadBalancer $loadBalancer, $conds, $type, $level, $namespace, $sizetype, $size)
Definition
ProtectedTitlesPager.php:61
ProtectedTitlesPager\formatRow
formatRow( $row)
Returns an HTML string representing the result row $row.
Definition
ProtectedTitlesPager.php:103
ProtectedTitlesPager\$mForm
SpecialProtectedtitles $mForm
Definition
ProtectedTitlesPager.php:34
ProtectedTitlesPager\getTitle
getTitle()
Definition
ProtectedTitlesPager.php:99
ProtectedTitlesPager\getStartBody
getStartBody()
Hook into getBody(), allows text to be inserted at the start.
Definition
ProtectedTitlesPager.php:82
ProtectedTitlesPager\getIndexField
getIndexField()
Returns the name of the index field.
Definition
ProtectedTitlesPager.php:131
ProtectedTitlesPager\getQueryInfo
getQueryInfo()
Definition
ProtectedTitlesPager.php:110
ProtectedTitlesPager\$mConds
array $mConds
Definition
ProtectedTitlesPager.php:39
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition
SpecialPage.php:836
SpecialProtectedtitles
A special page that list protected titles from creation.
Definition
SpecialProtectedtitles.php:36
Wikimedia\Rdbms\ILoadBalancer
This class is a delegate to ILBFactory for a given database cluster.
Definition
ILoadBalancer.php:113
Wikimedia\Rdbms\ILoadBalancer\getConnectionRef
getConnectionRef( $i, $groups=[], $domain=false, $flags=0)
$dbr
$dbr
Definition
testCompression.php:55
$type
$type
Definition
testCompression.php:53
includes
specials
pagers
ProtectedTitlesPager.php
Generated on Thu Jun 27 2024 14:04:17 for MediaWiki by
1.10.0