MediaWiki
REL1_39
ProtectedTitlesPager.php
Go to the documentation of this file.
1
<?php
22
use
MediaWiki\Cache\LinkBatchFactory
;
23
use
Wikimedia\Rdbms\ILoadBalancer
;
24
28
class
ProtectedTitlesPager
extends
AlphabeticPager
{
29
33
public
$mForm
;
34
38
public
$mConds
;
39
41
private
$level;
42
44
private
$namespace;
45
47
private
$linkBatchFactory;
48
60
public
function
__construct
(
61
SpecialProtectedtitles
$form,
62
LinkBatchFactory
$linkBatchFactory,
63
ILoadBalancer
$loadBalancer,
64
$conds,
65
$type
,
66
$level,
67
$namespace,
68
$sizetype,
69
$size
70
) {
71
// Set database before parent constructor to avoid setting it there with wfGetDB
72
$this->mDb = $loadBalancer->
getConnectionRef
( ILoadBalancer::DB_REPLICA );
73
$this->mForm = $form;
74
$this->mConds = $conds;
75
$this->level = $level;
76
$this->
namespace
= $namespace;
77
parent::__construct( $form->
getContext
() );
78
$this->linkBatchFactory = $linkBatchFactory;
79
}
80
81
protected
function
getStartBody
() {
82
# Do a link batch query
83
$this->mResult->seek( 0 );
84
$lb = $this->linkBatchFactory->newLinkBatch();
85
86
foreach
( $this->mResult as $row ) {
87
$lb->add( $row->pt_namespace, $row->pt_title );
88
}
89
90
$lb->execute();
91
92
return
''
;
93
}
94
98
public
function
getTitle
() {
99
return
$this->mForm->getPageTitle();
100
}
101
102
public
function
formatRow
( $row ) {
103
return
$this->mForm->formatRow( $row );
104
}
105
109
public
function
getQueryInfo
() {
110
$dbr
= $this->
getDatabase
();
111
$conds =
$this->mConds
;
112
$conds[] =
'pt_expiry > '
.
$dbr
->addQuotes( $this->mDb->timestamp() ) .
113
' OR pt_expiry IS NULL'
;
114
if
( $this->level ) {
115
$conds[
'pt_create_perm'
] = $this->level;
116
}
117
118
if
( $this->
namespace
!==
null
) {
119
$conds[] =
'pt_namespace='
.
$dbr
->addQuotes( $this->
namespace
);
120
}
121
122
return
[
123
'tables'
=>
'protected_titles'
,
124
'fields'
=> [
'pt_namespace'
,
'pt_title'
,
'pt_create_perm'
,
125
'pt_expiry'
,
'pt_timestamp'
],
126
'conds'
=> $conds
127
];
128
}
129
130
public
function
getIndexField
() {
131
return
'pt_timestamp'
;
132
}
133
}
AlphabeticPager
IndexPager with an alphabetic list and a formatted navigation bar.
Definition
AlphabeticPager.php:29
IndexPager\getDatabase
getDatabase()
Get the Database object in use.
Definition
IndexPager.php:249
MediaWiki\Cache\LinkBatchFactory
Definition
LinkBatchFactory.php:41
ProtectedTitlesPager
Definition
ProtectedTitlesPager.php:28
ProtectedTitlesPager\__construct
__construct(SpecialProtectedtitles $form, LinkBatchFactory $linkBatchFactory, ILoadBalancer $loadBalancer, $conds, $type, $level, $namespace, $sizetype, $size)
Definition
ProtectedTitlesPager.php:60
ProtectedTitlesPager\formatRow
formatRow( $row)
Returns an HTML string representing the result row $row.
Definition
ProtectedTitlesPager.php:102
ProtectedTitlesPager\$mForm
SpecialProtectedtitles $mForm
Definition
ProtectedTitlesPager.php:33
ProtectedTitlesPager\getTitle
getTitle()
Definition
ProtectedTitlesPager.php:98
ProtectedTitlesPager\getStartBody
getStartBody()
Hook into getBody(), allows text to be inserted at the start.
Definition
ProtectedTitlesPager.php:81
ProtectedTitlesPager\getIndexField
getIndexField()
Returns the name of the index field.
Definition
ProtectedTitlesPager.php:130
ProtectedTitlesPager\getQueryInfo
getQueryInfo()
Definition
ProtectedTitlesPager.php:109
ProtectedTitlesPager\$mConds
array $mConds
Definition
ProtectedTitlesPager.php:38
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:33
Wikimedia\Rdbms\ILoadBalancer
Create and track the database connections and transactions for a given database cluster.
Definition
ILoadBalancer.php:77
Wikimedia\Rdbms\ILoadBalancer\getConnectionRef
getConnectionRef( $i, $groups=[], $domain=false, $flags=0)
$dbr
$dbr
Definition
testCompression.php:54
$type
$type
Definition
testCompression.php:52
includes
specials
pagers
ProtectedTitlesPager.php
Generated on Mon Dec 23 2024 06:24:47 for MediaWiki by
1.10.0