94 parent::__construct( $context, $linkRenderer );
95 $this->groupPermissionsLookup = $groupPermissionsLookup;
96 $this->hookRunner =
new HookRunner( $hookContainer );
97 $this->linkBatchFactory = $linkBatchFactory;
98 $this->namespaceInfo = $namespaceInfo;
99 $this->changeTagsStore = $changeTagsStore;
100 $this->rowCommentFormatter = $rowCommentFormatter;
101 $this->contentHandlerFactory = $contentHandlerFactory;
106 $rcQuery = RecentChange::getQueryInfo();
109 $conds[
'rc_new'] = 1;
111 $username = $this->opts->getValue(
'username' );
112 $user = Title::makeTitleSafe(
NS_USER, $username );
114 $size = abs( intval( $this->opts->getValue(
'size' ) ) );
116 if ( $this->opts->getValue(
'size-mode' ) ===
'max' ) {
117 $conds[] =
'page_len <= ' . $size;
119 $conds[] =
'page_len >= ' . $size;
124 $conds[
'actor_name'] = $user->getText();
125 } elseif ( $this->canAnonymousUsersCreatePages() && $this->opts->getValue(
'hideliu' ) ) {
126 # If anons cannot make new pages, don't "exclude logged in users"!
127 $conds[
'actor_user'] =
null;
130 $conds = array_merge( $conds, $this->getNamespaceCond() );
132 # If this user cannot see patrolled edits or they are off, don't do dumb queries!
133 if ( $this->opts->getValue(
'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) {
134 $conds[
'rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
137 if ( $this->opts->getValue(
'hidebots' ) ) {
138 $conds[
'rc_bot'] = 0;
141 if ( $this->opts->getValue(
'hideredirs' ) ) {
142 $conds[
'page_is_redirect'] = 0;
146 $tables = array_merge( $rcQuery[
'tables'], [
'page' ] );
147 $fields = array_merge( $rcQuery[
'fields'], [
148 'length' =>
'page_len',
'rev_id' =>
'page_latest',
'page_namespace',
'page_title',
149 'page_content_model',
151 $join_conds = [
'page' => [
'JOIN',
'page_id=rc_cur_id' ] ] + $rcQuery[
'joins'];
153 $this->hookRunner->onSpecialNewpagesConditions(
154 $this, $this->opts, $conds, $tables, $fields, $join_conds );
161 'join_conds' => $join_conds
165 $this->changeTagsStore->modifyDisplayQuery(
171 $this->opts[
'tagfilter'],
172 $this->opts[
'tagInvert']
223 $title = Title::newFromRow( $row );
230 $attribs = [
'data-mw-revid' => $row->rev_id ];
233 $dm = $lang->getDirMark();
235 $spanTime = Html::element(
'span', [
'class' =>
'mw-newpages-time' ],
236 $lang->userTimeAndDate( $row->rc_timestamp, $this->getUser() )
239 $time = $linkRenderer->makeKnownLink(
243 [
'oldid' => $row->rc_this_oldid ]
246 $query = $title->
isRedirect() ? [
'redirect' =>
'no' ] : [];
248 $plink = $linkRenderer->makeKnownLink(
251 [
'class' =>
'mw-newpages-pagename' ],
255 $linkArr[] = $linkRenderer->makeKnownLink(
257 $this->
msg(
'hist' )->text(),
258 [
'class' =>
'mw-newpages-history' ],
259 [
'action' =>
'history' ]
261 if ( $this->contentHandlerFactory->getContentHandler( $title->
getContentModel() )
262 ->supportsDirectEditing()
264 $linkArr[] = $linkRenderer->makeKnownLink(
266 $this->
msg(
'editlink' )->text(),
267 [
'class' =>
'mw-newpages-edit' ],
268 [
'action' =>
'edit' ]
271 $links = $this->
msg(
'parentheses' )->rawParams( $this->
getLanguage()
272 ->pipeList( $linkArr ) )->escaped();
274 $length = Html::rawElement(
276 [
'class' =>
'mw-newpages-length' ],
277 $this->
msg(
'brackets' )->rawParams(
278 $this->
msg(
'nbytes' )->numParams( $row->length )->escaped()
282 $ulink = Linker::revUserTools( $revRecord );
283 $rc = RecentChange::newFromRow( $row );
284 if ( ChangesList::userCan( $rc, RevisionRecord::DELETED_COMMENT, $this->
getAuthority() ) ) {
285 $comment = $this->formattedComments[$rc->mAttribs[
'rc_id']];
287 $comment =
'<span class="comment">' . $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span>';
289 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
290 $deletedClass =
'history-deleted';
291 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_RESTRICTED ) ) {
292 $deletedClass .=
' mw-history-suppressed';
294 $comment =
'<span class="' . $deletedClass .
' comment">' . $comment .
'</span>';
297 if ( $this->
getUser()->useNPPatrol() && !$row->rc_patrolled ) {
298 $classes[] =
'not-patrolled';
301 # Add a class for zero byte pages
302 if ( $row->length == 0 ) {
303 $classes[] =
'mw-newpages-zero-byte-page';
307 if ( isset( $row->ts_tags ) ) {
313 $classes = array_merge( $classes, $newClasses );
318 # Display the old title if the namespace/title has been changed
320 $oldTitle = Title::makeTitle( $row->rc_namespace, $row->rc_title );
322 if ( !$title->
equals( $oldTitle ) ) {
323 $oldTitleText = $oldTitle->getPrefixedText();
324 $oldTitleText = Html::rawElement(
326 [
'class' =>
'mw-newpages-oldtitle' ],
327 $this->
msg(
'rc-old-title' )->params( $oldTitleText )->escaped()
331 $ret =
"{$time} {$dm}{$plink} {$links} {$dm}{$length} {$dm}{$ulink} {$comment} "
332 .
"{$tagDisplay} {$oldTitleText}";
335 $this->hookRunner->onNewPagesLineEnding(
336 $this, $ret, $row, $classes, $attribs );
337 $attribs = array_filter( $attribs,
338 [ Sanitizer::class,
'isReservedDataAttribute' ],
343 $attribs[
'class'] = $classes;
346 return Html::rawElement(
'li', $attribs, $ret ) .
"\n";