90 $this->mConds = $conds;
91 $this->type =
$type ?:
'edit';
93 $this->
namespace = $namespace;
95 $this->size = intval(
$size );
102 # Do a link batch query
103 $lb = $this->linkBatchFactory->newLinkBatch();
106 foreach ( $result as $row ) {
107 $lb->add( $row->page_namespace, $row->page_title );
108 if ( $row->actor_user !==
null ) {
109 $userids[] = $row->actor_user;
114 if ( count( $userids ) ) {
115 $this->userCache->doQuery( $userids, [], __METHOD__ );
116 foreach ( $userids as $userid ) {
117 $name = $this->userCache->getProp( $userid,
'name' );
118 if ( $name !==
false ) {
128 $this->formattedComments = $this->rowCommentFormatter->formatRows( $result,
'log_comment' );
132 static $headers =
null;
134 if ( $headers == [] ) {
136 'log_timestamp' =>
'protectedpages-timestamp',
137 'pr_page' =>
'protectedpages-page',
138 'pr_expiry' =>
'protectedpages-expiry',
139 'actor_user' =>
'protectedpages-performer',
140 'pr_params' =>
'protectedpages-params',
141 'log_comment' =>
'protectedpages-reason',
143 foreach ( $headers as $key => $val ) {
144 $headers[$key] = $this->
msg( $val )->text();
163 case 'log_timestamp':
165 if ( $value ===
null ) {
168 [
'class' =>
'mw-protectedpages-unknown' ],
169 $this->
msg(
'protectedpages-unknown-timestamp' )->escaped()
172 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
182 [
'class' =>
'mw-invalidtitle' ],
185 $row->page_namespace,
192 if ( $row->page_len !==
null ) {
196 [
'class' =>
'mw-protectedpages-length' ],
203 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
204 $value,
true,
'infinity', $this->
getUser() ) );
209 $this->
msg(
'protect_change' )->text(),
211 [
'action' =>
'unprotect' ]
215 [
'class' =>
'mw-protectedpages-actions' ],
216 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
223 if ( $row->log_timestamp ===
null ) {
226 [
'class' =>
'mw-protectedpages-unknown' ],
227 $this->
msg(
'protectedpages-unknown-performer' )->escaped()
230 $username = $row->actor_name;
239 $formatted = $this->
msg(
'rev-deleted-user' )->escaped();
242 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
250 $params[] = $this->
msg(
'restriction-level-' . $row->pr_level )->escaped();
251 if ( $row->pr_cascade ) {
252 $params[] = $this->
msg(
'protect-summary-cascade' )->escaped();
254 $formatted = $this->
getLanguage()->commaList( $params );
259 if ( $row->log_timestamp ===
null ) {
262 [
'class' =>
'mw-protectedpages-unknown' ],
263 $this->
msg(
'protectedpages-unknown-reason' )->escaped()
273 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
276 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
291 $conds[] =
'pr_expiry > ' .
$dbr->addQuotes(
$dbr->timestamp() ) .
292 ' OR pr_expiry IS NULL';
293 $conds[] =
'page_id=pr_page';
294 $conds[] =
'pr_type=' .
$dbr->addQuotes( $this->type );
296 if ( $this->sizetype ==
'min' ) {
298 } elseif ( $this->sizetype ==
'max' ) {
302 if ( $this->indefonly ) {
303 $infinity =
$dbr->addQuotes(
$dbr->getInfinity() );
304 $conds[] =
"pr_expiry = $infinity OR pr_expiry IS NULL";
306 if ( $this->cascadeonly ) {
307 $conds[] =
'pr_cascade = 1';
309 if ( $this->noredirect ) {
310 $conds[] =
'page_is_redirect = 0';
313 if ( $this->level ) {
314 $conds[] =
'pr_level=' .
$dbr->addQuotes( $this->level );
316 if ( $this->
namespace !==
null ) {
317 $conds[] =
'page_namespace=' .
$dbr->addQuotes( $this->
namespace );
320 $commentQuery = $this->commentStore->getJoin(
'log_comment' );
324 'page',
'page_restrictions',
'log_search',
325 'logparen' => [
'logging',
'actor' ] + $commentQuery[
'tables'],
340 ] + $commentQuery[
'fields'],
345 'ls_field' =>
'pr_id',
'ls_value = ' .
$dbr->buildStringCast(
'pr_id' )
358 ] + $commentQuery[
'joins']
363 return parent::getTableClass() .
' mw-protectedpages';
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
getContext()
Get the base IContextSource object.
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
static formatRevisionSize( $size)
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null, $useParentheses=true)
Generate standard user tool links (talk, contributions, block link, etc.)
static userCanBitfield( $bitfield, $field, Authority $performer)
Determine if the current user is allowed to view a particular field of this log row,...
static isDeleted( $row, $field)
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Interface for objects which can provide a MediaWiki context on request.