MediaWiki  REL1_24
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         # Do not show useless input form if special page is cached
00045         if ( $this->isCached() ) {
00046             return '';
00047         }
00048 
00049         $prefix = $this->prefix;
00050         $t = $this->getPageTitle();
00051 
00052         return Html::openElement( 'form', array( 'method' => 'get', 'action' => wfScript() ) ) . "\n" .
00053             Html::openElement( 'fieldset' ) . "\n" .
00054             Html::element( 'legend', null, $this->msg( 'withoutinterwiki-legend' )->text() ) . "\n" .
00055             Html::hidden( 'title', $t->getPrefixedText() ) . "\n" .
00056             Xml::inputLabel(
00057                 $this->msg( 'allpagesprefix' )->text(),
00058                 'prefix',
00059                 'wiprefix',
00060                 20,
00061                 $prefix
00062             ) . "\n" .
00063             Xml::submitButton( $this->msg( 'withoutinterwiki-submit' )->text() ) . "\n" .
00064             Html::closeElement( 'fieldset' ) . "\n" .
00065             Html::closeElement( 'form' );
00066     }
00067 
00068     function sortDescending() {
00069         return false;
00070     }
00071 
00072     function getOrderFields() {
00073         return array( 'page_namespace', 'page_title' );
00074     }
00075 
00076     function isExpensive() {
00077         return true;
00078     }
00079 
00080     function isSyndicated() {
00081         return false;
00082     }
00083 
00084     function getQueryInfo() {
00085         $query = array(
00086             'tables' => array( 'page', 'langlinks' ),
00087             'fields' => array(
00088                 'namespace' => 'page_namespace',
00089                 'title' => 'page_title',
00090                 'value' => 'page_title'
00091             ),
00092             'conds' => array(
00093                 'll_title IS NULL',
00094                 'page_namespace' => MWNamespace::getContentNamespaces(),
00095                 'page_is_redirect' => 0
00096             ),
00097             'join_conds' => array( 'langlinks' => array( 'LEFT JOIN', 'll_from = page_id' ) )
00098         );
00099         if ( $this->prefix ) {
00100             $dbr = wfGetDB( DB_SLAVE );
00101             $query['conds'][] = 'page_title ' . $dbr->buildLike( $this->prefix, $dbr->anyString() );
00102         }
00103 
00104         return $query;
00105     }
00106 
00107     protected function getGroupName() {
00108         return 'maintenance';
00109     }
00110 }