[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Implements Special:Withoutinterwiki
   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   * @author Rob Church <[email protected]>
  23   */
  24  
  25  /**
  26   * Special page lists pages without language links
  27   *
  28   * @ingroup SpecialPage
  29   */
  30  class WithoutInterwikiPage extends PageQueryPage {
  31      private $prefix = '';
  32  
  33  	function __construct( $name = 'Withoutinterwiki' ) {
  34          parent::__construct( $name );
  35      }
  36  
  37  	function execute( $par ) {
  38          $this->prefix = Title::capitalize(
  39              $this->getRequest()->getVal( 'prefix', $par ), NS_MAIN );
  40          parent::execute( $par );
  41      }
  42  
  43  	function getPageHeader() {
  44          # Do not show useless input form if special page is cached
  45          if ( $this->isCached() ) {
  46              return '';
  47          }
  48  
  49          $prefix = $this->prefix;
  50          $t = $this->getPageTitle();
  51  
  52          return Html::openElement( 'form', array( 'method' => 'get', 'action' => wfScript() ) ) . "\n" .
  53              Html::openElement( 'fieldset' ) . "\n" .
  54              Html::element( 'legend', null, $this->msg( 'withoutinterwiki-legend' )->text() ) . "\n" .
  55              Html::hidden( 'title', $t->getPrefixedText() ) . "\n" .
  56              Xml::inputLabel(
  57                  $this->msg( 'allpagesprefix' )->text(),
  58                  'prefix',
  59                  'wiprefix',
  60                  20,
  61                  $prefix
  62              ) . "\n" .
  63              Xml::submitButton( $this->msg( 'withoutinterwiki-submit' )->text() ) . "\n" .
  64              Html::closeElement( 'fieldset' ) . "\n" .
  65              Html::closeElement( 'form' );
  66      }
  67  
  68  	function sortDescending() {
  69          return false;
  70      }
  71  
  72  	function getOrderFields() {
  73          return array( 'page_namespace', 'page_title' );
  74      }
  75  
  76  	function isExpensive() {
  77          return true;
  78      }
  79  
  80  	function isSyndicated() {
  81          return false;
  82      }
  83  
  84  	function getQueryInfo() {
  85          $query = array(
  86              'tables' => array( 'page', 'langlinks' ),
  87              'fields' => array(
  88                  'namespace' => 'page_namespace',
  89                  'title' => 'page_title',
  90                  'value' => 'page_title'
  91              ),
  92              'conds' => array(
  93                  'll_title IS NULL',
  94                  'page_namespace' => MWNamespace::getContentNamespaces(),
  95                  'page_is_redirect' => 0
  96              ),
  97              'join_conds' => array( 'langlinks' => array( 'LEFT JOIN', 'll_from = page_id' ) )
  98          );
  99          if ( $this->prefix ) {
 100              $dbr = wfGetDB( DB_SLAVE );
 101              $query['conds'][] = 'page_title ' . $dbr->buildLike( $this->prefix, $dbr->anyString() );
 102          }
 103  
 104          return $query;
 105      }
 106  
 107  	protected function getGroupName() {
 108          return 'maintenance';
 109      }
 110  }


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