Go to the documentation of this file.
82 $this->mConds = $conds;
83 $this->type =
$type ?:
'edit';
85 $this->
namespace = $namespace;
87 $this->size = intval(
$size );
98 # Do a link batch query
99 $lb = $this->linkBatchFactory->newLinkBatch();
102 foreach ( $result as $row ) {
103 $lb->add( $row->page_namespace, $row->page_title );
105 if ( $row->log_user !==
null ) {
106 $userids[] = $row->log_user;
111 if ( count( $userids ) ) {
112 $this->userCache->doQuery( $userids, [], __METHOD__ );
113 foreach ( $userids as $userid ) {
114 $name = $this->userCache->getProp( $userid,
'name' );
115 if ( $name !==
false ) {
126 static $headers =
null;
128 if ( $headers == [] ) {
130 'log_timestamp' =>
'protectedpages-timestamp',
131 'pr_page' =>
'protectedpages-page',
132 'pr_expiry' =>
'protectedpages-expiry',
133 'log_user' =>
'protectedpages-performer',
134 'pr_params' =>
'protectedpages-params',
135 'log_comment' =>
'protectedpages-reason',
137 foreach ( $headers as $key => $val ) {
138 $headers[$key] = $this->
msg( $val )->text();
157 case 'log_timestamp':
159 if ( $value ===
null ) {
162 [
'class' =>
'mw-protectedpages-unknown' ],
163 $this->
msg(
'protectedpages-unknown-timestamp' )->escaped()
166 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
176 [
'class' =>
'mw-invalidtitle' ],
179 $row->page_namespace,
186 if ( $row->page_len !==
null ) {
190 [
'class' =>
'mw-protectedpages-length' ],
197 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
203 $this->
msg(
'protect_change' )->text(),
205 [
'action' =>
'unprotect' ]
209 [
'class' =>
'mw-protectedpages-actions' ],
210 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
217 if ( $row->log_timestamp ===
null ) {
220 [
'class' =>
'mw-protectedpages-unknown' ],
221 $this->
msg(
'protectedpages-unknown-performer' )->escaped()
224 $username = $this->userCache->getProp( $value,
'name' );
230 if ( $username ===
false ) {
231 $formatted = htmlspecialchars( $value );
237 $formatted = $this->
msg(
'rev-deleted-user' )->escaped();
240 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
248 $params[] = $this->
msg(
'restriction-level-' . $row->pr_level )->escaped();
249 if ( $row->pr_cascade ) {
250 $params[] = $this->
msg(
'protect-summary-cascade' )->escaped();
252 $formatted = $this->
getLanguage()->commaList( $params );
257 if ( $row->log_timestamp ===
null ) {
260 [
'class' =>
'mw-protectedpages-unknown' ],
261 $this->
msg(
'protectedpages-unknown-reason' )->escaped()
269 $value = $this->commentStore->getComment(
'log_comment', $row )->text;
272 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
275 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
290 $conds[] =
'pr_expiry > ' .
$dbr->addQuotes(
$dbr->timestamp() ) .
291 ' OR pr_expiry IS NULL';
292 $conds[] =
'page_id=pr_page';
293 $conds[] =
'pr_type=' .
$dbr->addQuotes( $this->type );
295 if ( $this->sizetype ==
'min' ) {
297 } elseif ( $this->sizetype ==
'max' ) {
301 if ( $this->indefonly ) {
302 $infinity =
$dbr->addQuotes(
$dbr->getInfinity() );
303 $conds[] =
"pr_expiry = $infinity OR pr_expiry IS NULL";
305 if ( $this->cascadeonly ) {
306 $conds[] =
'pr_cascade = 1';
308 if ( $this->noredirect ) {
309 $conds[] =
'page_is_redirect = 0';
312 if ( $this->level ) {
313 $conds[] =
'pr_level=' .
$dbr->addQuotes( $this->level );
315 if ( $this->
namespace !==
null ) {
316 $conds[] =
'page_namespace=' .
$dbr->addQuotes( $this->
namespace );
319 $commentQuery = $this->commentStore->getJoin(
'log_comment' );
320 $actorQuery = $this->actorMigration->getJoin(
'log_user' );
324 'page',
'page_restrictions',
'log_search',
325 'logparen' => [
'logging' ] + $commentQuery[
'tables'] + $actorQuery[
'tables'],
338 ] + $commentQuery[
'fields'] + $actorQuery[
'fields'],
343 'ls_field' =>
'pr_id',
'ls_value = ' .
$dbr->buildStringCast(
'pr_id' )
351 ] + $commentQuery[
'joins'] + $actorQuery[
'joins']
356 return parent::getTableClass() .
' mw-protectedpages';
getContext()
Get the base IContextSource object.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
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,...
This class handles the logic for the actor table migration and should always be used in lieu of direc...
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
getUser()
Stable to override.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static formatRevisionSize( $size)
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
static isDeleted( $row, $field)
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).