[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/specials/ -> SpecialWantedpages.php (source)

   1  <?php
   2  /**
   3   * Implements Special:Wantedpages
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License along
  16   * with this program; if not, write to the Free Software Foundation, Inc.,
  17   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18   * http://www.gnu.org/copyleft/gpl.html
  19   *
  20   * @file
  21   * @ingroup SpecialPage
  22   */
  23  
  24  /**
  25   * A special page that lists most linked pages that does not exist
  26   *
  27   * @ingroup SpecialPage
  28   */
  29  class WantedPagesPage extends WantedQueryPage {
  30  
  31  	function __construct( $name = 'Wantedpages' ) {
  32          parent::__construct( $name );
  33      }
  34  
  35  	function isIncludable() {
  36          return true;
  37      }
  38  
  39  	function execute( $par ) {
  40          $inc = $this->including();
  41  
  42          if ( $inc ) {
  43              $parts = explode( '/', $par, 2 );
  44              $this->limit = (int)$parts[0];
  45              // @todo FIXME: nlinks is ignored
  46              //$nlinks = isset( $parts[1] ) && $parts[1] === 'nlinks';
  47              $this->offset = 0;
  48          } else {
  49              //$nlinks = true;
  50          }
  51          $this->setListoutput( $inc );
  52          $this->shownavigation = !$inc;
  53          parent::execute( $par );
  54      }
  55  
  56  	function getQueryInfo() {
  57          $count = $this->getConfig()->get( 'WantedPagesThreshold' ) - 1;
  58          $query = array(
  59              'tables' => array(
  60                  'pagelinks',
  61                  'pg1' => 'page',
  62                  'pg2' => 'page'
  63              ),
  64              'fields' => array(
  65                  'namespace' => 'pl_namespace',
  66                  'title' => 'pl_title',
  67                  'value' => 'COUNT(*)'
  68              ),
  69              'conds' => array(
  70                  'pg1.page_namespace IS NULL',
  71                  "pl_namespace NOT IN ( '" . NS_USER . "', '" . NS_USER_TALK . "' )",
  72                  "pg2.page_namespace != '" . NS_MEDIAWIKI . "'"
  73              ),
  74              'options' => array(
  75                  'HAVING' => "COUNT(*) > $count",
  76                  'GROUP BY' => array( 'pl_namespace', 'pl_title' )
  77              ),
  78              'join_conds' => array(
  79                  'pg1' => array(
  80                      'LEFT JOIN', array(
  81                          'pg1.page_namespace = pl_namespace',
  82                          'pg1.page_title = pl_title'
  83                      )
  84                  ),
  85                  'pg2' => array( 'LEFT JOIN', 'pg2.page_id = pl_from' )
  86              )
  87          );
  88          // Replacement for the WantedPages::getSQL hook
  89          wfRunHooks( 'WantedPages::getQueryInfo', array( &$this, &$query ) );
  90  
  91          return $query;
  92      }
  93  
  94  	protected function getGroupName() {
  95          return 'maintenance';
  96      }
  97  }


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1