2004-02-18 02:15:00 +00:00
|
|
|
<?php
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
|
|
|
|
*
|
2007-01-20 15:09:52 +00:00
|
|
|
* @addtogroup SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2007-12-15 20:22:16 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Start point
|
|
|
|
|
*/
|
2008-04-15 20:42:42 +00:00
|
|
|
function wfSpecialNewPages( $par, $sp ) {
|
2008-04-13 19:57:12 +00:00
|
|
|
$page = new NewPagesForm();
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-15 20:42:42 +00:00
|
|
|
$page->showList( $par, $sp->including() );
|
2007-12-15 20:22:16 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
2007-04-20 08:55:14 +00:00
|
|
|
* implements Special:Newpages
|
2007-01-20 15:09:52 +00:00
|
|
|
* @addtogroup SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
2008-04-13 19:57:12 +00:00
|
|
|
class NewPagesForm {
|
2006-04-21 06:49:23 +00:00
|
|
|
/**
|
2006-07-10 08:38:48 +00:00
|
|
|
* Show a form for filtering namespace and username
|
2006-04-21 06:49:23 +00:00
|
|
|
*
|
2008-04-15 20:42:42 +00:00
|
|
|
* @param string $par
|
|
|
|
|
* @param bool $including true if the page is being included with {{Special:Newpages}}
|
2006-04-21 06:49:23 +00:00
|
|
|
* @return string
|
2008-02-10 10:05:49 +00:00
|
|
|
*/
|
2008-04-15 20:42:42 +00:00
|
|
|
public function showList( $par, $including ) {
|
2008-04-15 23:26:05 +00:00
|
|
|
global $wgScript, $wgLang, $wgGroupPermissions, $wgRequest, $wgUser, $wgOut;
|
2008-04-30 23:49:28 +00:00
|
|
|
global $wgEnableNewpagesUserFilter;
|
2007-12-15 20:22:16 +00:00
|
|
|
$sk = $wgUser->getSkin();
|
2008-04-13 19:57:12 +00:00
|
|
|
$self = SpecialPage::getTitleFor( 'NewPages' );
|
2007-11-01 16:18:17 +00:00
|
|
|
|
|
|
|
|
// show/hide links
|
2008-04-15 20:42:42 +00:00
|
|
|
$showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
|
2007-12-15 20:22:16 +00:00
|
|
|
|
|
|
|
|
$hidelinks = array();
|
|
|
|
|
|
|
|
|
|
if ( $wgGroupPermissions['*']['createpage'] === true ) {
|
|
|
|
|
$hidelinks['hideliu'] = 'rcshowhideliu';
|
|
|
|
|
}
|
2008-04-13 19:57:12 +00:00
|
|
|
if ( $wgUser->useNPPatrol() ) {
|
2007-12-15 20:22:16 +00:00
|
|
|
$hidelinks['hidepatrolled'] = 'rcshowhidepatr';
|
|
|
|
|
}
|
|
|
|
|
$hidelinks['hidebots'] = 'rcshowhidebots';
|
2007-11-02 03:53:51 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
$defaults = array(
|
|
|
|
|
/* bool */ 'hideliu' => false,
|
|
|
|
|
/* bool */ 'hidepatrolled' => false,
|
|
|
|
|
/* bool */ 'hidebots' => false,
|
|
|
|
|
/* text */ 'namespace' => "0",
|
|
|
|
|
/* text */ 'username' => '',
|
|
|
|
|
/* int */ 'offset' => 0,
|
|
|
|
|
/* int */ 'limit' => 50,
|
|
|
|
|
);
|
|
|
|
|
$options = $defaults;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
// Override all values from requests, if specified
|
2008-04-15 20:42:42 +00:00
|
|
|
foreach ( $defaults as $v => $t ) {
|
|
|
|
|
if ( is_bool($t) ) {
|
|
|
|
|
$options[$v] = $wgRequest->getBool( $v, $options[$v] );
|
|
|
|
|
} elseif( is_int($t) ) {
|
|
|
|
|
$options[$v] = $wgRequest->getInt( $v, $options[$v] );
|
|
|
|
|
} elseif( is_string($t) ) {
|
2008-05-01 23:12:37 +00:00
|
|
|
$options[$v] = trim( $wgRequest->getVal( $v, $options[$v] ) );
|
2008-04-15 20:42:42 +00:00
|
|
|
}
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-15 20:42:42 +00:00
|
|
|
$shownav = !$including;
|
|
|
|
|
if ( $par ) {
|
|
|
|
|
$bits = preg_split( '/\s*,\s*/', trim( $par ) );
|
|
|
|
|
foreach ( $bits as $bit ) {
|
|
|
|
|
if ( 'shownav' == $bit )
|
|
|
|
|
$shownav = true;
|
|
|
|
|
if ( 'hideliu' === $bit )
|
|
|
|
|
$options['hideliu'] = true;
|
|
|
|
|
if ( 'hidepatrolled' == $bit )
|
|
|
|
|
$options['hidepatrolled'] = true;
|
|
|
|
|
if ( 'hidebots' == $bit )
|
|
|
|
|
$options['hidebots'] = true;
|
|
|
|
|
if ( is_numeric( $bit ) )
|
|
|
|
|
$options['limit'] = intval( $bit );
|
|
|
|
|
|
|
|
|
|
$m = array();
|
|
|
|
|
if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) )
|
|
|
|
|
$options['limit'] = intval($m[1]);
|
|
|
|
|
if ( preg_match( '/^offset=(\d+)$/', $bit, $m ) )
|
|
|
|
|
$options['offset'] = intval($m[1]);
|
|
|
|
|
if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) {
|
|
|
|
|
$ns = $wgLang->getNsIndex( $m[1] );
|
|
|
|
|
if( $ns !== false ) {
|
|
|
|
|
$options['namespace'] = $ns;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-12-15 20:22:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-30 23:49:28 +00:00
|
|
|
if( !$wgEnableNewpagesUserFilter ) {
|
|
|
|
|
// hack disable
|
|
|
|
|
$options['username'] = '';
|
|
|
|
|
}
|
2008-04-15 20:42:42 +00:00
|
|
|
|
|
|
|
|
if( !$including ){
|
|
|
|
|
$wgOut->setSyndicated( true );
|
|
|
|
|
$wgOut->setFeedAppendQuery( "namespace={$options['namespace']}&username={$options['username']}" );
|
|
|
|
|
|
|
|
|
|
$feedType = $wgRequest->getVal( 'feed' );
|
|
|
|
|
if( $feedType ) {
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
|
return $this->feed( $feedType, $options );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$nondefaults = array();
|
|
|
|
|
foreach ( $options as $v => $t ) {
|
|
|
|
|
if ( $v === 'offset' ) continue; # Reset offset if parameters change
|
|
|
|
|
wfAppendToArrayIfNotDefault( $v, $t, $defaults, $nondefaults );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$links = array();
|
|
|
|
|
foreach ( $hidelinks as $key => $msg ) {
|
|
|
|
|
$reversed = 1 - $options[$key];
|
|
|
|
|
$link = $sk->makeKnownLinkObj( $self, $showhide[$reversed],
|
|
|
|
|
wfArrayToCGI( array( $key => $reversed ), $nondefaults )
|
|
|
|
|
);
|
|
|
|
|
$links[$key] = wfMsgHtml( $msg, $link );
|
|
|
|
|
}
|
2007-11-01 16:18:17 +00:00
|
|
|
|
2008-04-15 20:42:42 +00:00
|
|
|
$hl = implode( ' | ', $links );
|
|
|
|
|
|
|
|
|
|
// Store query values in hidden fields so that form submission doesn't lose them
|
|
|
|
|
$hidden = array();
|
|
|
|
|
foreach ( $nondefaults as $key => $value ) {
|
|
|
|
|
if ( $key === 'namespace' ) continue;
|
|
|
|
|
if ( $key === 'username' ) continue;
|
|
|
|
|
$hidden[] = Xml::hidden( $key, $value );
|
|
|
|
|
}
|
|
|
|
|
$hidden = implode( "\n", $hidden );
|
2008-05-01 23:12:37 +00:00
|
|
|
|
|
|
|
|
$ut = Title::makeTitleSafe( NS_USER, $options['username'] );
|
2008-05-01 23:28:49 +00:00
|
|
|
$userText = $ut ? $ut->getText() : '';
|
2008-04-15 20:42:42 +00:00
|
|
|
|
|
|
|
|
$form = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
|
|
|
|
|
Xml::hidden( 'title', $self->getPrefixedDBkey() ) .
|
|
|
|
|
Xml::openElement( 'fieldset' ) .
|
|
|
|
|
Xml::element( 'legend', null, wfMsg( 'newpages' ) ) .
|
|
|
|
|
Xml::openElement( 'table', array( 'id' => 'mw-newpages-table' ) ) .
|
|
|
|
|
"<tr>
|
2008-04-15 23:26:05 +00:00
|
|
|
<td class='mw-label'>" .
|
2008-04-15 20:42:42 +00:00
|
|
|
Xml::label( wfMsg( 'namespace' ), 'namespace' ) .
|
|
|
|
|
"</td>
|
2008-04-15 23:26:05 +00:00
|
|
|
<td class='mw-input'>" .
|
2008-04-15 20:42:42 +00:00
|
|
|
Xml::namespaceSelector( $options['namespace'], 'all' ) .
|
|
|
|
|
"</td>
|
2008-04-30 23:49:28 +00:00
|
|
|
</tr>" .
|
|
|
|
|
($wgEnableNewpagesUserFilter ?
|
|
|
|
|
"<tr>
|
2008-04-15 23:26:05 +00:00
|
|
|
<td class='mw-label'>" .
|
2008-04-15 20:42:42 +00:00
|
|
|
Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) .
|
|
|
|
|
"</td>
|
2008-04-15 23:26:05 +00:00
|
|
|
<td class='mw-input'>" .
|
2008-05-01 23:28:49 +00:00
|
|
|
Xml::input( 'username', 30, $userText, array( 'id' => 'mw-np-username' ) ) .
|
2008-04-15 20:42:42 +00:00
|
|
|
"</td>
|
2008-04-30 23:49:28 +00:00
|
|
|
</tr>" : "" ) .
|
|
|
|
|
"<tr> <td></td>
|
2008-04-15 23:26:05 +00:00
|
|
|
<td class='mw-submit'>" .
|
2008-04-15 20:42:42 +00:00
|
|
|
Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .
|
|
|
|
|
"</td>
|
|
|
|
|
</tr>" .
|
|
|
|
|
"<tr>
|
|
|
|
|
<td></td>
|
2008-04-15 23:26:05 +00:00
|
|
|
<td class='mw-input'>" .
|
2008-04-15 20:42:42 +00:00
|
|
|
$hl .
|
|
|
|
|
"</td>
|
|
|
|
|
</tr>" .
|
|
|
|
|
Xml::closeElement( 'table' ) .
|
|
|
|
|
Xml::closeElement( 'fieldset' ) .
|
|
|
|
|
$hidden .
|
|
|
|
|
Xml::closeElement( 'form' );
|
|
|
|
|
|
|
|
|
|
$wgOut->addHTML( $form );
|
2007-12-15 20:22:16 +00:00
|
|
|
}
|
2008-04-13 19:57:12 +00:00
|
|
|
|
2008-04-14 07:45:50 +00:00
|
|
|
$pager = new NewPagesPager( $this, array(), $options['namespace'], $options['hideliu'],
|
|
|
|
|
$options['hidepatrolled'], $options['hidebots'], $options['username'] );
|
2008-04-15 20:42:42 +00:00
|
|
|
$pager->mLimit = $options['limit'];
|
|
|
|
|
$pager->mOffset = $options['offset'];
|
2008-04-13 19:57:12 +00:00
|
|
|
|
|
|
|
|
if( $pager->getNumRows() ) {
|
2008-04-16 15:12:44 +00:00
|
|
|
$wgOut->addHTML(
|
|
|
|
|
( $shownav ? $pager->getNavigationBar() : '' ) .
|
2008-04-13 19:57:12 +00:00
|
|
|
$pager->getBody() .
|
2008-04-16 15:12:44 +00:00
|
|
|
( $shownav ? $pager->getNavigationBar() : '' )
|
|
|
|
|
);
|
2008-04-13 19:57:12 +00:00
|
|
|
} else {
|
2008-04-15 23:26:05 +00:00
|
|
|
$wgOut->addHTML( Xml::element( 'p', null, wfMsg( 'specialpage-empty' ) ) );
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
/**
|
|
|
|
|
* Format a row, providing the timestamp, links to the page/history, size, user links, and a comment
|
|
|
|
|
*
|
|
|
|
|
* @param $skin Skin to use
|
|
|
|
|
* @param $result Result row
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function formatRow( $result ) {
|
|
|
|
|
global $wgLang, $wgContLang, $wgUser;
|
|
|
|
|
$dm = $wgContLang->getDirMark();
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
static $skin=null;
|
|
|
|
|
|
|
|
|
|
if( is_null( $skin ) )
|
|
|
|
|
$skin = $wgUser->getSkin();
|
|
|
|
|
|
|
|
|
|
$title = Title::makeTitleSafe( $result->rc_namespace, $result->rc_title );
|
|
|
|
|
$time = $wgLang->timeAndDate( $result->rc_timestamp, true );
|
|
|
|
|
$plink = $skin->makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rc_id : '' );
|
|
|
|
|
$hist = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
|
2008-04-14 07:45:50 +00:00
|
|
|
$length = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
|
2008-04-13 19:57:12 +00:00
|
|
|
$wgLang->formatNum( htmlspecialchars( $result->length ) ) );
|
2008-04-14 07:45:50 +00:00
|
|
|
$ulink = $skin->userLink( $result->rc_user, $result->rc_user_text ) . ' ' .
|
2008-04-13 19:57:12 +00:00
|
|
|
$skin->userToolLinks( $result->rc_user, $result->rc_user_text );
|
|
|
|
|
$comment = $skin->commentBlock( $result->rc_comment );
|
|
|
|
|
$css = $this->patrollable( $result ) ? 'not-patrolled' : '';
|
|
|
|
|
|
2008-04-16 15:12:44 +00:00
|
|
|
return "<li class='$css'>{$time} {$dm}{$plink} ({$hist}) {$dm}[{$length}] {$dm}{$ulink} {$comment}</li>\n";
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Should a specific result row provide "patrollable" links?
|
|
|
|
|
*
|
|
|
|
|
* @param $result Result row
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
protected function patrollable( $result ) {
|
|
|
|
|
global $wgUser;
|
|
|
|
|
return ( $wgUser->useNPPatrol() && !$result->rc_patrolled );
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
/**
|
|
|
|
|
* Output a subscription feed listing recent edits to this page.
|
|
|
|
|
* @param string $type
|
|
|
|
|
*/
|
|
|
|
|
protected function feed( $type, $options ) {
|
|
|
|
|
require_once 'SpecialRecentchanges.php';
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
global $wgFeed, $wgFeedClasses;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
if ( !$wgFeed ) {
|
|
|
|
|
global $wgOut;
|
|
|
|
|
$wgOut->addWikiMsg( 'feed-unavailable' );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
if( !isset( $wgFeedClasses[$type] ) ) {
|
|
|
|
|
global $wgOut;
|
|
|
|
|
$wgOut->addWikiMsg( 'feed-invalid' );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
$self = SpecialPage::getTitleFor( 'NewPages' );
|
|
|
|
|
$feed = new $wgFeedClasses[$type](
|
|
|
|
|
$this->feedTitle(),
|
|
|
|
|
wfMsg( 'tagline' ),
|
|
|
|
|
$self->getFullUrl() );
|
|
|
|
|
|
2008-04-14 07:45:50 +00:00
|
|
|
$pager = new NewPagesPager( $this, array(), $options['namespace'], $options['hideliu'],
|
|
|
|
|
$options['hidepatrolled'], $options['hidebots'], $options['username'] );
|
|
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
$feed->outHeader();
|
|
|
|
|
if( $pager->getNumRows() > 0 ) {
|
|
|
|
|
while( $row = $pager->mResult->fetchObject() ) {
|
|
|
|
|
$feed->outItem( $this->feedItem( $row ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$feed->outFooter();
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
protected function feedTitle() {
|
|
|
|
|
global $wgContLanguageCode, $wgSitename;
|
|
|
|
|
$page = SpecialPage::getPage( 'Newpages' );
|
|
|
|
|
$desc = $page->getDescription();
|
|
|
|
|
return "$wgSitename - $desc [$wgContLanguageCode]";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function feedItem( $row ) {
|
|
|
|
|
$title = Title::MakeTitle( intval( $row->rc_namespace ), $row->rc_title );
|
|
|
|
|
if( $title ) {
|
|
|
|
|
$date = $row->rc_timestamp;
|
|
|
|
|
$comments = $this->stripComment( $row->rc_comment );
|
|
|
|
|
|
|
|
|
|
return new FeedItem(
|
|
|
|
|
$title->getPrefixedText(),
|
|
|
|
|
$this->feedItemDesc( $row ),
|
|
|
|
|
$title->getFullURL(),
|
|
|
|
|
$date,
|
|
|
|
|
$this->feedItemAuthor( $row ),
|
|
|
|
|
$comments);
|
|
|
|
|
} else {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
/**
|
|
|
|
|
* Quickie hack... strip out wikilinks to more legible form from the comment.
|
|
|
|
|
*/
|
2008-04-26 04:00:03 +00:00
|
|
|
protected function stripComment( $text ) {
|
2008-04-13 19:57:12 +00:00
|
|
|
return preg_replace( '/\[\[([^]]*\|)?([^]]+)\]\]/', '\2', $text );
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-26 04:00:03 +00:00
|
|
|
protected function feedItemAuthor( $row ) {
|
2008-04-13 19:57:12 +00:00
|
|
|
return isset( $row->rc_user_text ) ? $row->rc_user_text : '';
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
protected function feedItemDesc( $row ) {
|
2008-04-13 20:02:50 +00:00
|
|
|
$revision = Revision::newFromId( $row->rev_id );
|
|
|
|
|
if( $revision ) {
|
2008-05-05 03:35:37 +00:00
|
|
|
return '<p>' . htmlspecialchars( $revision->getUserText() ) . ': ' .
|
|
|
|
|
htmlspecialchars( $revision->getComment() ) .
|
|
|
|
|
"</p>\n<hr />\n<div>" .
|
2008-04-13 20:02:50 +00:00
|
|
|
nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>";
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @addtogroup Pager
|
|
|
|
|
*/
|
|
|
|
|
class NewPagesPager extends ReverseChronologicalPager {
|
2008-04-15 20:42:42 +00:00
|
|
|
private $hideliu, $hidepatrolled, $hidebots, $namespace, $user, $spTitle;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
function __construct( $form, $conds=array(), $namespace, $hliu=false, $hpatrolled=false, $hbots=1, $user='' ) {
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->mForm = $form;
|
|
|
|
|
$this->mConds = $conds;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 20:56:50 +00:00
|
|
|
$this->namespace = ($namespace === "all") ? false : intval($namespace);
|
2008-04-13 19:57:12 +00:00
|
|
|
$this->user = $user;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
$this->hideliu = (bool)$hliu;
|
|
|
|
|
$this->hidepatrolled = (bool)$hpatrolled;
|
|
|
|
|
$this->hidebots = (bool)$hbots;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-15 20:42:42 +00:00
|
|
|
function getTitle(){
|
|
|
|
|
if( !isset( $this->spTitle ) )
|
|
|
|
|
$this->spTitle = SpecialPage::getTitleFor( 'Newpages' );
|
|
|
|
|
return $this->spTitle;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
function getQueryInfo() {
|
2008-04-30 23:49:28 +00:00
|
|
|
global $wgEnableNewpagesUserFilter;
|
2008-04-13 19:57:12 +00:00
|
|
|
$conds = $this->mConds;
|
|
|
|
|
$conds['rc_new'] = 1;
|
|
|
|
|
if( $this->namespace !== false ) {
|
|
|
|
|
$conds['rc_namespace'] = $this->namespace;
|
2008-04-15 17:33:17 +00:00
|
|
|
$rcIndexes = array( 'new_name_timestamp' );
|
2008-04-13 19:57:12 +00:00
|
|
|
} else {
|
2008-04-15 17:33:17 +00:00
|
|
|
$rcIndexes = array( 'rc_timestamp' );
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
$conds[] = 'page_id = rc_cur_id';
|
|
|
|
|
$conds['page_is_redirect'] = 0;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
global $wgGroupPermissions, $wgUser;
|
|
|
|
|
# If anons cannot make new pages, don't query for it!
|
|
|
|
|
if( $wgGroupPermissions['*']['createpage'] && $this->hideliu ) {
|
|
|
|
|
$conds['rc_user'] = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$title = Title::makeTitleSafe( NS_USER, $this->user );
|
|
|
|
|
if( $title ) {
|
|
|
|
|
$conds['rc_user_text'] = $title->getText();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
# If this user cannot see patrolled edits or they are off, don't do dumb queries!
|
|
|
|
|
if( $this->hidepatrolled && $wgUser->useNPPatrol() ) {
|
|
|
|
|
$conds['rc_patrolled'] = 0;
|
|
|
|
|
}
|
|
|
|
|
if( $this->hidebots ) {
|
|
|
|
|
$conds['rc_bot'] = 0;
|
|
|
|
|
}
|
2008-05-01 21:55:52 +00:00
|
|
|
# $wgEnableNewpagesUserFilter - temp WMF hack
|
|
|
|
|
if( $wgEnableNewpagesUserFilter && $this->user ) {
|
2008-04-13 19:57:12 +00:00
|
|
|
$conds['rc_user_text'] = $this->user;
|
2008-05-01 21:55:52 +00:00
|
|
|
$rcIndexes = 'rc_user_text';
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return array(
|
|
|
|
|
'tables' => array( 'recentchanges', 'page' ),
|
|
|
|
|
'fields' => 'rc_namespace,rc_title, rc_cur_id, rc_user,rc_user_text,rc_comment,
|
|
|
|
|
rc_timestamp,rc_patrolled,rc_id,page_len as length, page_latest as rev_id',
|
|
|
|
|
'conds' => $conds,
|
|
|
|
|
'options' => array( 'USE INDEX' => array('recentchanges' => $rcIndexes) )
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getIndexField() {
|
|
|
|
|
return 'rc_timestamp';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formatRow( $row ) {
|
|
|
|
|
return $this->mForm->formatRow( $row );
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
function getStartBody() {
|
|
|
|
|
# Do a batch existence check on pages
|
|
|
|
|
$linkBatch = new LinkBatch();
|
|
|
|
|
while( $row = $this->mResult->fetchObject() ) {
|
|
|
|
|
$linkBatch->add( NS_USER, $row->rc_user_text );
|
|
|
|
|
$linkBatch->add( NS_USER_TALK, $row->rc_user_text );
|
|
|
|
|
$linkBatch->add( $row->rc_namespace, $row->rc_title );
|
|
|
|
|
}
|
|
|
|
|
$linkBatch->execute();
|
|
|
|
|
return "<ul>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getEndBody() {
|
|
|
|
|
return "</ul>";
|
2006-04-21 06:49:23 +00:00
|
|
|
}
|
2008-02-10 10:05:49 +00:00
|
|
|
}
|