00001 <?php
00013 class WithoutInterwikiPage extends PageQueryPage {
00014 private $prefix = '';
00015
00016 function getName() {
00017 return 'Withoutinterwiki';
00018 }
00019
00020 function getPageHeader() {
00021 global $wgScript, $wgMiserMode;
00022
00023 # Do not show useless input form if wiki is running in misermode
00024 if( $wgMiserMode ) {
00025 return '';
00026 }
00027
00028 $prefix = $this->prefix;
00029 $t = SpecialPage::getTitleFor( $this->getName() );
00030
00031 return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
00032 Xml::openElement( 'fieldset' ) .
00033 Xml::element( 'legend', null, wfMsg( 'withoutinterwiki-legend' ) ) .
00034 Xml::hidden( 'title', $t->getPrefixedText() ) .
00035 Xml::inputLabel( wfMsg( 'allpagesprefix' ), 'prefix', 'wiprefix', 20, $prefix ) . ' ' .
00036 Xml::submitButton( wfMsg( 'withoutinterwiki-submit' ) ) .
00037 Xml::closeElement( 'fieldset' ) .
00038 Xml::closeElement( 'form' );
00039 }
00040
00041 function sortDescending() {
00042 return false;
00043 }
00044
00045 function isExpensive() {
00046 return true;
00047 }
00048
00049 function isSyndicated() {
00050 return false;
00051 }
00052
00053 function getSQL() {
00054 $dbr = wfGetDB( DB_SLAVE );
00055 list( $page, $langlinks ) = $dbr->tableNamesN( 'page', 'langlinks' );
00056 $prefix = $this->prefix ? 'AND page_title' . $dbr->buildLike( $this->prefix , $dbr->anyString() ) : '';
00057 return
00058 "SELECT 'Withoutinterwiki' AS type,
00059 page_namespace AS namespace,
00060 page_title AS title,
00061 page_title AS value
00062 FROM $page
00063 LEFT JOIN $langlinks
00064 ON ll_from = page_id
00065 WHERE ll_title IS NULL
00066 AND page_namespace=" . NS_MAIN . "
00067 AND page_is_redirect = 0
00068 {$prefix}";
00069 }
00070
00071 function setPrefix( $prefix = '' ) {
00072 $this->prefix = $prefix;
00073 }
00074
00075 }
00076
00077 function wfSpecialWithoutinterwiki() {
00078 global $wgRequest, $wgContLang;
00079 list( $limit, $offset ) = wfCheckLimits();
00080
00081 $prefix = Title::capitalize( $wgRequest->getVal( 'prefix' ), NS_MAIN );
00082 $wip = new WithoutInterwikiPage();
00083 $wip->setPrefix( $prefix );
00084 $wip->doQuery( $offset, $limit );
00085 }