MediaWiki  REL1_24
SpecialWantedpages.php
Go to the documentation of this file.
00001 <?php
00029 class WantedPagesPage extends WantedQueryPage {
00030 
00031     function __construct( $name = 'Wantedpages' ) {
00032         parent::__construct( $name );
00033     }
00034 
00035     function isIncludable() {
00036         return true;
00037     }
00038 
00039     function execute( $par ) {
00040         $inc = $this->including();
00041 
00042         if ( $inc ) {
00043             $parts = explode( '/', $par, 2 );
00044             $this->limit = (int)$parts[0];
00045             // @todo FIXME: nlinks is ignored
00046             //$nlinks = isset( $parts[1] ) && $parts[1] === 'nlinks';
00047             $this->offset = 0;
00048         } else {
00049             //$nlinks = true;
00050         }
00051         $this->setListoutput( $inc );
00052         $this->shownavigation = !$inc;
00053         parent::execute( $par );
00054     }
00055 
00056     function getQueryInfo() {
00057         $count = $this->getConfig()->get( 'WantedPagesThreshold' ) - 1;
00058         $query = array(
00059             'tables' => array(
00060                 'pagelinks',
00061                 'pg1' => 'page',
00062                 'pg2' => 'page'
00063             ),
00064             'fields' => array(
00065                 'namespace' => 'pl_namespace',
00066                 'title' => 'pl_title',
00067                 'value' => 'COUNT(*)'
00068             ),
00069             'conds' => array(
00070                 'pg1.page_namespace IS NULL',
00071                 "pl_namespace NOT IN ( '" . NS_USER . "', '" . NS_USER_TALK . "' )",
00072                 "pg2.page_namespace != '" . NS_MEDIAWIKI . "'"
00073             ),
00074             'options' => array(
00075                 'HAVING' => "COUNT(*) > $count",
00076                 'GROUP BY' => array( 'pl_namespace', 'pl_title' )
00077             ),
00078             'join_conds' => array(
00079                 'pg1' => array(
00080                     'LEFT JOIN', array(
00081                         'pg1.page_namespace = pl_namespace',
00082                         'pg1.page_title = pl_title'
00083                     )
00084                 ),
00085                 'pg2' => array( 'LEFT JOIN', 'pg2.page_id = pl_from' )
00086             )
00087         );
00088         // Replacement for the WantedPages::getSQL hook
00089         wfRunHooks( 'WantedPages::getQueryInfo', array( &$this, &$query ) );
00090 
00091         return $query;
00092     }
00093 
00094     protected function getGroupName() {
00095         return 'maintenance';
00096     }
00097 }