Index: branches/REL1_19/phase3/maintenance/parse.php |
— | — | @@ -14,8 +14,8 @@ |
15 | 15 | * |
16 | 16 | * Example2: |
17 | 17 | * @code |
18 | | - * $ echo "'''bold'''" > /tmp/foo |
19 | | - * $ php parse.php --file /tmp/foo |
| 18 | + * $ echo "'''bold'''" > /tmp/foo.txt |
| 19 | + * $ php parse.php /tmp/foo.txt |
20 | 20 | * <p><b>bold</b> |
21 | 21 | * </p>$ |
22 | 22 | * @endcode |
— | — | @@ -37,10 +37,10 @@ |
38 | 38 | protected $parser; |
39 | 39 | |
40 | 40 | public function __construct() { |
| 41 | + parent::__construct(); |
41 | 42 | $this->mDescription = "Parse a given wikitext"; |
42 | 43 | $this->addOption( 'title', 'Title name for the given wikitext (Default: \'CLIParser\')', false, true ); |
43 | | - $this->addOption( 'file', 'File containing wikitext (Default: stdin)', false, true ); |
44 | | - parent::__construct(); |
| 44 | + $this->addArg( 'file', 'File containing wikitext (Default: stdin)', false ); |
45 | 45 | } |
46 | 46 | |
47 | 47 | public function execute() { |
— | — | @@ -57,13 +57,19 @@ |
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | | - * Get wikitext from --file or from STDIN |
| 61 | + * Get wikitext from a the file passed as argument or STDIN |
62 | 62 | * @return string Wikitext |
63 | 63 | */ |
64 | 64 | protected function Wikitext() { |
65 | | - return file_get_contents( |
66 | | - $this->getOption( 'file', 'php://stdin' ) |
67 | | - ); |
| 65 | + |
| 66 | + $php_stdin = 'php://stdin'; |
| 67 | + $input_file = $this->getArg( 0, $php_stdin ); |
| 68 | + |
| 69 | + if( $input_file === $php_stdin ) { |
| 70 | + $this->error( basename(__FILE__) .": warning: reading wikitext from STDIN\n" ); |
| 71 | + } |
| 72 | + |
| 73 | + return file_get_contents( $input_file ); |
68 | 74 | } |
69 | 75 | |
70 | 76 | protected function initParser() { |
Index: branches/REL1_19/phase3/tests/phpunit/includes/BlockTest.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | $oldBlock->delete(); |
37 | 37 | } |
38 | 38 | |
39 | | - $this->block = new Block( 'UTBlockee', 1, 0, |
| 39 | + $this->block = new Block( 'UTBlockee', $user->getID(), 0, |
40 | 40 | 'Parce que', 0, false, time() + 100500 |
41 | 41 | ); |
42 | 42 | $this->madeAt = wfTimestamp( TS_MW ); |
Index: branches/REL1_19/phase3/tests/phpunit/includes/TitlePermissionTest.php |
— | — | @@ -629,7 +629,7 @@ |
630 | 630 | $prev = time(); |
631 | 631 | $now = time() + 120; |
632 | 632 | $this->user->mBlockedby = $this->user->getId(); |
633 | | - $this->user->mBlock = new Block( '127.0.8.1', $this->user->getId(), $this->user->getId(), |
| 633 | + $this->user->mBlock = new Block( '127.0.8.1', 0, $this->user->getId(), |
634 | 634 | 'no reason given', $prev + 3600, 1, 0 ); |
635 | 635 | $this->user->mBlock->mTimestamp = 0; |
636 | 636 | $this->assertEquals( array( array( 'autoblockedtext', |
— | — | @@ -646,7 +646,7 @@ |
647 | 647 | global $wgLocalTZoffset; |
648 | 648 | $wgLocalTZoffset = -60; |
649 | 649 | $this->user->mBlockedby = $this->user->getName(); |
650 | | - $this->user->mBlock = new Block( '127.0.8.1', 2, 1, 'no reason given', $now, 0, 10 ); |
| 650 | + $this->user->mBlock = new Block( '127.0.8.1', 0, 1, 'no reason given', $now, 0, 10 ); |
651 | 651 | $this->assertEquals( array( array( 'blockedtext', |
652 | 652 | '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1', |
653 | 653 | 'Useruser', null, '23:00, 31 December 1969', '127.0.8.1', |
Index: branches/REL1_19/phase3/includes/parser/Parser.php |
— | — | @@ -370,13 +370,16 @@ |
371 | 371 | */ |
372 | 372 | if ( !( $wgDisableLangConversion |
373 | 373 | || isset( $this->mDoubleUnderscores['nocontentconvert'] ) |
374 | | - || $this->mTitle->isConversionTable() |
375 | | - || $this->mOptions->getInterfaceMessage() ) ) { |
376 | | - |
377 | | - # The position of the convert() call should not be changed. it |
378 | | - # assumes that the links are all replaced and the only thing left |
379 | | - # is the <nowiki> mark. |
380 | | - $text = $this->getFunctionLang()->convert( $text ); |
| 374 | + || $this->mTitle->isConversionTable() ) ) |
| 375 | + { |
| 376 | + # Run convert unconditionally in 1.18-compatible mode |
| 377 | + global $wgBug34832TransitionalRollback; |
| 378 | + if ( $wgBug34832TransitionalRollback || !$this->mOptions->getInterfaceMessage() ) { |
| 379 | + # The position of the convert() call should not be changed. it |
| 380 | + # assumes that the links are all replaced and the only thing left |
| 381 | + # is the <nowiki> mark. |
| 382 | + $text = $this->getConverterLanguage()->convert( $text ); |
| 383 | + } |
381 | 384 | } |
382 | 385 | |
383 | 386 | /** |
— | — | @@ -392,11 +395,11 @@ |
393 | 396 | || isset( $this->mDoubleUnderscores['notitleconvert'] ) |
394 | 397 | || $this->mOutput->getDisplayTitle() !== false ) ) |
395 | 398 | { |
396 | | - $convruletitle = $this->getFunctionLang()->getConvRuleTitle(); |
| 399 | + $convruletitle = $this->getConverterLanguage()->getConvRuleTitle(); |
397 | 400 | if ( $convruletitle ) { |
398 | 401 | $this->mOutput->setTitleText( $convruletitle ); |
399 | 402 | } else { |
400 | | - $titleText = $this->getFunctionLang()->convertTitle( $title ); |
| 403 | + $titleText = $this->getConverterLanguage()->convertTitle( $title ); |
401 | 404 | $this->mOutput->setTitleText( $titleText ); |
402 | 405 | } |
403 | 406 | } |
— | — | @@ -692,9 +695,18 @@ |
693 | 696 | } |
694 | 697 | |
695 | 698 | /** |
| 699 | + * Get a language object for use in parser functions such as {{FORMATNUM:}} |
696 | 700 | * @return Language |
697 | 701 | */ |
698 | 702 | function getFunctionLang() { |
| 703 | + return $this->getTargetLanguage(); |
| 704 | + } |
| 705 | + |
| 706 | + /** |
| 707 | + * Get the target language for the content being parsed. This is usually the |
| 708 | + * language that the content is in. |
| 709 | + */ |
| 710 | + function getTargetLanguage() { |
699 | 711 | $target = $this->mOptions->getTargetLanguage(); |
700 | 712 | if ( $target !== null ) { |
701 | 713 | return $target; |
— | — | @@ -707,6 +719,18 @@ |
708 | 720 | } |
709 | 721 | |
710 | 722 | /** |
| 723 | + * Get the language object for language conversion |
| 724 | + */ |
| 725 | + function getConverterLanguage() { |
| 726 | + global $wgBug34832TransitionalRollback, $wgContLang; |
| 727 | + if ( $wgBug34832TransitionalRollback ) { |
| 728 | + return $wgContLang; |
| 729 | + } else { |
| 730 | + return $this->getTargetLanguage(); |
| 731 | + } |
| 732 | + } |
| 733 | + |
| 734 | + /** |
711 | 735 | * Get a User object either from $this->mUser, if set, or from the |
712 | 736 | * ParserOptions object otherwise |
713 | 737 | * |
— | — | @@ -1225,7 +1249,8 @@ |
1226 | 1250 | $text = $this->maybeMakeExternalImage( $url ); |
1227 | 1251 | if ( $text === false ) { |
1228 | 1252 | # Not an image, make a link |
1229 | | - $text = Linker::makeExternalLink( $url, $this->getFunctionLang()->markNoConversion($url), true, 'free', |
| 1253 | + $text = Linker::makeExternalLink( $url, |
| 1254 | + $this->getConverterLanguage()->markNoConversion($url), true, 'free', |
1230 | 1255 | $this->getExternalLinkAttribs( $url ) ); |
1231 | 1256 | # Register it in the output object... |
1232 | 1257 | # Replace unnecessary URL escape codes with their equivalent characters |
— | — | @@ -1489,7 +1514,7 @@ |
1490 | 1515 | # No link text, e.g. [http://domain.tld/some.link] |
1491 | 1516 | if ( $text == '' ) { |
1492 | 1517 | # Autonumber |
1493 | | - $langObj = $this->getFunctionLang(); |
| 1518 | + $langObj = $this->getTargetLanguage(); |
1494 | 1519 | $text = '[' . $langObj->formatNum( ++$this->mAutonumber ) . ']'; |
1495 | 1520 | $linktype = 'autonumber'; |
1496 | 1521 | } else { |
— | — | @@ -1498,7 +1523,7 @@ |
1499 | 1524 | list( $dtrail, $trail ) = Linker::splitTrail( $trail ); |
1500 | 1525 | } |
1501 | 1526 | |
1502 | | - $text = $this->getFunctionLang()->markNoConversion( $text ); |
| 1527 | + $text = $this->getConverterLanguage()->markNoConversion( $text ); |
1503 | 1528 | |
1504 | 1529 | $url = Sanitizer::cleanUrl( $url ); |
1505 | 1530 | |
— | — | @@ -1678,7 +1703,7 @@ |
1679 | 1704 | $line = $a->current(); # Workaround for broken ArrayIterator::next() that returns "void" |
1680 | 1705 | $s = substr( $s, 1 ); |
1681 | 1706 | |
1682 | | - $useLinkPrefixExtension = $this->getFunctionLang()->linkPrefixExtension(); |
| 1707 | + $useLinkPrefixExtension = $this->getTargetLanguage()->linkPrefixExtension(); |
1683 | 1708 | $e2 = null; |
1684 | 1709 | if ( $useLinkPrefixExtension ) { |
1685 | 1710 | # Match the end of a line for a word that's not followed by whitespace, |
— | — | @@ -1704,8 +1729,9 @@ |
1705 | 1730 | $prefix = ''; |
1706 | 1731 | } |
1707 | 1732 | |
1708 | | - if ( $this->getFunctionLang()->hasVariants() ) { |
1709 | | - $selflink = $this->getFunctionLang()->autoConvertToAllVariants( $this->mTitle->getPrefixedText() ); |
| 1733 | + if ( $this->getConverterLanguage()->hasVariants() ) { |
| 1734 | + $selflink = $this->getConverterLanguage()->autoConvertToAllVariants( |
| 1735 | + $this->mTitle->getPrefixedText() ); |
1710 | 1736 | } else { |
1711 | 1737 | $selflink = array( $this->mTitle->getPrefixedText() ); |
1712 | 1738 | } |
— | — | @@ -1923,7 +1949,7 @@ |
1924 | 1950 | } |
1925 | 1951 | $sortkey = Sanitizer::decodeCharReferences( $sortkey ); |
1926 | 1952 | $sortkey = str_replace( "\n", '', $sortkey ); |
1927 | | - $sortkey = $this->getFunctionLang()->convertCategoryKey( $sortkey ); |
| 1953 | + $sortkey = $this->getConverterLanguage()->convertCategoryKey( $sortkey ); |
1928 | 1954 | $this->mOutput->addCategory( $nt->getDBkey(), $sortkey ); |
1929 | 1955 | |
1930 | 1956 | /** |
— | — | @@ -3022,7 +3048,7 @@ |
3023 | 3049 | * @private |
3024 | 3050 | */ |
3025 | 3051 | function braceSubstitution( $piece, $frame ) { |
3026 | | - global $wgNonincludableNamespaces; |
| 3052 | + global $wgNonincludableNamespaces, $wgContLang; |
3027 | 3053 | wfProfileIn( __METHOD__ ); |
3028 | 3054 | wfProfileIn( __METHOD__.'-setup' ); |
3029 | 3055 | |
— | — | @@ -3125,7 +3151,7 @@ |
3126 | 3152 | $function = $this->mFunctionSynonyms[1][$function]; |
3127 | 3153 | } else { |
3128 | 3154 | # Case insensitive functions |
3129 | | - $function = $this->getFunctionLang()->lc( $function ); |
| 3155 | + $function = $wgContLang->lc( $function ); |
3130 | 3156 | if ( isset( $this->mFunctionSynonyms[0][$function] ) ) { |
3131 | 3157 | $function = $this->mFunctionSynonyms[0][$function]; |
3132 | 3158 | } else { |
— | — | @@ -3201,8 +3227,8 @@ |
3202 | 3228 | if ( $title ) { |
3203 | 3229 | $titleText = $title->getPrefixedText(); |
3204 | 3230 | # Check for language variants if the template is not found |
3205 | | - if ( $this->getFunctionLang()->hasVariants() && $title->getArticleID() == 0 ) { |
3206 | | - $this->getFunctionLang()->findVariantLink( $part1, $title, true ); |
| 3231 | + if ( $this->getConverterLanguage()->hasVariants() && $title->getArticleID() == 0 ) { |
| 3232 | + $this->getConverterLanguage()->findVariantLink( $part1, $title, true ); |
3207 | 3233 | } |
3208 | 3234 | # Do recursion depth check |
3209 | 3235 | $limit = $this->mOptions->getMaxTemplateDepth(); |
— | — | @@ -4033,7 +4059,7 @@ |
4034 | 4060 | if ( $dot ) { |
4035 | 4061 | $numbering .= '.'; |
4036 | 4062 | } |
4037 | | - $numbering .= $this->getFunctionLang()->formatNum( $sublevelCount[$i] ); |
| 4063 | + $numbering .= $this->getTargetLanguage()->formatNum( $sublevelCount[$i] ); |
4038 | 4064 | $dot = 1; |
4039 | 4065 | } |
4040 | 4066 | } |
Index: branches/REL1_19/phase3/includes/filerepo/backend/FileBackend.php |
— | — | @@ -51,6 +51,7 @@ |
52 | 52 | * $config includes: |
53 | 53 | * 'name' : The unique name of this backend. |
54 | 54 | * This should consist of alphanumberic, '-', and '_' characters. |
| 55 | + * This name should not be changed after use. |
55 | 56 | * 'wikiId' : Prefix to container names that is unique to this wiki. |
56 | 57 | * This should consist of alphanumberic, '-', and '_' characters. |
57 | 58 | * 'lockManager' : Registered name of a file lock manager to use. |
— | — | @@ -61,6 +62,9 @@ |
62 | 63 | */ |
63 | 64 | public function __construct( array $config ) { |
64 | 65 | $this->name = $config['name']; |
| 66 | + if ( !preg_match( '!^[a-zA-Z0-9-_]{1,255}$!', $this->name ) ) { |
| 67 | + throw new MWException( "Backend name `{$this->name}` is invalid." ); |
| 68 | + } |
65 | 69 | $this->wikiId = isset( $config['wikiId'] ) |
66 | 70 | ? $config['wikiId'] |
67 | 71 | : wfWikiID(); // e.g. "my_wiki-en_" |
Index: branches/REL1_19/phase3/includes/cache/MessageCache.php |
— | — | @@ -833,14 +833,9 @@ |
834 | 834 | |
835 | 835 | $parser = $this->getParser(); |
836 | 836 | $popts = $this->getParserOptions(); |
| 837 | + $popts->setInterfaceMessage( $interface ); |
| 838 | + $popts->setTargetLanguage( $language ); |
837 | 839 | |
838 | | - if ( $interface ) { |
839 | | - $popts->setInterfaceMessage( true ); |
840 | | - } |
841 | | - if ( $language !== null ) { |
842 | | - $popts->setTargetLanguage( $language ); |
843 | | - } |
844 | | - |
845 | 840 | wfProfileIn( __METHOD__ ); |
846 | 841 | if ( !$title || !$title instanceof Title ) { |
847 | 842 | global $wgTitle; |
Property changes on: branches/REL1_19/phase3/includes/cache/MessageCache.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
848 | 843 | Merged /trunk/phase3/includes/cache/MessageCache.php:r112872-112873,112988,113001,113024,113039,113046,113099 |
Index: branches/REL1_19/phase3/includes/DefaultSettings.php |
— | — | @@ -2176,6 +2176,17 @@ |
2177 | 2177 | */ |
2178 | 2178 | $wgLocalTZoffset = null; |
2179 | 2179 | |
| 2180 | +/** |
| 2181 | + * If set to true, this will roll back a few bug fixes introduced in 1.19, |
| 2182 | + * emulating the 1.18 behaviour, to avoid introducing bug 34832. In 1.19, |
| 2183 | + * language variant conversion is disabled in interface messages. Setting this |
| 2184 | + * to true re-enables it. |
| 2185 | + * |
| 2186 | + * This variable should be removed (implicitly false) in 1.20 or earlier. |
| 2187 | + */ |
| 2188 | +$wgBug34832TransitionalRollback = true; |
| 2189 | + |
| 2190 | + |
2180 | 2191 | /** @} */ # End of language/charset settings |
2181 | 2192 | |
2182 | 2193 | /*************************************************************************//** |
Index: branches/REL1_19/phase3/includes/specials/SpecialUserlogin.php |
— | — | @@ -797,7 +797,7 @@ |
798 | 798 | function resetLoginForm( $error ) { |
799 | 799 | $this->getOutput()->addHTML( Xml::element('p', array( 'class' => 'error' ), $error ) ); |
800 | 800 | $reset = new SpecialChangePassword(); |
801 | | - $reset->setContext( $this ); |
| 801 | + $reset->setContext( $this->getContext() ); |
802 | 802 | $reset->execute( null ); |
803 | 803 | } |
804 | 804 | |
Index: branches/REL1_19/phase3/includes/specials/SpecialRecentchanges.php |
— | — | @@ -633,10 +633,13 @@ |
634 | 634 | function setTopText( FormOptions $opts ) { |
635 | 635 | global $wgContLang; |
636 | 636 | $this->getOutput()->addWikiText( |
637 | | - Html::rawElement( 'p', |
638 | | - array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ), |
639 | | - "\n" . wfMsgForContentNoTrans( 'recentchangestext' ) . "\n" |
640 | | - ), false ); |
| 637 | + Html::rawElement( 'p', |
| 638 | + array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ), |
| 639 | + "\n" . wfMsgForContentNoTrans( 'recentchangestext' ) . "\n" |
| 640 | + ), |
| 641 | + /* $lineStart */ false, |
| 642 | + /* $interface */ false |
| 643 | + ); |
641 | 644 | } |
642 | 645 | |
643 | 646 | /** |
Property changes on: branches/REL1_19/phase3/includes/specials |
___________________________________________________________________ |
Modified: svn:mergeinfo |
644 | 647 | Merged /trunk/phase3/includes/specials:r112872-112873,112988,113001,113024,113039,113046,113099 |
Index: branches/REL1_19/phase3/includes/Block.php |
— | — | @@ -71,6 +71,9 @@ |
72 | 72 | } |
73 | 73 | |
74 | 74 | $this->setTarget( $address ); |
| 75 | + if ( $this->target instanceof User && $user ) { |
| 76 | + $this->target->setId( $user ); // needed for foreign users |
| 77 | + } |
75 | 78 | if ( $by ) { // local user |
76 | 79 | $this->setBlocker( User::newFromID( $by ) ); |
77 | 80 | } else { // foreign user |
Property changes on: branches/REL1_19/phase3/includes |
___________________________________________________________________ |
Modified: svn:mergeinfo |
78 | 81 | Merged /trunk/phase3/includes:r112563,112566,112838,112872-112873,112988,113001,113024,113039,113046,113099 |
Index: branches/REL1_19/phase3/languages/messages/MessagesSa.php |
— | — | @@ -536,7 +536,6 @@ |
537 | 537 | 'versionrequiredtext' => 'एतत्पृष्ठं प्रयोक्तुं मीडियाविकि इत्येतस्य $1तमा आवृत्तिः आवश्यकी। पश्यतु [[Special:Version|आवृत्ति-सूचिका]]', |
538 | 538 | |
539 | 539 | 'ok' => 'अस्तु', |
540 | | -'pagetitle' => '', |
541 | 540 | 'retrievedfrom' => '"$1" इत्यस्माद् उद्धृतम्', |
542 | 541 | 'youhavenewmessages' => 'भवदर्थम् $1 सन्ति। ($2).', |
543 | 542 | 'newmessageslink' => 'नूतनाः सन्देशाः', |
Property changes on: branches/REL1_19/phase3/languages |
___________________________________________________________________ |
Modified: svn:mergeinfo |
544 | 543 | Merged /trunk/phase3/languages:r113039,113046,113099 |
Property changes on: branches/REL1_19/phase3 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
545 | 544 | Merged /trunk/phase3:r112563,112566,112838,112872-112873,112988,113001,113024,113039,113046,113099 |