Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -889,26 +889,26 @@ |
890 | 890 | return array(); |
891 | 891 | } |
892 | 892 | |
893 | | - if ( strpos( $code, '/' ) === false ) { |
894 | | - $txt = MessageCache::singleton()->get( 'Conversiontable', true, $code ); |
895 | | - if ( $txt === false ) { |
896 | | - # @todo FIXME: This method doesn't seem to be expecting |
897 | | - # this possible outcome... |
898 | | - $txt = '<Conversiontable>'; |
899 | | - } |
| 893 | + $parsed[$key] = true; |
| 894 | + |
| 895 | + if ( $subpage === '' ) { |
| 896 | + $txt = MessageCache::singleton()->get( 'conversiontable', true, $code ); |
900 | 897 | } else { |
901 | | - $title = Title::makeTitleSafe( |
902 | | - NS_MEDIAWIKI, |
903 | | - "Conversiontable/$code" |
904 | | - ); |
| 898 | + $txt = false; |
| 899 | + $title = Title::makeTitleSafe( NS_MEDIAWIKI, $key ); |
905 | 900 | if ( $title && $title->exists() ) { |
906 | | - $article = new Article( $title ); |
907 | | - $txt = $article->getContents(); |
908 | | - } else { |
909 | | - $txt = ''; |
| 901 | + $revision = Revision::newFromTitle( $title ); |
| 902 | + if ( $revision ) { |
| 903 | + $txt = $revision->getRawText(); |
| 904 | + } |
910 | 905 | } |
911 | 906 | } |
912 | 907 | |
| 908 | + # Nothing to parse if there's no text |
| 909 | + if ( $txt === false || $txt === null || $txt === '' ) { |
| 910 | + return array(); |
| 911 | + } |
| 912 | + |
913 | 913 | // get all subpage links of the form |
914 | 914 | // [[MediaWiki:Conversiontable/zh-xx/...|...]] |
915 | 915 | $linkhead = $this->mLangObj->getNsText( NS_MEDIAWIKI ) . |
— | — | @@ -957,7 +957,6 @@ |
958 | 958 | $ret[trim( $m[0] )] = trim( $tt[0] ); |
959 | 959 | } |
960 | 960 | } |
961 | | - $parsed[$key] = true; |
962 | 961 | |
963 | 962 | // recursively parse the subpages |
964 | 963 | if ( $recursive ) { |