75 $conds[
'rc_source'] = RecentChange::SRC_NEW;
77 $username = $this->opts->getValue(
'username' );
78 $user = Title::makeTitleSafe(
NS_USER, $username );
80 $size = abs( intval( $this->opts->getValue(
'size' ) ) );
83 if ( $this->opts->getValue(
'size-mode' ) ===
'max' ) {
84 $conds[] = $db->expr(
'page_len',
'<=', $size );
86 $conds[] = $db->expr(
'page_len',
'>=', $size );
91 $conds[
'actor_name'] = $user->getText();
93 } elseif ( $this->opts->getValue(
'hideliu' ) ) {
95 $anonOnlyExpr = $this->
getDatabase()->expr(
'actor_user',
'=',
null );
96 if ( $this->tempUserConfig->isKnown() ) {
97 $anonOnlyExpr = $anonOnlyExpr->orExpr( $this->tempUserConfig->getMatchCondition(
98 $this->getDatabase(),
'actor_name', IExpression::LIKE
101 $conds[] = $anonOnlyExpr;
104 $joinFlags = RecentChange::STRAIGHT_JOIN_ACTOR;
107 $conds = array_merge( $conds, $this->getNamespaceCond() );
109 # If this user cannot see patrolled edits or they are off, don't do dumb queries!
110 if ( $this->opts->getValue(
'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) {
111 $conds[
'rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
114 if ( $this->opts->getValue(
'hidebots' ) ) {
115 $conds[
'rc_bot'] = 0;
118 if ( $this->opts->getValue(
'hideredirs' ) ) {
119 $conds[
'page_is_redirect'] = 0;
123 $rcQuery = RecentChange::getQueryInfo( $joinFlags );
124 $tables = array_merge( $rcQuery[
'tables'], [
'page' ] );
125 $fields = array_merge( $rcQuery[
'fields'], [
126 'length' =>
'page_len',
'rev_id' =>
'page_latest',
'page_namespace',
'page_title',
127 'page_content_model',
129 $join_conds = [
'page' => [
'JOIN',
'page_id=rc_cur_id' ] ] + $rcQuery[
'joins'];
131 $this->hookRunner->onSpecialNewpagesConditions(
132 $this, $this->opts, $conds, $tables, $fields, $join_conds );
139 'join_conds' => $join_conds
143 $this->changeTagsStore->modifyDisplayQuery(
149 $this->opts[
'tagfilter'],
150 $this->opts[
'tagInvert']
188 $title = Title::newFromRow( $row );
192 $revRecord = $this->revisionFromRcResult( $row, $title );
195 $attribs = [
'data-mw-revid' => $row->rc_this_oldid ];
197 $lang = $this->getLanguage();
198 $time = ChangesList::revDateLink( $revRecord, $this->getUser(), $lang,
null,
'mw-newpages-time' );
200 $linkRenderer = $this->getLinkRenderer();
202 $query = $title->
isRedirect() ? [
'redirect' =>
'no' ] : [];
204 $plink = Html::rawElement(
'bdi', [
'dir' => $lang->getDir() ], $linkRenderer->makeKnownLink(
207 [
'class' =>
'mw-newpages-pagename' ],
211 $linkArr[] = $linkRenderer->makeKnownLink(
213 $this->msg(
'hist' )->text(),
214 [
'class' =>
'mw-newpages-history' ],
215 [
'action' =>
'history' ]
217 if ( $this->contentHandlerFactory->getContentHandler( $title->
getContentModel() )
218 ->supportsDirectEditing()
220 $linkArr[] = $linkRenderer->makeKnownLink(
222 $this->msg(
'editlink' )->text(),
223 [
'class' =>
'mw-newpages-edit' ],
224 [
'action' =>
'edit' ]
227 $links = $this->msg(
'parentheses' )->rawParams( $this->getLanguage()
228 ->pipeList( $linkArr ) )->escaped();
230 $length = Html::rawElement(
232 [
'class' =>
'mw-newpages-length' ],
233 $this->msg(
'brackets' )->rawParams(
234 $this->msg(
'nbytes' )->numParams( $row->length )->escaped()
238 $ulink = Linker::revUserTools( $revRecord );
239 $rc = RecentChange::newFromRow( $row );
240 if ( ChangesList::userCan( $rc, RevisionRecord::DELETED_COMMENT, $this->getAuthority() ) ) {
241 $comment = $this->formattedComments[$rc->mAttribs[
'rc_id']];
243 $comment =
'<span class="comment">' . $this->msg(
'rev-deleted-comment' )->escaped() .
'</span>';
245 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
246 $deletedClass =
'history-deleted';
247 if ( ChangesList::isDeleted( $rc, RevisionRecord::DELETED_RESTRICTED ) ) {
248 $deletedClass .=
' mw-history-suppressed';
250 $comment =
'<span class="' . $deletedClass .
' comment">' . $comment .
'</span>';
253 if ( $this->getUser()->useNPPatrol() && !$row->rc_patrolled ) {
254 $classes[] =
'not-patrolled';
257 # Add a class for zero byte pages
258 if ( $row->length == 0 ) {
259 $classes[] =
'mw-newpages-zero-byte-page';
263 if ( isset( $row->ts_tags ) ) {
264 [ $tagDisplay, $newClasses ] = $this->tagsCache->getWithSetCallback(
265 $this->tagsCache->makeKey(
267 $this->getUser()->getName(),
270 fn () => ChangeTags::formatSummaryRow(
276 $classes = array_merge( $classes, $newClasses );
281 # Display the old title if the namespace/title has been changed
285 if ( !$title->
equals( $oldTitle ) ) {
286 $oldTitleText = $oldTitle->getPrefixedText();
288 [
'class' =>
'mw-newpages-oldtitle' ],
289 $this->msg(
'rc-old-title', $oldTitleText )->text()
293 $ret =
"{$time} {$plink} {$links} {$length} {$ulink} {$comment} "
294 .
"{$tagDisplay} {$oldTitleText}";
297 $this->hookRunner->onNewPagesLineEnding(
298 $this, $ret, $row, $classes, $attribs );
299 $attribs = array_filter( $attribs,
300 Sanitizer::isReservedDataAttribute( ... ),
305 $attribs[
'class'] = $classes;
308 return Html::rawElement(
'li', $attribs, $ret ) .
"\n";