MediaWiki  REL1_22
SpecialWithoutinterwiki.php
Go to the documentation of this file.
00001 <?php
00030 class WithoutInterwikiPage extends PageQueryPage {
00031     private $prefix = '';
00032 
00033     function __construct( $name = 'Withoutinterwiki' ) {
00034         parent::__construct( $name );
00035     }
00036 
00037     function execute( $par ) {
00038         $this->prefix = Title::capitalize(
00039             $this->getRequest()->getVal( 'prefix', $par ), NS_MAIN );
00040         parent::execute( $par );
00041     }
00042 
00043     function getPageHeader() {
00044         global $wgScript;
00045 
00046         # Do not show useless input form if special page is cached
00047         if ( $this->isCached() ) {
00048             return '';
00049         }
00050 
00051         $prefix = $this->prefix;
00052         $t = $this->getTitle();
00053 
00054         return Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . "\n" .
00055             Html::openElement( 'fieldset' ) . "\n" .
00056             Html::element( 'legend', null, $this->msg( 'withoutinterwiki-legend' )->text() ) . "\n" .
00057             Html::hidden( 'title', $t->getPrefixedText() ) . "\n" .
00058             Xml::inputLabel( $this->msg( 'allpagesprefix' )->text(), 'prefix', 'wiprefix', 20, $prefix ) . "\n" .
00059             Xml::submitButton( $this->msg( 'withoutinterwiki-submit' )->text() ) . "\n" .
00060             Html::closeElement( 'fieldset' ) . "\n" .
00061             Html::closeElement( 'form' );
00062     }
00063 
00064     function sortDescending() {
00065         return false;
00066     }
00067 
00068     function getOrderFields() {
00069         return array( 'page_namespace', 'page_title' );
00070     }
00071 
00072     function isExpensive() {
00073         return true;
00074     }
00075 
00076     function isSyndicated() {
00077         return false;
00078     }
00079 
00080     function getQueryInfo() {
00081         $query = array(
00082             'tables' => array( 'page', 'langlinks' ),
00083             'fields' => array( 'namespace' => 'page_namespace',
00084                     'title' => 'page_title',
00085                     'value' => 'page_title' ),
00086             'conds' => array( 'll_title IS NULL',
00087                     'page_namespace' => MWNamespace::getContentNamespaces(),
00088                     'page_is_redirect' => 0 ),
00089             'join_conds' => array( 'langlinks' => array(
00090                     'LEFT JOIN', 'll_from = page_id' ) )
00091         );
00092         if ( $this->prefix ) {
00093             $dbr = wfGetDB( DB_SLAVE );
00094             $query['conds'][] = 'page_title ' . $dbr->buildLike( $this->prefix, $dbr->anyString() );
00095         }
00096         return $query;
00097     }
00098 
00099     protected function getGroupName() {
00100         return 'maintenance';
00101     }
00102 }