Index: trunk/phase3/includes/User.php |
— | — | @@ -2334,11 +2334,13 @@ |
2335 | 2335 | * which will give them a chance to modify this key based on their own |
2336 | 2336 | * settings. |
2337 | 2337 | * |
| 2338 | + * @param $content Bool: wheter use the content language to generate the |
| 2339 | + * hash |
2338 | 2340 | * @return string |
2339 | 2341 | */ |
2340 | | - function getPageRenderingHash() { |
| 2342 | + function getPageRenderingHash( $content = false ) { |
2341 | 2343 | global $wgContLang, $wgUseDynamicDates, $wgLang; |
2342 | | - if( $this->mHash ){ |
| 2344 | + if( $this->mHash && !$content ){ |
2343 | 2345 | return $this->mHash; |
2344 | 2346 | } |
2345 | 2347 | |
— | — | @@ -2351,7 +2353,11 @@ |
2352 | 2354 | $confstr .= '!' . $this->getDatePreference(); |
2353 | 2355 | } |
2354 | 2356 | $confstr .= '!' . ($this->getOption( 'numberheadings' ) ? '1' : ''); |
2355 | | - $confstr .= '!' . $wgLang->getCode(); |
| 2357 | + if( $content ){ |
| 2358 | + $confstr .= '!' . $wgContLang->getCode(); |
| 2359 | + } else { |
| 2360 | + $confstr .= '!' . $wgLang->getCode(); |
| 2361 | + } |
2356 | 2362 | $confstr .= '!' . $this->getOption( 'thumbsize' ); |
2357 | 2363 | // add in language specific options, if any |
2358 | 2364 | $extra = $wgContLang->getExtraHashOptions(); |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -541,9 +541,9 @@ |
542 | 542 | */ |
543 | 543 | function isRedirect( $text = false ) { |
544 | 544 | if ( $text === false ) { |
545 | | - if ( $this->mDataLoaded ) |
| 545 | + if ( $this->mDataLoaded ) |
546 | 546 | return $this->mIsRedirect; |
547 | | - |
| 547 | + |
548 | 548 | // Apparently loadPageData was never called |
549 | 549 | $this->loadContent(); |
550 | 550 | $titleObj = Title::newFromRedirect( $this->fetchContent() ); |
— | — | @@ -922,14 +922,14 @@ |
923 | 923 | $this->viewUpdates(); |
924 | 924 | wfProfileOut( __METHOD__ ); |
925 | 925 | } |
926 | | - |
| 926 | + |
927 | 927 | protected function viewRedirect( $target, $overwriteSubtitle = true, $forceKnown = false ) { |
928 | 928 | global $wgParser, $wgOut, $wgContLang, $wgStylePath, $wgUser; |
929 | | - |
| 929 | + |
930 | 930 | # Display redirect |
931 | 931 | $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; |
932 | 932 | $imageUrl = $wgStylePath.'/common/images/redirect' . $imageDir . '.png'; |
933 | | - |
| 933 | + |
934 | 934 | if( $overwriteSubtitle ) { |
935 | 935 | $wgOut->setSubtitle( wfMsgHtml( 'redirectpagesub' ) ); |
936 | 936 | } |
— | — | @@ -941,7 +941,7 @@ |
942 | 942 | |
943 | 943 | $wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT " />' . |
944 | 944 | '<span class="redirectText">'.$link.'</span>' ); |
945 | | - |
| 945 | + |
946 | 946 | } |
947 | 947 | |
948 | 948 | function addTrackbacks() { |
— | — | @@ -1449,7 +1449,7 @@ |
1450 | 1450 | |
1451 | 1451 | # Update page |
1452 | 1452 | $ok = $this->updateRevisionOn( $dbw, $revision, $lastRevision ); |
1453 | | - |
| 1453 | + |
1454 | 1454 | wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, $baseRevId) ); |
1455 | 1455 | |
1456 | 1456 | if( !$ok ) { |
— | — | @@ -1521,7 +1521,7 @@ |
1522 | 1522 | |
1523 | 1523 | # Update the page record with revision data |
1524 | 1524 | $this->updateRevisionOn( $dbw, $revision, 0 ); |
1525 | | - |
| 1525 | + |
1526 | 1526 | wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) ); |
1527 | 1527 | |
1528 | 1528 | if( !( $flags & EDIT_SUPPRESS_RC ) ) { |
— | — | @@ -1881,7 +1881,7 @@ |
1882 | 1882 | 'page_id' => $id |
1883 | 1883 | ), 'Article::protect' |
1884 | 1884 | ); |
1885 | | - |
| 1885 | + |
1886 | 1886 | wfRunHooks( 'NewRevisionFromEditComplete', array($this, $nullRevision, false) ); |
1887 | 1887 | wfRunHooks( 'ArticleProtectComplete', array( &$this, &$wgUser, $limit, $reason ) ); |
1888 | 1888 | |
— | — | @@ -2242,7 +2242,7 @@ |
2243 | 2243 | function doDelete( $reason, $suppress = false ) { |
2244 | 2244 | global $wgOut, $wgUser; |
2245 | 2245 | wfDebug( __METHOD__."\n" ); |
2246 | | - |
| 2246 | + |
2247 | 2247 | $id = $this->getId(); |
2248 | 2248 | |
2249 | 2249 | if (wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason))) { |
— | — | @@ -2514,14 +2514,14 @@ |
2515 | 2515 | if( empty( $summary ) ){ |
2516 | 2516 | $summary = wfMsgForContent( 'revertpage' ); |
2517 | 2517 | } |
2518 | | - |
| 2518 | + |
2519 | 2519 | # Allow the custom summary to use the same args as the default message |
2520 | 2520 | $args = array( |
2521 | 2521 | $target->getUserText(), $from, $s->rev_id, |
2522 | 2522 | $wgLang->timeanddate(wfTimestamp(TS_MW, $s->rev_timestamp), true), |
2523 | 2523 | $current->getId(), $wgLang->timeanddate($current->getTimestamp()) |
2524 | 2524 | ); |
2525 | | - $summary = wfMsgReplaceArgs( $summary, $args ); |
| 2525 | + $summary = wfMsgReplaceArgs( $summary, $args ); |
2526 | 2526 | |
2527 | 2527 | # Save |
2528 | 2528 | $flags = EDIT_UPDATE; |
— | — | @@ -2609,7 +2609,7 @@ |
2610 | 2610 | . $wgUser->getSkin()->userToolLinks( $target->getUser(), $target->getUserText() ); |
2611 | 2611 | $wgOut->addHtml( wfMsgExt( 'rollback-success', array( 'parse', 'replaceafter' ), $old, $new ) ); |
2612 | 2612 | $wgOut->returnToMain( false, $this->mTitle ); |
2613 | | - |
| 2613 | + |
2614 | 2614 | if( !$wgRequest->getBool( 'hidediff', false ) ) { |
2615 | 2615 | $de = new DifferenceEngine( $this->mTitle, $current->getId(), 'next', false, true ); |
2616 | 2616 | $de->showDiff( '', '' ); |
— | — | @@ -2640,7 +2640,7 @@ |
2641 | 2641 | |
2642 | 2642 | /** |
2643 | 2643 | * Prepare text which is about to be saved. |
2644 | | - * Returns a stdclass with source, pst and output members |
| 2644 | + * Returns a stdclass with source, pst, output and user members |
2645 | 2645 | */ |
2646 | 2646 | function prepareTextForEdit( $text, $revid=null ) { |
2647 | 2647 | if ( $this->mPreparedEdit && $this->mPreparedEdit->newText == $text && $this->mPreparedEdit->revid == $revid) { |
— | — | @@ -2652,11 +2652,14 @@ |
2653 | 2653 | $edit->revid = $revid; |
2654 | 2654 | $edit->newText = $text; |
2655 | 2655 | $edit->pst = $this->preSaveTransform( $text ); |
2656 | | - $options = new ParserOptions; |
| 2656 | + $user = new User(); |
| 2657 | + $options = new ParserOptions( $user ); |
2657 | 2658 | $options->setTidy( true ); |
| 2659 | + $options->setInterfaceMessage( true ); // @bug 14404 |
2658 | 2660 | $options->enableLimitReport(); |
2659 | 2661 | $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $options, true, true, $revid ); |
2660 | 2662 | $edit->oldText = $this->getContent(); |
| 2663 | + $edit->user = $user; |
2661 | 2664 | $this->mPreparedEdit = $edit; |
2662 | 2665 | return $edit; |
2663 | 2666 | } |
— | — | @@ -2692,7 +2695,7 @@ |
2693 | 2696 | # Save it to the parser cache |
2694 | 2697 | if ( $wgEnableParserCache ) { |
2695 | 2698 | $parserCache = ParserCache::singleton(); |
2696 | | - $parserCache->save( $editInfo->output, $this, $wgUser ); |
| 2699 | + $parserCache->save( $editInfo->output, $this, $editInfo->user, /*content*/true ); |
2697 | 2700 | } |
2698 | 2701 | |
2699 | 2702 | # Update the links tables |
— | — | @@ -2981,7 +2984,7 @@ |
2982 | 2985 | $revision->insertOn( $dbw ); |
2983 | 2986 | $this->updateRevisionOn( $dbw, $revision ); |
2984 | 2987 | $dbw->commit(); |
2985 | | - |
| 2988 | + |
2986 | 2989 | wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) ); |
2987 | 2990 | |
2988 | 2991 | wfProfileOut( __METHOD__ ); |
Index: trunk/phase3/includes/RefreshLinksJob.php |
— | — | @@ -36,7 +36,9 @@ |
37 | 37 | } |
38 | 38 | |
39 | 39 | wfProfileIn( __METHOD__.'-parse' ); |
40 | | - $options = new ParserOptions; |
| 40 | + $user = new User(); |
| 41 | + $options = new ParserOptions( $user ); |
| 42 | + $options->setInterfaceMessage( true ); |
41 | 43 | $parserOutput = $wgParser->parse( $revision->getText(), $this->title, $options, true, true, $revision->getId() ); |
42 | 44 | wfProfileOut( __METHOD__.'-parse' ); |
43 | 45 | wfProfileIn( __METHOD__.'-update' ); |
Index: trunk/phase3/includes/ParserOptions.php |
— | — | @@ -5,32 +5,31 @@ |
6 | 6 | * @todo document |
7 | 7 | * @ingroup Parser |
8 | 8 | */ |
9 | | -class ParserOptions |
10 | | -{ |
| 9 | +class ParserOptions { |
11 | 10 | # All variables are supposed to be private in theory, although in practise this is not the case. |
12 | | - var $mUseTeX; # Use texvc to expand <math> tags |
13 | | - var $mUseDynamicDates; # Use DateFormatter to format dates |
14 | | - var $mInterwikiMagic; # Interlanguage links are removed and returned in an array |
15 | | - var $mAllowExternalImages; # Allow external images inline |
16 | | - var $mAllowExternalImagesFrom; # If not, any exception? |
17 | | - var $mSkin; # Reference to the preferred skin |
18 | | - var $mDateFormat; # Date format index |
19 | | - var $mEditSection; # Create "edit section" links |
20 | | - var $mNumberHeadings; # Automatically number headings |
21 | | - var $mAllowSpecialInclusion; # Allow inclusion of special pages |
22 | | - var $mTidy; # Ask for tidy cleanup |
23 | | - var $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR |
24 | | - var $mTargetLanguage; # Overrides above setting with arbitrary language |
25 | | - var $mMaxIncludeSize; # Maximum size of template expansions, in bytes |
26 | | - var $mMaxPPNodeCount; # Maximum number of nodes touched by PPFrame::expand() |
27 | | - var $mMaxPPExpandDepth; # Maximum recursion depth in PPFrame::expand() |
28 | | - var $mMaxTemplateDepth; # Maximum recursion depth for templates within templates |
29 | | - var $mRemoveComments; # Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS |
30 | | - var $mTemplateCallback; # Callback for template fetching |
31 | | - var $mEnableLimitReport; # Enable limit report in an HTML comment on output |
32 | | - var $mTimestamp; # Timestamp used for {{CURRENTDAY}} etc. |
| 11 | + var $mUseTeX; //!< Use texvc to expand <math> tags |
| 12 | + var $mUseDynamicDates; //!< Use DateFormatter to format dates |
| 13 | + var $mInterwikiMagic; //!< Interlanguage links are removed and returned in an array |
| 14 | + var $mAllowExternalImages; //!< Allow external images inline |
| 15 | + var $mAllowExternalImagesFrom; //!< If not, any exception? |
| 16 | + var $mSkin; //!< Reference to the preferred skin |
| 17 | + var $mDateFormat; //!< Date format index |
| 18 | + var $mEditSection; //!< Create "edit section" links |
| 19 | + var $mNumberHeadings; //!< Automatically number headings |
| 20 | + var $mAllowSpecialInclusion; //!< Allow inclusion of special pages |
| 21 | + var $mTidy; //!< Ask for tidy cleanup |
| 22 | + var $mInterfaceMessage; //!< Which lang to call for PLURAL and GRAMMAR |
| 23 | + var $mTargetLanguage; //!< Overrides above setting with arbitrary language |
| 24 | + var $mMaxIncludeSize; //!< Maximum size of template expansions, in bytes |
| 25 | + var $mMaxPPNodeCount; //!< Maximum number of nodes touched by PPFrame::expand() |
| 26 | + var $mMaxPPExpandDepth; //!< Maximum recursion depth in PPFrame::expand() |
| 27 | + var $mMaxTemplateDepth; //!< Maximum recursion depth for templates within templates |
| 28 | + var $mRemoveComments; //!< Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS |
| 29 | + var $mTemplateCallback; //!< Callback for template fetching |
| 30 | + var $mEnableLimitReport; //!< Enable limit report in an HTML comment on output |
| 31 | + var $mTimestamp; //!< Timestamp used for {{CURRENTDAY}} etc. |
33 | 32 | |
34 | | - var $mUser; # Stored user object, just used to initialise the skin |
| 33 | + var $mUser; //!< Stored user object, just used to initialise the skin |
35 | 34 | |
36 | 35 | function getUseTeX() { return $this->mUseTeX; } |
37 | 36 | function getUseDynamicDates() { return $this->mUseDynamicDates; } |
— | — | @@ -98,7 +97,7 @@ |
99 | 98 | |
100 | 99 | /** |
101 | 100 | * Get parser options |
102 | | - * @static |
| 101 | + * @param $user User |
103 | 102 | */ |
104 | 103 | static function newFromUser( $user ) { |
105 | 104 | return new ParserOptions( $user ); |
— | — | @@ -109,8 +108,9 @@ |
110 | 109 | global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages; |
111 | 110 | global $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgMaxArticleSize; |
112 | 111 | global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth; |
113 | | - $fname = 'ParserOptions::initialiseFromUser'; |
114 | | - wfProfileIn( $fname ); |
| 112 | + |
| 113 | + wfProfileIn( __METHOD__ ); |
| 114 | + |
115 | 115 | if ( !$userInput ) { |
116 | 116 | global $wgUser; |
117 | 117 | if ( isset( $wgUser ) ) { |
— | — | @@ -144,6 +144,7 @@ |
145 | 145 | $this->mRemoveComments = true; |
146 | 146 | $this->mTemplateCallback = array( 'Parser', 'statelessFetchTemplate' ); |
147 | 147 | $this->mEnableLimitReport = false; |
148 | | - wfProfileOut( $fname ); |
| 148 | + |
| 149 | + wfProfileOut( __METHOD__ ); |
149 | 150 | } |
150 | 151 | } |
Index: trunk/phase3/includes/CoreParserFunctions.php |
— | — | @@ -56,7 +56,15 @@ |
57 | 57 | static function intFunction( $parser, $part1 = '' /*, ... */ ) { |
58 | 58 | if ( strval( $part1 ) !== '' ) { |
59 | 59 | $args = array_slice( func_get_args(), 2 ); |
60 | | - return wfMsgReal( $part1, $args, true ); |
| 60 | + $opts = array(); |
| 61 | + if( ( $langObj = $parser->mOptions->getTargetLanguage() ) !== null ){ |
| 62 | + $opts['language'] = $langObj->getCode(); |
| 63 | + } else if( $parser->mOptions->getInterfaceMessage() ) { |
| 64 | + $opts[] = 'content'; |
| 65 | + } |
| 66 | + $msg = call_user_func_array( 'wfMsgExt', |
| 67 | + array_merge( array( $part1, $opts ), $args ) ); |
| 68 | + return $parser->replaceVariables( $msg ); |
61 | 69 | } else { |
62 | 70 | return array( 'found' => false ); |
63 | 71 | } |
Index: trunk/phase3/includes/ParserCache.php |
— | — | @@ -26,9 +26,9 @@ |
27 | 27 | $this->mMemc =& $memCached; |
28 | 28 | } |
29 | 29 | |
30 | | - function getKey( &$article, &$user ) { |
| 30 | + function getKey( &$article, &$user, $content = false ) { |
31 | 31 | global $action; |
32 | | - $hash = $user->getPageRenderingHash(); |
| 32 | + $hash = $user->getPageRenderingHash( $content ); |
33 | 33 | if( !$article->mTitle->quickUserCan( 'edit' ) ) { |
34 | 34 | // section edit links are suppressed even if the user has them on |
35 | 35 | $edit = '!edit=0'; |
— | — | @@ -86,9 +86,9 @@ |
87 | 87 | return $value; |
88 | 88 | } |
89 | 89 | |
90 | | - function save( $parserOutput, &$article, &$user ){ |
| 90 | + function save( $parserOutput, &$article, &$user, $content = false ){ |
91 | 91 | global $wgParserCacheExpireTime; |
92 | | - $key = $this->getKey( $article, $user ); |
| 92 | + $key = $this->getKey( $article, $user, $content ); |
93 | 93 | |
94 | 94 | if( $parserOutput->getCacheTime() != -1 ) { |
95 | 95 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -350,6 +350,8 @@ |
351 | 351 | * (bug 14401) Fix Safari access key tooltips for Windows and >3.1 Mac versions |
352 | 352 | * (bug 14432) Fix notice regression in Special:Newpages feed mode |
353 | 353 | * (bug 11951) EditPage::getEditToolbar() is now static. |
| 354 | +* (bug 14404) Use of {{int:...}} to generate links no longer breaks links table |
| 355 | + if user has a custom interface language |
354 | 356 | |
355 | 357 | |
356 | 358 | === API changes in 1.13 === |