MediaWiki  REL1_19
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, $wgMiserMode;
00045 
00046                 # Do not show useless input form if wiki is running in misermode
00047                 if( $wgMiserMode ) {
00048                         return '';
00049                 }
00050 
00051                 $prefix = $this->prefix;
00052                 $t = $this->getTitle();
00053 
00054                 return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
00055                         Xml::openElement( 'fieldset' ) .
00056                         Xml::element( 'legend', null, wfMsg( 'withoutinterwiki-legend' ) ) .
00057                         Html::hidden( 'title', $t->getPrefixedText() ) .
00058                         Xml::inputLabel( wfMsg( 'allpagesprefix' ), 'prefix', 'wiprefix', 20, $prefix ) . ' ' .
00059                         Xml::submitButton( wfMsg( 'withoutinterwiki-submit' ) ) .
00060                         Xml::closeElement( 'fieldset' ) .
00061                         Xml::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 ( 'page_namespace AS namespace',
00084                                         'page_title AS title',
00085                                         'page_title AS value' ),
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 }