X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialNewpages.php;h=c24b0547506009127a5a1bd42dbe2f234856f960;hb=f459c1aecae38adfdb335b7704f7d97d1f42310d;hp=ab29d137943a57c7597053d947f5eb8aa5a8052f;hpb=d7bad7704f67dc887a77e4de7581931b7915d04b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index ab29d13794..c24b054750 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -479,130 +479,3 @@ class SpecialNewpages extends IncludableSpecialPage { return 'changes'; } } - -/** - * @ingroup SpecialPage Pager - */ -class NewPagesPager extends ReverseChronologicalPager { - // Stored opts - protected $opts; - - /** - * @var HtmlForm - */ - protected $mForm; - - function __construct( $form, FormOptions $opts ) { - parent::__construct( $form->getContext() ); - $this->mForm = $form; - $this->opts = $opts; - } - - function getQueryInfo() { - $conds = []; - $conds['rc_new'] = 1; - - $namespace = $this->opts->getValue( 'namespace' ); - $namespace = ( $namespace === 'all' ) ? false : intval( $namespace ); - - $username = $this->opts->getValue( 'username' ); - $user = Title::makeTitleSafe( NS_USER, $username ); - - $rcIndexes = []; - - if ( $namespace !== false ) { - if ( $this->opts->getValue( 'invert' ) ) { - $conds[] = 'rc_namespace != ' . $this->mDb->addQuotes( $namespace ); - } else { - $conds['rc_namespace'] = $namespace; - } - } - - if ( $user ) { - $conds['rc_user_text'] = $user->getText(); - $rcIndexes = 'rc_user_text'; - } elseif ( User::groupHasPermission( '*', 'createpage' ) && - $this->opts->getValue( 'hideliu' ) - ) { - # If anons cannot make new pages, don't "exclude logged in users"! - $conds['rc_user'] = 0; - } - - # If this user cannot see patrolled edits or they are off, don't do dumb queries! - if ( $this->opts->getValue( 'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) { - $conds['rc_patrolled'] = 0; - } - - if ( $this->opts->getValue( 'hidebots' ) ) { - $conds['rc_bot'] = 0; - } - - if ( $this->opts->getValue( 'hideredirs' ) ) { - $conds['page_is_redirect'] = 0; - } - - // Allow changes to the New Pages query - $tables = [ 'recentchanges', 'page' ]; - $fields = [ - 'rc_namespace', 'rc_title', 'rc_cur_id', 'rc_user', 'rc_user_text', - 'rc_comment', 'rc_timestamp', 'rc_patrolled', 'rc_id', 'rc_deleted', - 'length' => 'page_len', 'rev_id' => 'page_latest', 'rc_this_oldid', - 'page_namespace', 'page_title' - ]; - $join_conds = [ 'page' => [ 'INNER JOIN', 'page_id=rc_cur_id' ] ]; - - Hooks::run( 'SpecialNewpagesConditions', - [ &$this, $this->opts, &$conds, &$tables, &$fields, &$join_conds ] ); - - $options = []; - - if ( $rcIndexes ) { - $options = [ 'USE INDEX' => [ 'recentchanges' => $rcIndexes ] ]; - } - - $info = [ - 'tables' => $tables, - 'fields' => $fields, - 'conds' => $conds, - 'options' => $options, - 'join_conds' => $join_conds - ]; - - // Modify query for tags - ChangeTags::modifyDisplayQuery( - $info['tables'], - $info['fields'], - $info['conds'], - $info['join_conds'], - $info['options'], - $this->opts['tagfilter'] - ); - - return $info; - } - - function getIndexField() { - return 'rc_timestamp'; - } - - function formatRow( $row ) { - return $this->mForm->formatRow( $row ); - } - - function getStartBody() { - # Do a batch existence check on pages - $linkBatch = new LinkBatch(); - foreach ( $this->mResult as $row ) { - $linkBatch->add( NS_USER, $row->rc_user_text ); - $linkBatch->add( NS_USER_TALK, $row->rc_user_text ); - $linkBatch->add( $row->page_namespace, $row->page_title ); - } - $linkBatch->execute(); - - return ''; - } -}