Index: trunk/phase3/includes/Article.php |
— | — | @@ -574,20 +574,6 @@ |
575 | 575 | return $titleObj !== NULL; |
576 | 576 | } |
577 | 577 | |
578 | | - function isDisambig() { |
579 | | - global $wgParser; |
580 | | - $this->loadContent(); |
581 | | - $output = $wgParser->parse( $this->fetchContent(), $this->mTitle, new ParserOptions() ); |
582 | | - $templates = $output->getTemplates(); |
583 | | - $disambigs = wfGetDisambiguationTemplates(); |
584 | | - if( isset( $templates[NS_TEMPLATE] ) ) |
585 | | - foreach( $templates[NS_TEMPLATE] as $dbk => $id ) |
586 | | - foreach( $disambigs as $disambig ) |
587 | | - if( $disambig->getDBkey() == $dbk ) |
588 | | - return true; |
589 | | - return false; |
590 | | - } |
591 | | - |
592 | 578 | /** |
593 | 579 | * Returns true if the currently-referenced revision is the current edit |
594 | 580 | * to this page (and it exists). |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2967,38 +2967,3 @@ |
2968 | 2968 | $name = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $name ); |
2969 | 2969 | return $name; |
2970 | 2970 | } |
2971 | | - |
2972 | | -/** |
2973 | | - * Fetches all disambiguation templates from MediaWiki:Disambiguationspage |
2974 | | - */ |
2975 | | -function wfGetDisambiguationTemplates() { |
2976 | | - static $templates = null; |
2977 | | - if( $templates ) |
2978 | | - return $templates; |
2979 | | - $msgText = wfMsgForContent('disambiguationspage'); |
2980 | | - $templates = array(); |
2981 | | - |
2982 | | - # If the text can be treated as a title, use it verbatim. |
2983 | | - # Otherwise, pull the titles from the links table |
2984 | | - $dp = Title::newFromText($msgText); |
2985 | | - if( $dp ) { |
2986 | | - if($dp->getNamespace() != NS_TEMPLATE) { |
2987 | | - # FIXME we assume the disambiguation message is a template but |
2988 | | - # the page can potentially be from another namespace :/ |
2989 | | - wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n"); |
2990 | | - } |
2991 | | - $templates [] = $dp; |
2992 | | - } else { |
2993 | | - # Get all the templates linked from the Mediawiki:Disambiguationspage |
2994 | | - # Originally used database, now uses parser |
2995 | | - global $wgParser; |
2996 | | - $output = $wgParser->parse( $msgText, |
2997 | | - Title::makeTitle( NS_MEDIAWIKI, 'Disambiguationspage' ), new ParserOptions() ); |
2998 | | - $links = $output->getLinks(); |
2999 | | - if( isset( $links[NS_TEMPLATE] ) ) |
3000 | | - foreach( $links[NS_TEMPLATE] as $dbk => $id ) |
3001 | | - if( $id ) |
3002 | | - $templates[] = Title::makeTitle( NS_TEMPLATE, $dbk ); |
3003 | | - } |
3004 | | - return $templates; |
3005 | | -} |
Index: trunk/phase3/includes/specials/SpecialDisambiguations.php |
— | — | @@ -24,10 +24,37 @@ |
25 | 25 | function getSQL() { |
26 | 26 | $dbr = wfGetDB( DB_SLAVE ); |
27 | 27 | |
| 28 | + $dMsgText = wfMsgForContent('disambiguationspage'); |
| 29 | + |
28 | 30 | $linkBatch = new LinkBatch; |
29 | | - foreach( wfGetDisambiguationTemplates() as $tl ) |
30 | | - $linkBatch->addObj( $tl ); |
31 | 31 | |
| 32 | + # If the text can be treated as a title, use it verbatim. |
| 33 | + # Otherwise, pull the titles from the links table |
| 34 | + $dp = Title::newFromText($dMsgText); |
| 35 | + if( $dp ) { |
| 36 | + if($dp->getNamespace() != NS_TEMPLATE) { |
| 37 | + # FIXME we assume the disambiguation message is a template but |
| 38 | + # the page can potentially be from another namespace :/ |
| 39 | + wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n"); |
| 40 | + } |
| 41 | + $linkBatch->addObj( $dp ); |
| 42 | + } else { |
| 43 | + # Get all the templates linked from the Mediawiki:Disambiguationspage |
| 44 | + $disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' ); |
| 45 | + $res = $dbr->select( |
| 46 | + array('pagelinks', 'page'), |
| 47 | + 'pl_title', |
| 48 | + array('page_id = pl_from', 'pl_namespace' => NS_TEMPLATE, |
| 49 | + 'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()), |
| 50 | + __METHOD__ ); |
| 51 | + |
| 52 | + while ( $row = $dbr->fetchObject( $res ) ) { |
| 53 | + $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title )); |
| 54 | + } |
| 55 | + |
| 56 | + $dbr->freeResult( $res ); |
| 57 | + } |
| 58 | + |
32 | 59 | $set = $linkBatch->constructSet( 'lb.tl', $dbr ); |
33 | 60 | if( $set === false ) { |
34 | 61 | # We must always return a valid sql query, but this way DB will always quicly return an empty result |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -660,7 +660,6 @@ |
661 | 661 | } |
662 | 662 | |
663 | 663 | function getPageClasses( $title ) { |
664 | | - global $wgArticle; |
665 | 664 | $numeric = 'ns-'.$title->getNamespace(); |
666 | 665 | if( $title->getNamespace() == NS_SPECIAL ) { |
667 | 666 | $type = "ns-special"; |
— | — | @@ -670,11 +669,7 @@ |
671 | 670 | $type = "ns-subject"; |
672 | 671 | } |
673 | 672 | $name = Sanitizer::escapeClass( 'page-'.$title->getPrefixedText() ); |
674 | | - if( $wgArticle && $wgArticle->isDisambig() ) |
675 | | - $disambig = ' disambiguationpage'; |
676 | | - else |
677 | | - $disambig = ''; |
678 | | - return "{$numeric} {$type} {$name}{$disambig}"; |
| 673 | + return "$numeric $type $name"; |
679 | 674 | } |
680 | 675 | |
681 | 676 | /** |