106 parent::__construct( $context, $linkRenderer );
107 $this->groupPermissionsLookup = $groupPermissionsLookup;
108 $this->hookRunner =
new HookRunner( $hookContainer );
109 $this->linkBatchFactory = $linkBatchFactory;
110 $this->namespaceInfo = $namespaceInfo;
111 $this->changeTagsStore = $changeTagsStore;
112 $this->rowCommentFormatter = $rowCommentFormatter;
113 $this->contentHandlerFactory = $contentHandlerFactory;
114 $this->tempUserConfig = $tempUserConfig;
120 $rcQuery = RecentChange::getQueryInfo();
123 $conds[
'rc_new'] = 1;
125 $username = $this->opts->getValue(
'username' );
126 $user = Title::makeTitleSafe(
NS_USER, $username );
128 $size = abs( intval( $this->opts->getValue(
'size' ) ) );
131 if ( $this->opts->getValue(
'size-mode' ) ===
'max' ) {
132 $conds[] = $db->expr(
'page_len',
'<=', $size );
134 $conds[] = $db->expr(
'page_len',
'>=', $size );
139 $conds[
'actor_name'] = $user->getText();
140 } elseif ( $this->opts->getValue(
'hideliu' ) ) {
142 $anonOnlyExpr = $this->
getDatabase()->expr(
'actor_user',
'=',
null );
143 if ( $this->tempUserConfig->isKnown() ) {
144 $anonOnlyExpr = $anonOnlyExpr->orExpr( $this->tempUserConfig->getMatchCondition(
145 $this->getDatabase(),
'actor_name', IExpression::LIKE
148 $conds[] = $anonOnlyExpr;
151 $conds = array_merge( $conds, $this->getNamespaceCond() );
153 # If this user cannot see patrolled edits or they are off, don't do dumb queries!
154 if ( $this->opts->getValue(
'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) {
155 $conds[
'rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
158 if ( $this->opts->getValue(
'hidebots' ) ) {
159 $conds[
'rc_bot'] = 0;
162 if ( $this->opts->getValue(
'hideredirs' ) ) {
163 $conds[
'page_is_redirect'] = 0;
167 $tables = array_merge( $rcQuery[
'tables'], [
'page' ] );
168 $fields = array_merge( $rcQuery[
'fields'], [
169 'length' =>
'page_len',
'rev_id' =>
'page_latest',
'page_namespace',
'page_title',
170 'page_content_model',
172 $join_conds = [
'page' => [
'JOIN',
'page_id=rc_cur_id' ] ] + $rcQuery[
'joins'];
174 $this->hookRunner->onSpecialNewpagesConditions(
175 $this, $this->opts, $conds, $tables, $fields, $join_conds );
182 'join_conds' => $join_conds
186 $this->changeTagsStore->modifyDisplayQuery(
192 $this->opts[
'tagfilter'],
193 $this->opts[
'tagInvert']
230 $title = Title::newFromRow( $row );
237 $attribs = [
'data-mw-revid' => $row->rc_this_oldid ];
240 $time = ChangesList::revDateLink( $revRecord, $this->
getUser(), $lang,
null,
'mw-newpages-time' );
244 $query = $title->
isRedirect() ? [
'redirect' =>
'no' ] : [];
246 $plink = Html::rawElement(
'bdi', [
'dir' => $lang->getDir() ], $linkRenderer->makeKnownLink(
249 [
'class' =>
'mw-newpages-pagename' ],
253 $linkArr[] = $linkRenderer->makeKnownLink(
255 $this->
msg(
'hist' )->text(),
256 [
'class' =>
'mw-newpages-history' ],
257 [
'action' =>
'history' ]
259 if ( $this->contentHandlerFactory->getContentHandler( $title->
getContentModel() )
260 ->supportsDirectEditing()
262 $linkArr[] = $linkRenderer->makeKnownLink(
264 $this->
msg(
'editlink' )->text(),
265 [
'class' =>
'mw-newpages-edit' ],
266 [
'action' =>
'edit' ]
269 $links = $this->
msg(
'parentheses' )->rawParams( $this->
getLanguage()
270 ->pipeList( $linkArr ) )->escaped();
272 $length = Html::rawElement(
274 [
'class' =>
'mw-newpages-length' ],
275 $this->
msg(
'brackets' )->rawParams(
276 $this->
msg(
'nbytes' )->numParams( $row->length )->escaped()
280 $ulink = Linker::revUserTools( $revRecord );
281 $rc = RecentChange::newFromRow( $row );
282 if ( ChangesList::userCan( $rc, RevisionRecord::DELETED_COMMENT, $this->
getAuthority() ) ) {
283 $comment = $this->formattedComments[$rc->mAttribs[
'rc_id']];
285 $comment =
'<span class="comment">' . $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span>';
287 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
288 $deletedClass =
'history-deleted';
289 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_RESTRICTED ) ) {
290 $deletedClass .=
' mw-history-suppressed';
292 $comment =
'<span class="' . $deletedClass .
' comment">' . $comment .
'</span>';
295 if ( $this->
getUser()->useNPPatrol() && !$row->rc_patrolled ) {
296 $classes[] =
'not-patrolled';
299 # Add a class for zero byte pages
300 if ( $row->length == 0 ) {
301 $classes[] =
'mw-newpages-zero-byte-page';
305 if ( isset( $row->ts_tags ) ) {
306 [ $tagDisplay, $newClasses ] = $this->tagsCache->getWithSetCallback(
307 $this->tagsCache->makeKey(
309 $this->getUser()->getName(),
318 $classes = array_merge( $classes, $newClasses );
323 # Display the old title if the namespace/title has been changed
325 $oldTitle = Title::makeTitle( $row->rc_namespace, $row->rc_title );
327 if ( !$title->
equals( $oldTitle ) ) {
328 $oldTitleText = $oldTitle->getPrefixedText();
329 $oldTitleText = Html::rawElement(
331 [
'class' =>
'mw-newpages-oldtitle' ],
332 $this->
msg(
'rc-old-title' )->params( $oldTitleText )->escaped()
336 $ret =
"{$time} {$plink} {$links} {$length} {$ulink} {$comment} "
337 .
"{$tagDisplay} {$oldTitleText}";
340 $this->hookRunner->onNewPagesLineEnding(
341 $this, $ret, $row, $classes, $attribs );
342 $attribs = array_filter( $attribs,
343 [ Sanitizer::class,
'isReservedDataAttribute' ],
348 $attribs[
'class'] = $classes;
351 return Html::rawElement(
'li', $attribs, $ret ) .
"\n";