MediaWiki  REL1_19
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                 $this->mIncludable = true;
00034         }
00035 
00036         function execute( $par ) {
00037                 $inc = $this->including();
00038 
00039                 if ( $inc ) {
00040                         $parts = explode( '/', $par, 2 );
00041                         $this->limit = (int)$parts[0];
00042                         // @todo FIXME: nlinks is ignored
00043                         //$nlinks = isset( $parts[1] ) && $parts[1] === 'nlinks';
00044                         $this->offset = 0;
00045                 } else {
00046                         //$nlinks = true;
00047                 }
00048                 $this->setListoutput( $inc );
00049                 $this->shownavigation = !$inc;
00050                 parent::execute( $par );
00051         }
00052 
00053         function getQueryInfo() {
00054                 global $wgWantedPagesThreshold;
00055                 $count = $wgWantedPagesThreshold - 1;
00056                 $query = array(
00057                         'tables' => array(
00058                                 'pagelinks',
00059                                 'pg1' => 'page',
00060                                 'pg2' => 'page'
00061                         ),
00062                         'fields' => array(
00063                                 'pl_namespace AS namespace',
00064                                 'pl_title AS title',
00065                                 'COUNT(*) AS value'
00066                         ),
00067                         'conds' => array(
00068                                 'pg1.page_namespace IS NULL',
00069                                 "pl_namespace NOT IN ( '" . NS_USER .
00070                                         "', '" . NS_USER_TALK . "' )",
00071                                 "pg2.page_namespace != '" . NS_MEDIAWIKI . "'"
00072                         ),
00073                         'options' => array(
00074                                 'HAVING' => "COUNT(*) > $count",
00075                                 'GROUP BY' => 'pl_namespace, pl_title'
00076                         ),
00077                         'join_conds' => array(
00078                                 'pg1' => array(
00079                                         'LEFT JOIN', array(
00080                                                 'pg1.page_namespace = pl_namespace',
00081                                                 'pg1.page_title = pl_title'
00082                                         )
00083                                 ),
00084                                 'pg2' => array( 'LEFT JOIN', 'pg2.page_id = pl_from' )
00085                         )
00086                 );
00087                 // Replacement for the WantedPages::getSQL hook
00088                 wfRunHooks( 'WantedPages::getQueryInfo', array( &$this, &$query ) );
00089                 return $query;
00090         }
00091 }