100 parent::__construct( $context, $linkRenderer );
101 $this->groupPermissionsLookup = $groupPermissionsLookup;
102 $this->hookRunner =
new HookRunner( $hookContainer );
103 $this->linkBatchFactory = $linkBatchFactory;
104 $this->namespaceInfo = $namespaceInfo;
105 $this->changeTagsStore = $changeTagsStore;
106 $this->rowCommentFormatter = $rowCommentFormatter;
107 $this->contentHandlerFactory = $contentHandlerFactory;
113 $rcQuery = RecentChange::getQueryInfo();
116 $conds[
'rc_new'] = 1;
118 $username = $this->opts->getValue(
'username' );
119 $user = Title::makeTitleSafe(
NS_USER, $username );
121 $size = abs( intval( $this->opts->getValue(
'size' ) ) );
124 if ( $this->opts->getValue(
'size-mode' ) ===
'max' ) {
125 $conds[] = $db->expr(
'page_len',
'<=', $size );
127 $conds[] = $db->expr(
'page_len',
'>=', $size );
132 $conds[
'actor_name'] = $user->getText();
133 } elseif ( $this->canAnonymousUsersCreatePages() && $this->opts->getValue(
'hideliu' ) ) {
134 # If anons cannot make new pages, don't "exclude logged in users"!
135 $conds[
'actor_user'] =
null;
138 $conds = array_merge( $conds, $this->getNamespaceCond() );
140 # If this user cannot see patrolled edits or they are off, don't do dumb queries!
141 if ( $this->opts->getValue(
'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) {
142 $conds[
'rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
145 if ( $this->opts->getValue(
'hidebots' ) ) {
146 $conds[
'rc_bot'] = 0;
149 if ( $this->opts->getValue(
'hideredirs' ) ) {
150 $conds[
'page_is_redirect'] = 0;
154 $tables = array_merge( $rcQuery[
'tables'], [
'page' ] );
155 $fields = array_merge( $rcQuery[
'fields'], [
156 'length' =>
'page_len',
'rev_id' =>
'page_latest',
'page_namespace',
'page_title',
157 'page_content_model',
159 $join_conds = [
'page' => [
'JOIN',
'page_id=rc_cur_id' ] ] + $rcQuery[
'joins'];
161 $this->hookRunner->onSpecialNewpagesConditions(
162 $this, $this->opts, $conds, $tables, $fields, $join_conds );
169 'join_conds' => $join_conds
173 $this->changeTagsStore->modifyDisplayQuery(
179 $this->opts[
'tagfilter'],
180 $this->opts[
'tagInvert']
222 $title = Title::newFromRow( $row );
229 $attribs = [
'data-mw-revid' => $row->rc_this_oldid ];
232 $dm = $lang->getDirMark();
233 $time = ChangesList::revDateLink( $revRecord, $this->
getUser(), $lang,
null,
'mw-newpages-time' );
237 $query = $title->
isRedirect() ? [
'redirect' =>
'no' ] : [];
239 $plink = $linkRenderer->makeKnownLink(
242 [
'class' =>
'mw-newpages-pagename' ],
246 $linkArr[] = $linkRenderer->makeKnownLink(
248 $this->
msg(
'hist' )->text(),
249 [
'class' =>
'mw-newpages-history' ],
250 [
'action' =>
'history' ]
252 if ( $this->contentHandlerFactory->getContentHandler( $title->
getContentModel() )
253 ->supportsDirectEditing()
255 $linkArr[] = $linkRenderer->makeKnownLink(
257 $this->
msg(
'editlink' )->text(),
258 [
'class' =>
'mw-newpages-edit' ],
259 [
'action' =>
'edit' ]
262 $links = $this->
msg(
'parentheses' )->rawParams( $this->
getLanguage()
263 ->pipeList( $linkArr ) )->escaped();
265 $length = Html::rawElement(
267 [
'class' =>
'mw-newpages-length' ],
268 $this->
msg(
'brackets' )->rawParams(
269 $this->
msg(
'nbytes' )->numParams( $row->length )->escaped()
273 $ulink = Linker::revUserTools( $revRecord );
274 $rc = RecentChange::newFromRow( $row );
275 if ( ChangesList::userCan( $rc, RevisionRecord::DELETED_COMMENT, $this->
getAuthority() ) ) {
276 $comment = $this->formattedComments[$rc->mAttribs[
'rc_id']];
278 $comment =
'<span class="comment">' . $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span>';
280 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
281 $deletedClass =
'history-deleted';
282 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_RESTRICTED ) ) {
283 $deletedClass .=
' mw-history-suppressed';
285 $comment =
'<span class="' . $deletedClass .
' comment">' . $comment .
'</span>';
288 if ( $this->
getUser()->useNPPatrol() && !$row->rc_patrolled ) {
289 $classes[] =
'not-patrolled';
292 # Add a class for zero byte pages
293 if ( $row->length == 0 ) {
294 $classes[] =
'mw-newpages-zero-byte-page';
298 if ( isset( $row->ts_tags ) ) {
299 [ $tagDisplay, $newClasses ] = $this->tagsCache->getWithSetCallback(
300 $this->tagsCache->makeKey(
302 $this->getUser()->getName(),
311 $classes = array_merge( $classes, $newClasses );
316 # Display the old title if the namespace/title has been changed
318 $oldTitle = Title::makeTitle( $row->rc_namespace, $row->rc_title );
320 if ( !$title->
equals( $oldTitle ) ) {
321 $oldTitleText = $oldTitle->getPrefixedText();
322 $oldTitleText = Html::rawElement(
324 [
'class' =>
'mw-newpages-oldtitle' ],
325 $this->
msg(
'rc-old-title' )->params( $oldTitleText )->escaped()
329 $ret =
"{$time} {$dm}{$plink} {$links} {$dm}{$length} {$dm}{$ulink} {$comment} "
330 .
"{$tagDisplay} {$oldTitleText}";
333 $this->hookRunner->onNewPagesLineEnding(
334 $this, $ret, $row, $classes, $attribs );
335 $attribs = array_filter( $attribs,
336 [ Sanitizer::class,
'isReservedDataAttribute' ],
341 $attribs[
'class'] = $classes;
344 return Html::rawElement(
'li', $attribs, $ret ) .
"\n";