77 $this->mConds = $conds;
78 $this->type =
$type ?:
'edit';
80 $this->
namespace = $namespace;
82 $this->size = intval(
$size );
92 # Do a link batch query
93 $lb = $this->linkBatchFactory->newLinkBatch();
96 foreach ( $result as $row ) {
97 $lb->add( $row->page_namespace, $row->page_title );
98 if ( $row->actor_user !==
null ) {
99 $userids[] = $row->actor_user;
104 if ( count( $userids ) ) {
105 $this->userCache->doQuery( $userids, [], __METHOD__ );
106 foreach ( $userids as $userid ) {
107 $name = $this->userCache->getProp( $userid,
'name' );
108 if ( $name !==
false ) {
119 static $headers =
null;
121 if ( $headers == [] ) {
123 'log_timestamp' =>
'protectedpages-timestamp',
124 'pr_page' =>
'protectedpages-page',
125 'pr_expiry' =>
'protectedpages-expiry',
126 'actor_user' =>
'protectedpages-performer',
127 'pr_params' =>
'protectedpages-params',
128 'log_comment' =>
'protectedpages-reason',
130 foreach ( $headers as $key => $val ) {
131 $headers[$key] = $this->
msg( $val )->text();
150 case 'log_timestamp':
152 if ( $value ===
null ) {
153 $formatted = Html::rawElement(
155 [
'class' =>
'mw-protectedpages-unknown' ],
156 $this->
msg(
'protectedpages-unknown-timestamp' )->escaped()
159 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
165 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
167 $formatted = Html::element(
169 [
'class' =>
'mw-invalidtitle' ],
172 $row->page_namespace,
179 if ( $row->page_len !==
null ) {
181 ' ' . Html::rawElement(
183 [
'class' =>
'mw-protectedpages-length' ],
190 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
191 $value,
true,
'infinity', $this->
getUser() ) );
192 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
196 $this->
msg(
'protect_change' )->text(),
198 [
'action' =>
'unprotect' ]
200 $formatted .=
' ' . Html::rawElement(
202 [
'class' =>
'mw-protectedpages-actions' ],
203 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
210 if ( $row->log_timestamp ===
null ) {
211 $formatted = Html::rawElement(
213 [
'class' =>
'mw-protectedpages-unknown' ],
214 $this->
msg(
'protectedpages-unknown-performer' )->escaped()
217 $username = $row->actor_name;
218 if ( LogEventsList::userCanBitfield(
226 $formatted = $this->
msg(
'rev-deleted-user' )->escaped();
229 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
237 $params[] = $this->
msg(
'restriction-level-' . $row->pr_level )->escaped();
238 if ( $row->pr_cascade ) {
239 $params[] = $this->
msg(
'protect-summary-cascade' )->escaped();
241 $formatted = $this->
getLanguage()->commaList( $params );
246 if ( $row->log_timestamp ===
null ) {
247 $formatted = Html::rawElement(
249 [
'class' =>
'mw-protectedpages-unknown' ],
250 $this->
msg(
'protectedpages-unknown-reason' )->escaped()
253 if ( LogEventsList::userCanBitfield(
258 $value = $this->commentStore->getComment(
'log_comment', $row )->text;
261 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
264 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
279 $conds[] =
'pr_expiry > ' .
$dbr->addQuotes(
$dbr->timestamp() ) .
280 ' OR pr_expiry IS NULL';
281 $conds[] =
'page_id=pr_page';
282 $conds[] =
'pr_type=' .
$dbr->addQuotes( $this->type );
284 if ( $this->sizetype ==
'min' ) {
286 } elseif ( $this->sizetype ==
'max' ) {
290 if ( $this->indefonly ) {
291 $infinity =
$dbr->addQuotes(
$dbr->getInfinity() );
292 $conds[] =
"pr_expiry = $infinity OR pr_expiry IS NULL";
294 if ( $this->cascadeonly ) {
295 $conds[] =
'pr_cascade = 1';
297 if ( $this->noredirect ) {
298 $conds[] =
'page_is_redirect = 0';
301 if ( $this->level ) {
302 $conds[] =
'pr_level=' .
$dbr->addQuotes( $this->level );
304 if ( $this->
namespace !==
null ) {
305 $conds[] =
'page_namespace=' .
$dbr->addQuotes( $this->
namespace );
308 $commentQuery = $this->commentStore->getJoin(
'log_comment' );
312 'page',
'page_restrictions',
'log_search',
313 'logparen' => [
'logging',
'actor' ] + $commentQuery[
'tables'],
328 ] + $commentQuery[
'fields'],
333 'ls_field' =>
'pr_id',
'ls_value = ' .
$dbr->buildStringCast(
'pr_id' )
346 ] + $commentQuery[
'joins']
351 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 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 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...