Index: trunk/phase3/includes/User.php |
— | — | @@ -2334,13 +2334,11 @@ |
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 |
2340 | 2338 | * @return string |
2341 | 2339 | */ |
2342 | | - function getPageRenderingHash( $content = false ) { |
| 2340 | + function getPageRenderingHash() { |
2343 | 2341 | global $wgContLang, $wgUseDynamicDates, $wgLang; |
2344 | | - if( $this->mHash && !$content ){ |
| 2342 | + if( $this->mHash ){ |
2345 | 2343 | return $this->mHash; |
2346 | 2344 | } |
2347 | 2345 | |
— | — | @@ -2353,11 +2351,7 @@ |
2354 | 2352 | $confstr .= '!' . $this->getDatePreference(); |
2355 | 2353 | } |
2356 | 2354 | $confstr .= '!' . ($this->getOption( 'numberheadings' ) ? '1' : ''); |
2357 | | - if( $content ){ |
2358 | | - $confstr .= '!' . $wgContLang->getCode(); |
2359 | | - } else { |
2360 | | - $confstr .= '!' . $wgLang->getCode(); |
2361 | | - } |
| 2355 | + $confstr .= '!' . $wgLang->getCode(); |
2362 | 2356 | $confstr .= '!' . $this->getOption( 'thumbsize' ); |
2363 | 2357 | // add in language specific options, if any |
2364 | 2358 | $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, output and user members |
| 2644 | + * Returns a stdclass with source, pst and output members |
2645 | 2645 | */ |
2646 | 2646 | function prepareTextForEdit( $text, $revid=null ) { |
2647 | 2647 | if ( $this->mPreparedEdit && $this->mPreparedEdit->newText == $text && $this->mPreparedEdit->revid == $revid) { |
— | — | @@ -2652,14 +2652,11 @@ |
2653 | 2653 | $edit->revid = $revid; |
2654 | 2654 | $edit->newText = $text; |
2655 | 2655 | $edit->pst = $this->preSaveTransform( $text ); |
2656 | | - $user = new User(); |
2657 | | - $options = new ParserOptions( $user ); |
| 2656 | + $options = new ParserOptions; |
2658 | 2657 | $options->setTidy( true ); |
2659 | | - $options->setInterfaceMessage( true ); // @bug 14404 |
2660 | 2658 | $options->enableLimitReport(); |
2661 | 2659 | $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $options, true, true, $revid ); |
2662 | 2660 | $edit->oldText = $this->getContent(); |
2663 | | - $edit->user = $user; |
2664 | 2661 | $this->mPreparedEdit = $edit; |
2665 | 2662 | return $edit; |
2666 | 2663 | } |
— | — | @@ -2695,7 +2692,7 @@ |
2696 | 2693 | # Save it to the parser cache |
2697 | 2694 | if ( $wgEnableParserCache ) { |
2698 | 2695 | $parserCache = ParserCache::singleton(); |
2699 | | - $parserCache->save( $editInfo->output, $this, $editInfo->user, /*content*/true ); |
| 2696 | + $parserCache->save( $editInfo->output, $this, $wgUser ); |
2700 | 2697 | } |
2701 | 2698 | |
2702 | 2699 | # Update the links tables |
— | — | @@ -2984,7 +2981,7 @@ |
2985 | 2982 | $revision->insertOn( $dbw ); |
2986 | 2983 | $this->updateRevisionOn( $dbw, $revision ); |
2987 | 2984 | $dbw->commit(); |
2988 | | - |
| 2985 | + |
2989 | 2986 | wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) ); |
2990 | 2987 | |
2991 | 2988 | wfProfileOut( __METHOD__ ); |
Index: trunk/phase3/includes/RefreshLinksJob.php |
— | — | @@ -36,9 +36,7 @@ |
37 | 37 | } |
38 | 38 | |
39 | 39 | wfProfileIn( __METHOD__.'-parse' ); |
40 | | - $user = new User(); |
41 | | - $options = new ParserOptions( $user ); |
42 | | - $options->setInterfaceMessage( true ); |
| 40 | + $options = new ParserOptions; |
43 | 41 | $parserOutput = $wgParser->parse( $revision->getText(), $this->title, $options, true, true, $revision->getId() ); |
44 | 42 | wfProfileOut( __METHOD__.'-parse' ); |
45 | 43 | wfProfileIn( __METHOD__.'-update' ); |
Index: trunk/phase3/includes/ParserOptions.php |
— | — | @@ -5,31 +5,32 @@ |
6 | 6 | * @todo document |
7 | 7 | * @ingroup Parser |
8 | 8 | */ |
9 | | -class ParserOptions { |
| 9 | +class ParserOptions |
| 10 | +{ |
10 | 11 | # All variables are supposed to be private in theory, although in practise this is not the case. |
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. |
| 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. |
32 | 33 | |
33 | | - var $mUser; //!< Stored user object, just used to initialise the skin |
| 34 | + var $mUser; # Stored user object, just used to initialise the skin |
34 | 35 | |
35 | 36 | function getUseTeX() { return $this->mUseTeX; } |
36 | 37 | function getUseDynamicDates() { return $this->mUseDynamicDates; } |
— | — | @@ -97,7 +98,7 @@ |
98 | 99 | |
99 | 100 | /** |
100 | 101 | * Get parser options |
101 | | - * @param $user User |
| 102 | + * @static |
102 | 103 | */ |
103 | 104 | static function newFromUser( $user ) { |
104 | 105 | return new ParserOptions( $user ); |
— | — | @@ -108,9 +109,8 @@ |
109 | 110 | global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages; |
110 | 111 | global $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgMaxArticleSize; |
111 | 112 | global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth; |
112 | | - |
113 | | - wfProfileIn( __METHOD__ ); |
114 | | - |
| 113 | + $fname = 'ParserOptions::initialiseFromUser'; |
| 114 | + wfProfileIn( $fname ); |
115 | 115 | if ( !$userInput ) { |
116 | 116 | global $wgUser; |
117 | 117 | if ( isset( $wgUser ) ) { |
— | — | @@ -144,7 +144,6 @@ |
145 | 145 | $this->mRemoveComments = true; |
146 | 146 | $this->mTemplateCallback = array( 'Parser', 'statelessFetchTemplate' ); |
147 | 147 | $this->mEnableLimitReport = false; |
148 | | - |
149 | | - wfProfileOut( __METHOD__ ); |
| 148 | + wfProfileOut( $fname ); |
150 | 149 | } |
151 | 150 | } |
Index: trunk/phase3/includes/CoreParserFunctions.php |
— | — | @@ -56,15 +56,7 @@ |
57 | 57 | static function intFunction( $parser, $part1 = '' /*, ... */ ) { |
58 | 58 | if ( strval( $part1 ) !== '' ) { |
59 | 59 | $args = array_slice( func_get_args(), 2 ); |
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 ); |
| 60 | + return wfMsgReal( $part1, $args, true ); |
69 | 61 | } else { |
70 | 62 | return array( 'found' => false ); |
71 | 63 | } |
Index: trunk/phase3/includes/ParserCache.php |
— | — | @@ -26,9 +26,9 @@ |
27 | 27 | $this->mMemc =& $memCached; |
28 | 28 | } |
29 | 29 | |
30 | | - function getKey( &$article, &$user, $content = false ) { |
| 30 | + function getKey( &$article, &$user ) { |
31 | 31 | global $action; |
32 | | - $hash = $user->getPageRenderingHash( $content ); |
| 32 | + $hash = $user->getPageRenderingHash(); |
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, $content = false ){ |
| 90 | + function save( $parserOutput, &$article, &$user ){ |
91 | 91 | global $wgParserCacheExpireTime; |
92 | | - $key = $this->getKey( $article, $user, $content ); |
| 92 | + $key = $this->getKey( $article, $user ); |
93 | 93 | |
94 | 94 | if( $parserOutput->getCacheTime() != -1 ) { |
95 | 95 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -351,8 +351,6 @@ |
352 | 352 | * (bug 14401) Fix Safari access key tooltips for Windows and >3.1 Mac versions |
353 | 353 | * (bug 14432) Fix notice regression in Special:Newpages feed mode |
354 | 354 | * (bug 11951) EditPage::getEditToolbar() is now static. |
355 | | -* (bug 14404) Use of {{int:...}} to generate links no longer breaks links table |
356 | | - if user has a custom interface language |
357 | 355 | * (bug 14392) Fix regression breaking table prefix in installer |
358 | 356 | * (bug 11084) $wgDBprefix replacement for updater SQL will now work for |
359 | 357 | extension tables using uppercase letters or digits in their names. |