99 parent::__construct( $context, $linkRenderer );
100 $this->commentStore = $commentStore;
101 $this->linkBatchFactory = $linkBatchFactory;
102 $this->rowCommentFormatter = $rowCommentFormatter;
103 $this->userCache = $userCache;
104 $this->mConds = $conds;
105 $this->type = $type ?:
'edit';
106 $this->level = $level;
107 $this->
namespace = $namespace;
108 $this->sizetype = $sizetype;
109 $this->size = intval( $size );
110 $this->indefonly = (bool)$indefonly;
111 $this->cascadeonly = (bool)$cascadeonly;
112 $this->noredirect = (bool)$noredirect;
116 # Do a link batch query
117 $lb = $this->linkBatchFactory->newLinkBatch();
119 $rowsWithComments = [];
121 foreach ( $result as $row ) {
122 $lb->add( $row->page_namespace, $row->page_title );
123 if ( $row->actor_user !==
null ) {
124 $userids[] = $row->actor_user;
126 if ( $row->log_timestamp !==
null ) {
127 $rowsWithComments[] = $row;
132 if ( count( $userids ) ) {
133 $this->userCache->doQuery( $userids, [], __METHOD__ );
134 foreach ( $userids as $userid ) {
135 $name = $this->userCache->getProp( $userid,
'name' );
136 if ( $name !==
false ) {
146 $this->formattedComments = $this->rowCommentFormatter->formatRows(
186 case 'log_timestamp':
188 if ( $value ===
null ) {
189 $formatted = Html::rawElement(
191 [
'class' =>
'mw-protectedpages-unknown' ],
192 $this->
msg(
'protectedpages-unknown-timestamp' )->escaped()
195 $formatted = htmlspecialchars( $this->
getLanguage()->userTimeAndDate(
201 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
205 [
'class' =>
'mw-invalidtitle' ],
206 Linker::getInvalidTitleDescription(
208 $row->page_namespace,
213 $formatted = $linkRenderer->makeLink( $title );
215 if ( $row->page_len !==
null ) {
217 ' ' . Html::rawElement(
219 [
'class' =>
'mw-protectedpages-length' ],
220 Linker::formatRevisionSize( $row->page_len )
226 $formatted = htmlspecialchars( $this->
getLanguage()->formatExpiry(
227 $value,
true,
'infinity', $this->
getUser() ) );
228 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
229 if ( $title && $this->
getAuthority()->isAllowed(
'protect' ) ) {
230 $changeProtection = $linkRenderer->makeKnownLink(
232 $this->
msg(
'protect_change' )->text(),
234 [
'action' =>
'unprotect' ]
236 $formatted .=
' ' . Html::rawElement(
238 [
'class' =>
'mw-protectedpages-actions' ],
239 $this->
msg(
'parentheses' )->rawParams( $changeProtection )->escaped()
246 if ( $row->log_timestamp ===
null ) {
247 $formatted = Html::rawElement(
249 [
'class' =>
'mw-protectedpages-unknown' ],
250 $this->
msg(
'protectedpages-unknown-performer' )->escaped()
253 $username = $row->actor_name;
254 if ( LogEventsList::userCanBitfield(
256 LogPage::DELETED_USER,
257 $this->getAuthority()
259 $formatted = Linker::userLink( (
int)$value, $username )
260 . Linker::userToolLinks( (
int)$value, $username );
262 $formatted = $this->
msg(
'rev-deleted-user' )->escaped();
264 if ( LogEventsList::isDeleted( $row, LogPage::DELETED_USER ) ) {
265 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
273 $params[] = $this->
msg(
'restriction-level-' . $row->pr_level )->escaped();
274 if ( $row->pr_cascade ) {
275 $params[] = $this->
msg(
'protect-summary-cascade' )->escaped();
282 if ( $row->log_timestamp ===
null ) {
283 $formatted = Html::rawElement(
285 [
'class' =>
'mw-protectedpages-unknown' ],
286 $this->
msg(
'protectedpages-unknown-reason' )->escaped()
289 if ( LogEventsList::userCanBitfield(
291 LogPage::DELETED_COMMENT,
292 $this->getAuthority()
294 $formatted = $this->formattedComments[$row->pr_id];
296 $formatted = $this->
msg(
'rev-deleted-comment' )->escaped();
298 if ( LogEventsList::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
299 $formatted =
'<span class="history-deleted">' . $formatted .
'</span>';
305 throw new UnexpectedValueException(
"Unknown field '$field'" );