MediaWiki  REL1_23
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->getPageTitle();
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(
00059                 $this->msg( 'allpagesprefix' )->text(),
00060                 'prefix',
00061                 'wiprefix',
00062                 20,
00063                 $prefix
00064             ) . "\n" .
00065             Xml::submitButton( $this->msg( 'withoutinterwiki-submit' )->text() ) . "\n" .
00066             Html::closeElement( 'fieldset' ) . "\n" .
00067             Html::closeElement( 'form' );
00068     }
00069 
00070     function sortDescending() {
00071         return false;
00072     }
00073 
00074     function getOrderFields() {
00075         return array( 'page_namespace', 'page_title' );
00076     }
00077 
00078     function isExpensive() {
00079         return true;
00080     }
00081 
00082     function isSyndicated() {
00083         return false;
00084     }
00085 
00086     function getQueryInfo() {
00087         $query = array(
00088             'tables' => array( 'page', 'langlinks' ),
00089             'fields' => array(
00090                 'namespace' => 'page_namespace',
00091                 'title' => 'page_title',
00092                 'value' => 'page_title'
00093             ),
00094             'conds' => array(
00095                 'll_title IS NULL',
00096                 'page_namespace' => MWNamespace::getContentNamespaces(),
00097                 'page_is_redirect' => 0
00098             ),
00099             'join_conds' => array( 'langlinks' => array( 'LEFT JOIN', 'll_from = page_id' ) )
00100         );
00101         if ( $this->prefix ) {
00102             $dbr = wfGetDB( DB_SLAVE );
00103             $query['conds'][] = 'page_title ' . $dbr->buildLike( $this->prefix, $dbr->anyString() );
00104         }
00105 
00106         return $query;
00107     }
00108 
00109     protected function getGroupName() {
00110         return 'maintenance';
00111     }
00112 }