30 private $type, $level, $namespace, $sizetype, $size, $indefonly, $cascadeonly, $noredirect;
85 parent::__construct( $context, $linkRenderer );
86 $this->commentStore = $commentStore;
87 $this->linkBatchFactory = $linkBatchFactory;
88 $this->rowCommentFormatter = $rowCommentFormatter;
89 $this->userCache = $userCache;
90 $this->mConds = $conds;
91 $this->type = $type ?:
'edit';
92 $this->level = $level;
93 $this->
namespace = $namespace;
94 $this->sizetype = $sizetype;
95 $this->size = intval( $size );
96 $this->indefonly = (bool)$indefonly;
97 $this->cascadeonly = (bool)$cascadeonly;
98 $this->noredirect = (bool)$noredirect;
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' );
163 case 'log_timestamp':
165 if ( $value ===
null ) {
166 $formatted = Html::rawElement(
168 [
'class' =>
'mw-protectedpages-unknown' ],
169 $this->
msg(
'protectedpages-unknown-timestamp' )->escaped()
172 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
178 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
180 $formatted = Html::element(
182 [
'class' =>
'mw-invalidtitle' ],
185 $row->page_namespace,
190 $formatted = $linkRenderer->makeLink(
$title );
192 if ( $row->page_len !==
null ) {
194 ' ' . Html::rawElement(
196 [
'class' =>
'mw-protectedpages-length' ],
203 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
204 $value,
true,
'infinity', $this->
getUser() ) );
205 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
207 $changeProtection = $linkRenderer->makeKnownLink(
209 $this->
msg(
'protect_change' )->text(),
211 [
'action' =>
'unprotect' ]
213 $formatted .=
' ' . Html::rawElement(
215 [
'class' =>
'mw-protectedpages-actions' ],
216 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
223 if ( $row->log_timestamp ===
null ) {
224 $formatted = Html::rawElement(
226 [
'class' =>
'mw-protectedpages-unknown' ],
227 $this->
msg(
'protectedpages-unknown-performer' )->escaped()
230 $username = $row->actor_name;
231 if ( LogEventsList::userCanBitfield(
234 $this->getAuthority()
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 ) {
260 $formatted = Html::rawElement(
262 [
'class' =>
'mw-protectedpages-unknown' ],
263 $this->
msg(
'protectedpages-unknown-reason' )->escaped()
266 if ( LogEventsList::userCanBitfield(
269 $this->getAuthority()
273 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
276 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';