48 $this->mConds = $conds;
49 $this->type =
$type ?:
'edit';
51 $this->
namespace = $namespace;
53 $this->size = intval(
$size );
60 # Do a link batch query
64 foreach ( $result as $row ) {
65 $lb->
add( $row->page_namespace, $row->page_title );
67 if ( $row->log_user !==
null ) {
68 $userids[] = $row->log_user;
73 if ( count( $userids ) ) {
75 $userCache->doQuery( $userids, [], __METHOD__ );
76 foreach ( $userids as $userid ) {
77 $name = $userCache->getProp( $userid,
'name' );
78 if ( $name !==
false ) {
89 static $headers =
null;
91 if ( $headers == [] ) {
93 'log_timestamp' =>
'protectedpages-timestamp',
94 'pr_page' =>
'protectedpages-page',
95 'pr_expiry' =>
'protectedpages-expiry',
96 'log_user' =>
'protectedpages-performer',
97 'pr_params' =>
'protectedpages-params',
98 'log_comment' =>
'protectedpages-reason',
100 foreach ( $headers as $key => $val ) {
101 $headers[$key] = $this->
msg( $val )->text();
120 case 'log_timestamp':
122 if ( $value ===
null ) {
123 $formatted = Html::rawElement(
125 [
'class' =>
'mw-protectedpages-unknown' ],
126 $this->
msg(
'protectedpages-unknown-timestamp' )->escaped()
129 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
135 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
137 $formatted = Html::element(
139 [
'class' =>
'mw-invalidtitle' ],
142 $row->page_namespace,
149 if ( !is_null( $row->page_len ) ) {
151 ' ' . Html::rawElement(
153 [
'class' =>
'mw-protectedpages-length' ],
160 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
162 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
163 if (
$title && MediaWikiServices::getInstance()
165 ->userHasRight( $this->
getUser(),
'protect' )
169 $this->
msg(
'protect_change' )->text(),
171 [
'action' =>
'unprotect' ]
173 $formatted .=
' ' . Html::rawElement(
175 [
'class' =>
'mw-protectedpages-actions' ],
176 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
183 if ( $row->log_timestamp ===
null ) {
184 $formatted = Html::rawElement(
186 [
'class' =>
'mw-protectedpages-unknown' ],
187 $this->
msg(
'protectedpages-unknown-performer' )->escaped()
196 if ( $username ===
false ) {
197 $formatted = htmlspecialchars( $value );
203 $formatted = $this->
msg(
'rev-deleted-user' )->escaped();
206 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
214 $params[] = $this->
msg(
'restriction-level-' . $row->pr_level )->escaped();
215 if ( $row->pr_cascade ) {
216 $params[] = $this->
msg(
'protect-summary-cascade' )->escaped();
218 $formatted = $this->
getLanguage()->commaList( $params );
223 if ( $row->log_timestamp ===
null ) {
224 $formatted = Html::rawElement(
226 [
'class' =>
'mw-protectedpages-unknown' ],
227 $this->
msg(
'protectedpages-unknown-reason' )->escaped()
235 $value = CommentStore::getStore()->getComment(
'log_comment', $row )->text;
238 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
241 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
255 $conds[] =
'pr_expiry > ' . $this->mDb->addQuotes( $this->mDb->timestamp() ) .
256 ' OR pr_expiry IS NULL';
257 $conds[] =
'page_id=pr_page';
258 $conds[] =
'pr_type=' . $this->mDb->addQuotes( $this->type );
260 if ( $this->sizetype ==
'min' ) {
262 } elseif ( $this->sizetype ==
'max' ) {
266 if ( $this->indefonly ) {
267 $infinity = $this->mDb->addQuotes( $this->mDb->getInfinity() );
268 $conds[] =
"pr_expiry = $infinity OR pr_expiry IS NULL";
270 if ( $this->cascadeonly ) {
271 $conds[] =
'pr_cascade = 1';
273 if ( $this->noredirect ) {
274 $conds[] =
'page_is_redirect = 0';
277 if ( $this->level ) {
278 $conds[] =
'pr_level=' . $this->mDb->addQuotes( $this->level );
280 if ( !is_null( $this->
namespace ) ) {
281 $conds[] =
'page_namespace=' . $this->mDb->addQuotes( $this->
namespace );
284 $commentQuery = CommentStore::getStore()->getJoin(
'log_comment' );
285 $actorQuery = ActorMigration::newMigration()->getJoin(
'log_user' );
289 'page',
'page_restrictions',
'log_search',
290 'logparen' => [
'logging' ] + $commentQuery[
'tables'] + $actorQuery[
'tables'],
303 ] + $commentQuery[
'fields'] + $actorQuery[
'fields'],
308 'ls_field' =>
'pr_id',
'ls_value = ' . $this->mDb->buildStringCast(
'pr_id' )
316 ] + $commentQuery[
'joins'] + $actorQuery[
'joins']
321 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.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
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...
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
static isDeleted( $row, $field)