59 # Do a link batch query
60 $lb = $this->linkBatchFactory->newLinkBatch();
61 $rowsWithComments = [];
63 foreach ( $result as $row ) {
64 $lb->add( $row->page_namespace, $row->page_title );
66 if ( $row->actor_name !==
null ) {
69 if ( $row->log_timestamp !==
null ) {
70 $rowsWithComments[] = $row;
77 $this->formattedComments = $this->rowCommentFormatter->formatRows(
118 case 'log_timestamp':
120 if ( $value ===
null ) {
122 [
'class' =>
'mw-protectedpages-unknown' ],
123 $this->
msg(
'protectedpages-unknown-timestamp' )->text()
126 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
132 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
136 [
'class' =>
'mw-invalidtitle' ],
137 Linker::getInvalidTitleDescription(
139 $row->page_namespace,
144 $formatted = $linkRenderer->makeLink( $title );
146 $formatted = Html::rawElement(
'bdi', [
149 if ( $row->page_len !==
null ) {
150 $formatted .=
' ' . Html::rawElement(
152 [
'class' =>
'mw-protectedpages-length' ],
153 Linker::formatRevisionSize( $row->page_len )
159 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
160 $value,
true,
'infinity', $this->
getUser() ) );
161 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
162 if ( $title && $this->
getAuthority()->isAllowed(
'protect' ) ) {
163 $changeProtection = $linkRenderer->makeKnownLink(
165 $this->
msg(
'protect_change' )->text(),
167 [
'action' =>
'unprotect' ]
169 $formatted .=
' ' . Html::rawElement(
171 [
'class' =>
'mw-protectedpages-actions' ],
172 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
179 if ( $row->log_timestamp ===
null ) {
181 [
'class' =>
'mw-protectedpages-unknown' ],
182 $this->
msg(
'protectedpages-unknown-performer' )->text()
185 $username = $row->actor_name;
186 if ( LogEventsList::userCanBitfield(
188 LogPage::DELETED_USER,
189 $this->getAuthority()
191 $formatted = Linker::userLink( (
int)$value, $username )
192 . Linker::userToolLinks( (
int)$value, $username );
194 $formatted = $this->
msg(
'rev-deleted-user' )->escaped();
196 if ( LogEventsList::isDeleted( $row, LogPage::DELETED_USER ) ) {
197 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
205 $params[] = $this->
msg(
'restriction-level-' . $row->pr_level )->escaped();
206 if ( $row->pr_cascade ) {
207 $params[] = $this->
msg(
'protect-summary-cascade' )->escaped();
209 $formatted = $this->
getLanguage()->commaList( $params );
214 if ( $row->log_timestamp ===
null ) {
216 [
'class' =>
'mw-protectedpages-unknown' ],
217 $this->
msg(
'protectedpages-unknown-reason' )->text()
220 if ( LogEventsList::userCanBitfield(
222 LogPage::DELETED_COMMENT,
223 $this->getAuthority()
225 $formatted = $this->formattedComments[$row->pr_id];
227 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
229 if ( LogEventsList::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
230 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
236 throw new UnexpectedValueException(
"Unknown field '$field'" );