78 $conds[
'rc_source'] = RecentChange::SRC_NEW;
80 $username = $this->opts->getValue(
'username' );
81 $user = Title::makeTitleSafe(
NS_USER, $username );
83 $size = abs( intval( $this->opts->getValue(
'size' ) ) );
86 if ( $this->opts->getValue(
'size-mode' ) ===
'max' ) {
87 $conds[] = $db->expr(
'page_len',
'<=', $size );
89 $conds[] = $db->expr(
'page_len',
'>=', $size );
94 $conds[
'actor_name'] = $user->getText();
96 } elseif ( $this->opts->getValue(
'hideliu' ) ) {
98 $anonOnlyExpr = $this->
getDatabase()->expr(
'actor_user',
'=',
null );
99 if ( $this->tempUserConfig->isKnown() ) {
100 $anonOnlyExpr = $anonOnlyExpr->orExpr( $this->tempUserConfig->getMatchCondition(
101 $this->getDatabase(),
'actor_name', IExpression::LIKE
104 $conds[] = $anonOnlyExpr;
107 $joinFlags = RecentChange::STRAIGHT_JOIN_ACTOR;
110 $conds = array_merge( $conds, $this->getNamespaceCond() );
112 # If this user cannot see patrolled edits or they are off, don't do dumb queries!
113 if ( $this->opts->getValue(
'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) {
114 $conds[
'rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
117 if ( $this->opts->getValue(
'hidebots' ) ) {
118 $conds[
'rc_bot'] = 0;
121 if ( $this->opts->getValue(
'hideredirs' ) ) {
122 $conds[
'page_is_redirect'] = 0;
126 $rcQuery = RecentChange::getQueryInfo( $joinFlags );
127 $tables = array_merge( $rcQuery[
'tables'], [
'page' ] );
128 $fields = array_merge( $rcQuery[
'fields'], [
129 'length' =>
'page_len',
'rev_id' =>
'page_latest',
'page_namespace',
'page_title',
130 'page_content_model',
132 $join_conds = [
'page' => [
'JOIN',
'page_id=rc_cur_id' ] ] + $rcQuery[
'joins'];
134 $this->hookRunner->onSpecialNewpagesConditions(
135 $this, $this->opts, $conds, $tables, $fields, $join_conds );
142 'join_conds' => $join_conds
146 $queryBuilder = $this->
getDatabase()->newSelectQueryBuilder()->queryInfo( $info );
147 $this->changeTagsStore->addTagsToDisplayQuery(
148 $queryBuilder,
'recentchanges', $this->
getAuthority(), $this->opts[
'tagfilter'], $this->opts[
'tagInvert']
150 $info = $queryBuilder->getQueryInfo(
'join_conds' );
187 $title = Title::newFromRow( $row );
191 $revRecord = $this->revisionFromRcResult( $row, $title );
194 $attribs = [
'data-mw-revid' => $row->rc_this_oldid ];
196 $lang = $this->getLanguage();
197 $time = ChangesList::revDateLink( $revRecord, $this->getUser(), $lang,
null,
'mw-newpages-time' );
199 $linkRenderer = $this->getLinkRenderer();
201 $query = $title->
isRedirect() ? [
'redirect' =>
'no' ] : [];
203 $plink = Html::rawElement(
'bdi', [
'dir' => $lang->getDir() ], $linkRenderer->makeKnownLink(
206 [
'class' =>
'mw-newpages-pagename' ],
210 $linkArr[] = $linkRenderer->makeKnownLink(
212 $this->msg(
'hist' )->text(),
213 [
'class' =>
'mw-newpages-history' ],
214 [
'action' =>
'history' ]
216 if ( $this->contentHandlerFactory->getContentHandler( $title->
getContentModel() )
217 ->supportsDirectEditing()
219 $linkArr[] = $linkRenderer->makeKnownLink(
221 $this->msg(
'editlink' )->text(),
222 [
'class' =>
'mw-newpages-edit' ],
223 [
'action' =>
'edit' ]
226 $links = $this->msg(
'parentheses' )->rawParams( $this->getLanguage()
227 ->pipeList( $linkArr ) )->escaped();
229 $length = Html::rawElement(
231 [
'class' =>
'mw-newpages-length' ],
232 $this->msg(
'brackets' )->rawParams(
233 $this->msg(
'nbytes' )->numParams( $row->length )->escaped()
237 $ulink = Linker::revUserTools( $revRecord );
238 $rc = $this->rcFactory->newRecentChangeFromRow( $row );
239 if ( ChangesList::userCan( $rc, RevisionRecord::DELETED_COMMENT, $this->getAuthority() ) ) {
240 $comment = $this->formattedComments[$rc->mAttribs[
'rc_id']];
242 $comment =
'<span class="comment">' . $this->msg(
'rev-deleted-comment' )->escaped() .
'</span>';
244 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
245 $deletedClass =
'history-deleted';
246 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_RESTRICTED ) ) {
247 $deletedClass .=
' mw-history-suppressed';
249 $comment =
'<span class="' . $deletedClass .
' comment">' . $comment .
'</span>';
252 if ( $this->getUser()->useNPPatrol() && !$row->rc_patrolled ) {
253 $classes[] =
'not-patrolled';
256 # Add a class for zero byte pages
257 if ( $row->length == 0 ) {
258 $classes[] =
'mw-newpages-zero-byte-page';
262 if ( isset( $row->ts_tags ) ) {
263 [ $tagDisplay, $newClasses ] = $this->tagsCache->getWithSetCallback(
264 $this->tagsCache->makeKey(
266 $this->getUser()->getName(),
269 fn () => $this->changeTagsFormatter->formatTagsAsSummaryList(
272 $this->getAuthority()
275 $classes = array_merge( $classes, $newClasses );
280 # Display the old title if the namespace/title has been changed
284 if ( !$title->
equals( $oldTitle ) ) {
285 $oldTitleText = $oldTitle->getPrefixedText();
287 [
'class' =>
'mw-newpages-oldtitle' ],
288 $this->msg(
'rc-old-title', $oldTitleText )->text()
292 $ret =
"{$time} {$plink} {$links} {$length} {$ulink} {$comment} "
293 .
"{$tagDisplay} {$oldTitleText}";
296 $this->hookRunner->onNewPagesLineEnding(
297 $this, $ret, $row, $classes, $attribs );
298 $attribs = array_filter( $attribs,
299 Sanitizer::isReservedDataAttribute( ... ),
304 $attribs[
'class'] = $classes;
307 return Html::rawElement(
'li', $attribs, $ret ) .
"\n";