95 parent::__construct( $context, $linkRenderer );
96 $this->commentStore = $commentStore;
97 $this->linkBatchFactory = $linkBatchFactory;
98 $this->rowCommentFormatter = $rowCommentFormatter;
99 $this->mConds = $conds;
100 $this->type = $type ?:
'edit';
101 $this->level = $level;
102 $this->
namespace = $namespace;
103 $this->sizetype = $sizetype;
104 $this->size = intval( $size );
105 $this->indefonly = (bool)$indefonly;
106 $this->cascadeonly = (bool)$cascadeonly;
107 $this->noredirect = (bool)$noredirect;
111 # Do a link batch query
112 $lb = $this->linkBatchFactory->newLinkBatch();
113 $rowsWithComments = [];
115 foreach ( $result as $row ) {
116 $lb->add( $row->page_namespace, $row->page_title );
118 if ( $row->actor_name !==
null ) {
119 $lb->add(
NS_USER, $row->actor_name );
122 if ( $row->log_timestamp !==
null ) {
123 $rowsWithComments[] = $row;
130 $this->formattedComments = $this->rowCommentFormatter->formatRows(
170 case 'log_timestamp':
172 if ( $value ===
null ) {
173 $formatted = Html::rawElement(
175 [
'class' =>
'mw-protectedpages-unknown' ],
176 $this->
msg(
'protectedpages-unknown-timestamp' )->escaped()
179 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
185 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
189 [
'class' =>
'mw-invalidtitle' ],
190 Linker::getInvalidTitleDescription(
192 $row->page_namespace,
197 $formatted = $linkRenderer->makeLink( $title );
199 if ( $row->page_len !==
null ) {
201 ' ' . Html::rawElement(
203 [
'class' =>
'mw-protectedpages-length' ],
204 Linker::formatRevisionSize( $row->page_len )
210 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
211 $value,
true,
'infinity', $this->
getUser() ) );
212 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
213 if ( $title && $this->
getAuthority()->isAllowed(
'protect' ) ) {
214 $changeProtection = $linkRenderer->makeKnownLink(
216 $this->
msg(
'protect_change' )->text(),
218 [
'action' =>
'unprotect' ]
220 $formatted .=
' ' . Html::rawElement(
222 [
'class' =>
'mw-protectedpages-actions' ],
223 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
230 if ( $row->log_timestamp ===
null ) {
231 $formatted = Html::rawElement(
233 [
'class' =>
'mw-protectedpages-unknown' ],
234 $this->
msg(
'protectedpages-unknown-performer' )->escaped()
237 $username = $row->actor_name;
238 if ( LogEventsList::userCanBitfield(
240 LogPage::DELETED_USER,
241 $this->getAuthority()
243 $formatted = Linker::userLink( (
int)$value, $username )
244 . Linker::userToolLinks( (
int)$value, $username );
246 $formatted = $this->
msg(
'rev-deleted-user' )->escaped();
248 if ( LogEventsList::isDeleted( $row, LogPage::DELETED_USER ) ) {
249 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
257 $params[] = $this->
msg(
'restriction-level-' . $row->pr_level )->escaped();
258 if ( $row->pr_cascade ) {
259 $params[] = $this->
msg(
'protect-summary-cascade' )->escaped();
266 if ( $row->log_timestamp ===
null ) {
267 $formatted = Html::rawElement(
269 [
'class' =>
'mw-protectedpages-unknown' ],
270 $this->
msg(
'protectedpages-unknown-reason' )->escaped()
273 if ( LogEventsList::userCanBitfield(
275 LogPage::DELETED_COMMENT,
276 $this->getAuthority()
278 $formatted = $this->formattedComments[$row->pr_id];
280 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
282 if ( LogEventsList::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
283 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
289 throw new UnexpectedValueException(
"Unknown field '$field'" );