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' ) ) );
123 if ( $this->opts->getValue(
'size-mode' ) ===
'max' ) {
124 $conds[] =
'page_len <= ' . $size;
126 $conds[] =
'page_len >= ' . $size;
131 $conds[
'actor_name'] = $user->getText();
132 } elseif ( $this->canAnonymousUsersCreatePages() && $this->opts->getValue(
'hideliu' ) ) {
133 # If anons cannot make new pages, don't "exclude logged in users"!
134 $conds[
'actor_user'] =
null;
137 $conds = array_merge( $conds, $this->getNamespaceCond() );
139 # If this user cannot see patrolled edits or they are off, don't do dumb queries!
140 if ( $this->opts->getValue(
'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) {
141 $conds[
'rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
144 if ( $this->opts->getValue(
'hidebots' ) ) {
145 $conds[
'rc_bot'] = 0;
148 if ( $this->opts->getValue(
'hideredirs' ) ) {
149 $conds[
'page_is_redirect'] = 0;
153 $tables = array_merge( $rcQuery[
'tables'], [
'page' ] );
154 $fields = array_merge( $rcQuery[
'fields'], [
155 'length' =>
'page_len',
'rev_id' =>
'page_latest',
'page_namespace',
'page_title',
156 'page_content_model',
158 $join_conds = [
'page' => [
'JOIN',
'page_id=rc_cur_id' ] ] + $rcQuery[
'joins'];
160 $this->hookRunner->onSpecialNewpagesConditions(
161 $this, $this->opts, $conds, $tables, $fields, $join_conds );
168 'join_conds' => $join_conds
172 $this->changeTagsStore->modifyDisplayQuery(
178 $this->opts[
'tagfilter'],
179 $this->opts[
'tagInvert']
230 $title = Title::newFromRow( $row );
237 $attribs = [
'data-mw-revid' => $row->rev_id ];
240 $dm = $lang->getDirMark();
241 $time = ChangesList::revDateLink( $revRecord, $this->
getUser(), $lang,
null,
'mw-newpages-time' );
245 $query = $title->
isRedirect() ? [
'redirect' =>
'no' ] : [];
247 $plink = $linkRenderer->makeKnownLink(
250 [
'class' =>
'mw-newpages-pagename' ],
254 $linkArr[] = $linkRenderer->makeKnownLink(
256 $this->
msg(
'hist' )->text(),
257 [
'class' =>
'mw-newpages-history' ],
258 [
'action' =>
'history' ]
260 if ( $this->contentHandlerFactory->getContentHandler( $title->
getContentModel() )
261 ->supportsDirectEditing()
263 $linkArr[] = $linkRenderer->makeKnownLink(
265 $this->
msg(
'editlink' )->text(),
266 [
'class' =>
'mw-newpages-edit' ],
267 [
'action' =>
'edit' ]
270 $links = $this->
msg(
'parentheses' )->rawParams( $this->
getLanguage()
271 ->pipeList( $linkArr ) )->escaped();
273 $length = Html::rawElement(
275 [
'class' =>
'mw-newpages-length' ],
276 $this->
msg(
'brackets' )->rawParams(
277 $this->
msg(
'nbytes' )->numParams( $row->length )->escaped()
281 $ulink = Linker::revUserTools( $revRecord );
282 $rc = RecentChange::newFromRow( $row );
283 if ( ChangesList::userCan( $rc, RevisionRecord::DELETED_COMMENT, $this->
getAuthority() ) ) {
284 $comment = $this->formattedComments[$rc->mAttribs[
'rc_id']];
286 $comment =
'<span class="comment">' . $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span>';
288 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
289 $deletedClass =
'history-deleted';
290 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_RESTRICTED ) ) {
291 $deletedClass .=
' mw-history-suppressed';
293 $comment =
'<span class="' . $deletedClass .
' comment">' . $comment .
'</span>';
296 if ( $this->
getUser()->useNPPatrol() && !$row->rc_patrolled ) {
297 $classes[] =
'not-patrolled';
300 # Add a class for zero byte pages
301 if ( $row->length == 0 ) {
302 $classes[] =
'mw-newpages-zero-byte-page';
306 if ( isset( $row->ts_tags ) ) {
307 [ $tagDisplay, $newClasses ] = $this->tagsCache->getWithSetCallback(
308 $this->tagsCache->makeKey(
310 $this->getUser()->getName(),
319 $classes = array_merge( $classes, $newClasses );
324 # Display the old title if the namespace/title has been changed
326 $oldTitle = Title::makeTitle( $row->rc_namespace, $row->rc_title );
328 if ( !$title->
equals( $oldTitle ) ) {
329 $oldTitleText = $oldTitle->getPrefixedText();
330 $oldTitleText = Html::rawElement(
332 [
'class' =>
'mw-newpages-oldtitle' ],
333 $this->
msg(
'rc-old-title' )->params( $oldTitleText )->escaped()
337 $ret =
"{$time} {$dm}{$plink} {$links} {$dm}{$length} {$dm}{$ulink} {$comment} "
338 .
"{$tagDisplay} {$oldTitleText}";
341 $this->hookRunner->onNewPagesLineEnding(
342 $this, $ret, $row, $classes, $attribs );
343 $attribs = array_filter( $attribs,
344 [ Sanitizer::class,
'isReservedDataAttribute' ],
349 $attribs[
'class'] = $classes;
352 return Html::rawElement(
'li', $attribs, $ret ) .
"\n";