MediaWiki  REL1_23
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         global $wgWantedPagesThreshold;
00058         $count = $wgWantedPagesThreshold - 1;
00059         $query = array(
00060             'tables' => array(
00061                 'pagelinks',
00062                 'pg1' => 'page',
00063                 'pg2' => 'page'
00064             ),
00065             'fields' => array(
00066                 'namespace' => 'pl_namespace',
00067                 'title' => 'pl_title',
00068                 'value' => 'COUNT(*)'
00069             ),
00070             'conds' => array(
00071                 'pg1.page_namespace IS NULL',
00072                 "pl_namespace NOT IN ( '" . NS_USER . "', '" . NS_USER_TALK . "' )",
00073                 "pg2.page_namespace != '" . NS_MEDIAWIKI . "'"
00074             ),
00075             'options' => array(
00076                 'HAVING' => "COUNT(*) > $count",
00077                 'GROUP BY' => array( 'pl_namespace', 'pl_title' )
00078             ),
00079             'join_conds' => array(
00080                 'pg1' => array(
00081                     'LEFT JOIN', array(
00082                         'pg1.page_namespace = pl_namespace',
00083                         'pg1.page_title = pl_title'
00084                     )
00085                 ),
00086                 'pg2' => array( 'LEFT JOIN', 'pg2.page_id = pl_from' )
00087             )
00088         );
00089         // Replacement for the WantedPages::getSQL hook
00090         wfRunHooks( 'WantedPages::getQueryInfo', array( &$this, &$query ) );
00091 
00092         return $query;
00093     }
00094 
00095     protected function getGroupName() {
00096         return 'maintenance';
00097     }
00098 }