2004-02-18 02:15:00 +00:00
|
|
|
<?php
|
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
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
2008-06-18 20:45:10 +00:00
|
|
|
class SpecialNewpages extends SpecialPage {
|
2008-05-11 21:43:16 +00:00
|
|
|
|
|
|
|
|
// Stored objects
|
2008-06-18 20:45:10 +00:00
|
|
|
protected $opts, $skin;
|
2008-05-11 21:43:16 +00:00
|
|
|
|
|
|
|
|
// Some internal settings
|
|
|
|
|
protected $showNavigation = false;
|
|
|
|
|
|
2008-10-17 01:31:12 +00:00
|
|
|
public function __construct() {
|
2008-06-18 20:45:10 +00:00
|
|
|
parent::__construct( 'Newpages' );
|
|
|
|
|
$this->includable( true );
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
protected function setup( $par ) {
|
|
|
|
|
global $wgRequest, $wgUser, $wgEnableNewpagesUserFilter;
|
|
|
|
|
|
|
|
|
|
// Options
|
|
|
|
|
$opts = new FormOptions();
|
2008-05-14 05:18:27 +00:00
|
|
|
$this->opts = $opts; // bind
|
2008-05-11 21:43:16 +00:00
|
|
|
$opts->add( 'hideliu', false );
|
|
|
|
|
$opts->add( 'hidepatrolled', false );
|
|
|
|
|
$opts->add( 'hidebots', false );
|
2008-11-02 22:58:35 +00:00
|
|
|
$opts->add( 'hideredirs', true );
|
2008-09-14 04:49:22 +00:00
|
|
|
$opts->add( 'limit', (int)$wgUser->getOption( 'rclimit' ) );
|
2008-05-14 13:28:46 +00:00
|
|
|
$opts->add( 'offset', '' );
|
2008-05-11 21:43:16 +00:00
|
|
|
$opts->add( 'namespace', '0' );
|
|
|
|
|
$opts->add( 'username', '' );
|
|
|
|
|
$opts->add( 'feed', '' );
|
|
|
|
|
|
|
|
|
|
// Set values
|
|
|
|
|
$opts->fetchValuesFromRequest( $wgRequest );
|
|
|
|
|
if ( $par ) $this->parseParams( $par );
|
|
|
|
|
|
|
|
|
|
// Validate
|
|
|
|
|
$opts->validateIntBounds( 'limit', 0, 5000 );
|
|
|
|
|
if( !$wgEnableNewpagesUserFilter ) {
|
|
|
|
|
$opts->setValue( 'username', '' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Store some objects
|
|
|
|
|
$this->skin = $wgUser->getSkin();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function parseParams( $par ) {
|
2008-05-14 23:03:39 +00:00
|
|
|
global $wgLang;
|
2008-05-11 21:43:16 +00:00
|
|
|
$bits = preg_split( '/\s*,\s*/', trim( $par ) );
|
|
|
|
|
foreach ( $bits as $bit ) {
|
|
|
|
|
if ( 'shownav' == $bit )
|
|
|
|
|
$this->showNavigation = true;
|
|
|
|
|
if ( 'hideliu' === $bit )
|
|
|
|
|
$this->opts->setValue( 'hideliu', true );
|
|
|
|
|
if ( 'hidepatrolled' == $bit )
|
|
|
|
|
$this->opts->setValue( 'hidepatrolled', true );
|
|
|
|
|
if ( 'hidebots' == $bit )
|
|
|
|
|
$this->opts->setValue( 'hidebots', true );
|
2008-11-02 22:58:35 +00:00
|
|
|
if ( 'showredirs' == $bit )
|
|
|
|
|
$this->opts->setValue( 'hideredirs', false );
|
2008-05-11 21:43:16 +00:00
|
|
|
if ( is_numeric( $bit ) )
|
|
|
|
|
$this->opts->setValue( 'limit', intval( $bit ) );
|
|
|
|
|
|
|
|
|
|
$m = array();
|
|
|
|
|
if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) )
|
|
|
|
|
$this->opts->setValue( 'limit', intval($m[1]) );
|
2008-05-14 13:28:46 +00:00
|
|
|
// PG offsets not just digits!
|
|
|
|
|
if ( preg_match( '/^offset=([^=]+)$/', $bit, $m ) )
|
2008-05-11 21:43:16 +00:00
|
|
|
$this->opts->setValue( 'offset', intval($m[1]) );
|
|
|
|
|
if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) {
|
|
|
|
|
$ns = $wgLang->getNsIndex( $m[1] );
|
|
|
|
|
if( $ns !== false ) {
|
|
|
|
|
$this->opts->setValue( 'namespace', $ns );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
2006-04-21 06:49:23 +00:00
|
|
|
* @return string
|
2008-02-10 10:05:49 +00:00
|
|
|
*/
|
2008-06-18 20:45:10 +00:00
|
|
|
public function execute( $par ) {
|
2008-08-05 17:48:24 +00:00
|
|
|
global $wgLang, $wgUser, $wgOut;
|
2007-11-01 16:18:17 +00:00
|
|
|
|
2008-06-18 20:45:10 +00:00
|
|
|
$this->setHeaders();
|
|
|
|
|
$this->outputHeader();
|
|
|
|
|
|
|
|
|
|
$this->showNavigation = !$this->including(); // Maybe changed in setup
|
2008-05-11 21:43:16 +00:00
|
|
|
$this->setup( $par );
|
2007-12-15 20:22:16 +00:00
|
|
|
|
2008-06-18 20:45:10 +00:00
|
|
|
if( !$this->including() ) {
|
2008-05-14 05:18:27 +00:00
|
|
|
// Settings
|
|
|
|
|
$this->form();
|
2007-12-15 20:22:16 +00:00
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
$this->setSyndicated();
|
|
|
|
|
$feedType = $this->opts->getValue( 'feed' );
|
|
|
|
|
if( $feedType ) {
|
2008-06-06 16:42:23 +00:00
|
|
|
return $this->feed( $feedType );
|
2008-04-15 20:42:42 +00:00
|
|
|
}
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
$pager = new NewPagesPager( $this, $this->opts );
|
|
|
|
|
$pager->mLimit = $this->opts->getValue( 'limit' );
|
|
|
|
|
$pager->mOffset = $this->opts->getValue( 'offset' );
|
2007-12-15 20:22:16 +00:00
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
if( $pager->getNumRows() ) {
|
|
|
|
|
$navigation = '';
|
|
|
|
|
if ( $this->showNavigation ) $navigation = $pager->getNavigationBar();
|
|
|
|
|
$wgOut->addHTML( $navigation . $pager->getBody() . $navigation );
|
|
|
|
|
} else {
|
|
|
|
|
$wgOut->addWikiMsg( 'specialpage-empty' );
|
2008-04-30 23:49:28 +00:00
|
|
|
}
|
2008-05-11 21:43:16 +00:00
|
|
|
}
|
2008-04-15 20:42:42 +00:00
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
protected function filterLinks() {
|
|
|
|
|
global $wgGroupPermissions, $wgUser;
|
2008-04-15 20:42:42 +00:00
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
// show/hide links
|
|
|
|
|
$showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
|
2007-11-01 16:18:17 +00:00
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
// Option value -> message mapping
|
|
|
|
|
$filters = array(
|
|
|
|
|
'hideliu' => 'rcshowhideliu',
|
|
|
|
|
'hidepatrolled' => 'rcshowhidepatr',
|
2008-11-02 22:58:35 +00:00
|
|
|
'hidebots' => 'rcshowhidebots',
|
2008-11-03 18:23:42 +00:00
|
|
|
'hideredirs' => 'whatlinkshere-hideredirs'
|
2008-05-11 21:43:16 +00:00
|
|
|
);
|
2008-04-15 20:42:42 +00:00
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
// Disable some if needed
|
|
|
|
|
if ( $wgGroupPermissions['*']['createpage'] !== true )
|
2008-05-13 06:20:03 +00:00
|
|
|
unset($filters['hideliu']);
|
2008-04-13 19:57:12 +00:00
|
|
|
|
2008-05-14 11:11:56 +00:00
|
|
|
if ( !$wgUser->useNPPatrol() )
|
2008-05-13 03:59:42 +00:00
|
|
|
unset($filters['hidepatrolled']);
|
2008-04-13 19:57:12 +00:00
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
$links = array();
|
|
|
|
|
$changed = $this->opts->getChangedValues();
|
|
|
|
|
unset($changed['offset']); // Reset offset if query type changes
|
|
|
|
|
|
2008-06-18 20:45:10 +00:00
|
|
|
$self = $this->getTitle();
|
2008-05-11 21:43:16 +00:00
|
|
|
foreach ( $filters as $key => $msg ) {
|
|
|
|
|
$onoff = 1 - $this->opts->getValue($key);
|
2008-11-02 22:58:35 +00:00
|
|
|
$link = $this->skin->link( $self, $showhide[$onoff], array(),
|
|
|
|
|
array( $key => $onoff ) + $changed
|
2008-04-16 15:12:44 +00:00
|
|
|
);
|
2008-05-11 21:43:16 +00:00
|
|
|
$links[$key] = wfMsgHtml( $msg, $link );
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
2008-05-11 21:43:16 +00:00
|
|
|
|
2008-09-18 17:11:51 +00:00
|
|
|
return implode( ' | ', $links );
|
2008-05-11 21:43:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function form() {
|
|
|
|
|
global $wgOut, $wgEnableNewpagesUserFilter, $wgScript;
|
|
|
|
|
|
|
|
|
|
// Consume values
|
2008-05-11 21:55:43 +00:00
|
|
|
$this->opts->consumeValue( 'offset' ); // don't carry offset, DWIW
|
2008-05-11 21:43:16 +00:00
|
|
|
$namespace = $this->opts->consumeValue( 'namespace' );
|
|
|
|
|
$username = $this->opts->consumeValue( 'username' );
|
|
|
|
|
|
|
|
|
|
// Check username input validity
|
|
|
|
|
$ut = Title::makeTitleSafe( NS_USER, $username );
|
|
|
|
|
$userText = $ut ? $ut->getText() : '';
|
|
|
|
|
|
|
|
|
|
// Store query values in hidden fields so that form submission doesn't lose them
|
|
|
|
|
$hidden = array();
|
|
|
|
|
foreach ( $this->opts->getUnconsumedValues() as $key => $value ) {
|
|
|
|
|
$hidden[] = Xml::hidden( $key, $value );
|
|
|
|
|
}
|
|
|
|
|
$hidden = implode( "\n", $hidden );
|
|
|
|
|
|
|
|
|
|
$form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) .
|
2008-06-18 20:45:10 +00:00
|
|
|
Xml::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
|
2008-05-11 21:43:16 +00:00
|
|
|
Xml::fieldset( wfMsg( 'newpages' ) ) .
|
|
|
|
|
Xml::openElement( 'table', array( 'id' => 'mw-newpages-table' ) ) .
|
|
|
|
|
"<tr>
|
|
|
|
|
<td class='mw-label'>" .
|
|
|
|
|
Xml::label( wfMsg( 'namespace' ), 'namespace' ) .
|
|
|
|
|
"</td>
|
|
|
|
|
<td class='mw-input'>" .
|
|
|
|
|
Xml::namespaceSelector( $namespace, 'all' ) .
|
|
|
|
|
"</td>
|
|
|
|
|
</tr>" .
|
|
|
|
|
($wgEnableNewpagesUserFilter ?
|
|
|
|
|
"<tr>
|
|
|
|
|
<td class='mw-label'>" .
|
|
|
|
|
Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) .
|
|
|
|
|
"</td>
|
|
|
|
|
<td class='mw-input'>" .
|
|
|
|
|
Xml::input( 'username', 30, $userText, array( 'id' => 'mw-np-username' ) ) .
|
|
|
|
|
"</td>
|
|
|
|
|
</tr>" : "" ) .
|
|
|
|
|
"<tr> <td></td>
|
|
|
|
|
<td class='mw-submit'>" .
|
|
|
|
|
Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .
|
|
|
|
|
"</td>
|
|
|
|
|
</tr>" .
|
|
|
|
|
"<tr>
|
|
|
|
|
<td></td>
|
|
|
|
|
<td class='mw-input'>" .
|
|
|
|
|
$this->filterLinks() .
|
|
|
|
|
"</td>
|
|
|
|
|
</tr>" .
|
|
|
|
|
Xml::closeElement( 'table' ) .
|
|
|
|
|
Xml::closeElement( 'fieldset' ) .
|
|
|
|
|
$hidden .
|
|
|
|
|
Xml::closeElement( 'form' );
|
|
|
|
|
|
|
|
|
|
$wgOut->addHTML( $form );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function setSyndicated() {
|
|
|
|
|
global $wgOut;
|
|
|
|
|
$queryParams = array(
|
|
|
|
|
'namespace' => $this->opts->getValue( 'namespace' ),
|
|
|
|
|
'username' => $this->opts->getValue( 'username' )
|
|
|
|
|
);
|
|
|
|
|
$wgOut->setSyndicated( true );
|
|
|
|
|
$wgOut->setFeedAppendQuery( wfArrayToCGI( $queryParams ) );
|
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-08-25 09:44:20 +00:00
|
|
|
$title = Title::makeTitleSafe( $result->rc_namespace, $result->rc_title );
|
2008-04-13 19:57:12 +00:00
|
|
|
$time = $wgLang->timeAndDate( $result->rc_timestamp, true );
|
2008-05-11 21:43:16 +00:00
|
|
|
$plink = $this->skin->makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rc_id : '' );
|
|
|
|
|
$hist = $this->skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
|
2008-04-14 07:45:50 +00:00
|
|
|
$length = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
|
2008-05-11 21:43:16 +00:00
|
|
|
$wgLang->formatNum( $result->length ) );
|
|
|
|
|
$ulink = $this->skin->userLink( $result->rc_user, $result->rc_user_text ) . ' ' .
|
|
|
|
|
$this->skin->userToolLinks( $result->rc_user, $result->rc_user_text );
|
|
|
|
|
$comment = $this->skin->commentBlock( $result->rc_comment );
|
2008-05-14 06:43:16 +00:00
|
|
|
$css = $this->patrollable( $result ) ? " class='not-patrolled'" : '';
|
2008-04-13 19:57:12 +00:00
|
|
|
|
2008-05-14 06:43:16 +00:00
|
|
|
return "<li{$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
|
|
|
|
|
*/
|
2008-06-06 16:42:23 +00:00
|
|
|
protected function feed( $type ) {
|
2008-10-19 06:05:57 +00:00
|
|
|
global $wgFeed, $wgFeedClasses, $wgFeedLimit;
|
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
|
|
|
$feed = new $wgFeedClasses[$type](
|
|
|
|
|
$this->feedTitle(),
|
2008-12-19 08:54:51 +00:00
|
|
|
wfMsgExt( 'tagline', 'parsemag' ),
|
2008-06-18 20:45:10 +00:00
|
|
|
$this->getTitle()->getFullUrl() );
|
2008-04-13 19:57:12 +00:00
|
|
|
|
2008-05-11 21:43:16 +00:00
|
|
|
$pager = new NewPagesPager( $this, $this->opts );
|
2008-05-16 21:34:46 +00:00
|
|
|
$limit = $this->opts->getValue( 'limit' );
|
2008-10-19 06:05:57 +00:00
|
|
|
$pager->mLimit = min( $limit, $wgFeedLimit );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
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 ) {
|
2008-08-25 09:44:20 +00:00
|
|
|
$title = Title::MakeTitle( intval( $row->rc_namespace ), $row->rc_title );
|
2008-04-13 19:57:12 +00:00
|
|
|
if( $title ) {
|
|
|
|
|
$date = $row->rc_timestamp;
|
2008-06-05 14:20:59 +00:00
|
|
|
$comments = $title->getTalkPage()->getFullURL();
|
2008-04-13 19:57:12 +00:00
|
|
|
|
|
|
|
|
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-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() ) . ': ' .
|
2008-11-19 00:11:14 +00:00
|
|
|
htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
|
2008-05-05 03:35:37 +00:00
|
|
|
"</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 '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup SpecialPage Pager
|
2008-04-13 19:57:12 +00:00
|
|
|
*/
|
|
|
|
|
class NewPagesPager extends ReverseChronologicalPager {
|
2008-05-11 21:43:16 +00:00
|
|
|
// Stored opts
|
|
|
|
|
protected $opts, $mForm;
|
|
|
|
|
|
|
|
|
|
function __construct( $form, FormOptions $opts ) {
|
2008-04-13 19:57:12 +00:00
|
|
|
parent::__construct();
|
|
|
|
|
$this->mForm = $form;
|
2008-05-11 21:43:16 +00:00
|
|
|
$this->opts = $opts;
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
|
2008-10-17 01:31:12 +00:00
|
|
|
function getTitle() {
|
2008-05-11 21:43:16 +00:00
|
|
|
static $title = null;
|
|
|
|
|
if ( $title === null )
|
2008-06-18 20:45:10 +00:00
|
|
|
$title = $this->mForm->getTitle();
|
2008-05-11 21:43:16 +00:00
|
|
|
return $title;
|
2008-04-15 20:42:42 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
function getQueryInfo() {
|
2008-05-11 21:43:16 +00:00
|
|
|
global $wgEnableNewpagesUserFilter, $wgGroupPermissions, $wgUser;
|
|
|
|
|
$conds = array();
|
2008-04-13 19:57:12 +00:00
|
|
|
$conds['rc_new'] = 1;
|
2008-05-11 21:43:16 +00:00
|
|
|
|
|
|
|
|
$namespace = $this->opts->getValue( 'namespace' );
|
|
|
|
|
$namespace = ( $namespace === 'all' ) ? false : intval( $namespace );
|
|
|
|
|
|
|
|
|
|
$username = $this->opts->getValue( 'username' );
|
|
|
|
|
$user = Title::makeTitleSafe( NS_USER, $username );
|
|
|
|
|
|
|
|
|
|
if( $namespace !== false ) {
|
2008-08-25 09:44:20 +00:00
|
|
|
$conds['rc_namespace'] = $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';
|
2008-11-02 22:58:35 +00:00
|
|
|
|
2008-05-13 03:59:42 +00:00
|
|
|
# $wgEnableNewpagesUserFilter - temp WMF hack
|
|
|
|
|
if( $wgEnableNewpagesUserFilter && $user ) {
|
2008-05-11 21:43:16 +00:00
|
|
|
$conds['rc_user_text'] = $user->getText();
|
2008-05-13 03:59:42 +00:00
|
|
|
$rcIndexes = 'rc_user_text';
|
|
|
|
|
# If anons cannot make new pages, don't "exclude logged in users"!
|
|
|
|
|
} elseif( $wgGroupPermissions['*']['createpage'] && $this->opts->getValue( 'hideliu' ) ) {
|
|
|
|
|
$conds['rc_user'] = 0;
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
# If this user cannot see patrolled edits or they are off, don't do dumb queries!
|
2008-05-11 21:43:16 +00:00
|
|
|
if( $this->opts->getValue( 'hidepatrolled' ) && $wgUser->useNPPatrol() ) {
|
2008-04-13 19:57:12 +00:00
|
|
|
$conds['rc_patrolled'] = 0;
|
|
|
|
|
}
|
2008-05-11 21:43:16 +00:00
|
|
|
if( $this->opts->getValue( 'hidebots' ) ) {
|
2008-04-13 19:57:12 +00:00
|
|
|
$conds['rc_bot'] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-02 22:58:35 +00:00
|
|
|
if ( $this->opts->getValue( 'hideredirs' ) ) {
|
|
|
|
|
$conds['page_is_redirect'] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-13 19:57:12 +00:00
|
|
|
return array(
|
|
|
|
|
'tables' => array( 'recentchanges', 'page' ),
|
2008-08-25 09:44:20 +00:00
|
|
|
'fields' => 'rc_namespace,rc_title, rc_cur_id, rc_user,rc_user_text,rc_comment,
|
2008-04-13 19:57:12 +00:00
|
|
|
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 );
|
2008-08-25 09:44:20 +00:00
|
|
|
$linkBatch->add( $row->rc_namespace, $row->rc_title );
|
2008-04-13 19:57:12 +00:00
|
|
|
}
|
|
|
|
|
$linkBatch->execute();
|
|
|
|
|
return "<ul>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getEndBody() {
|
|
|
|
|
return "</ul>";
|
2006-04-21 06:49:23 +00:00
|
|
|
}
|
2008-02-10 10:05:49 +00:00
|
|
|
}
|