Partial revert of r79520, follow up to r79558. Unconditionally use the new format.
authorPlatonides <platonides@users.mediawiki.org>
Tue, 4 Jan 2011 11:31:06 +0000 (11:31 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Tue, 4 Jan 2011 11:31:06 +0000 (11:31 +0000)
For environments post r70783, they will need to rerender pages with __NOEDITSECTION__ or no headings (hopefully those will be simple pages).
There will be no extra parser cache misses for environments pre r70783.

includes/DefaultSettings.php
includes/parser/Parser.php
includes/parser/ParserOptions.php

index b35e775..8b30f5e 100644 (file)
@@ -2846,18 +2846,6 @@ $wgEnableScaryTranscluding = false;
  */
 $wgTranscludeCacheExpiry = 3600;
 
-/**
- * Output edit section links as tokens in the parser output for articles instead
- * of directly as markup.
- * This feature changes the default parser cache key so it's presented with a
- * configuration option so that large installations with a large number of already
- * existing parser cache keys can retain them.
- * The purpose of this feature is to allow skins to customize the editsection
- * links, however it has the side effect of also removing the most common use of
- * the getUserLang parser option which causes cache fragmentation by user lang.
- */
-$wgUseEditSectionTokens = true;
-
 /** @} */ # end of parser settings }
 
 /************************************************************************//**
index 568d744..3061a2d 100644 (file)
@@ -3697,10 +3697,7 @@ class Parser {
                        $showEditLink = $this->mOptions->getEditSection();
                }
                if ( $showEditLink ) {
-                       $editLinkAsToken = $this->mOptions->getEditSectionTokens();
-                       if ( $editLinkAsToken ) {
-                               $this->mOutput->setEditSectionTokens( true );
-                       }
+                       $this->mOutput->setEditSectionTokens( true );
                }
 
                # Get all headlines for numbering them and adding funky stuff like [edit]
@@ -3955,38 +3952,27 @@ class Parser {
 
                        # give headline the correct <h#> tag
                        if ( $showEditLink && $sectionIndex !== false ) {
-                               if ( $editLinkAsToken ) {
-                                       // Output edit section links as markers with styles that can be customized by skins
-                                       if ( $isTemplate ) {
-                                               # Put a T flag in the section identifier, to indicate to extractSections()
-                                               # that sections inside <includeonly> should be counted.
-                                               $editlinkArgs = array( $titleText, "T-$sectionIndex"/*, null */ );
-                                       } else {
-                                               $editlinkArgs = array( $this->mTitle->getPrefixedText(), $sectionIndex, $headlineHint );
-                                       }
-                                       // We use a bit of pesudo-xml for editsection markers. The language converter is run later on
-                                       // Using a UNIQ style marker leads to the converter screwing up the tokens when it converts stuff
-                                       // And trying to insert strip tags fails too. At this point all real inputted tags have already been escaped
-                                       // so we don't have to worry about a user trying to input one of these markers directly.
-                                       // We use a page and section attribute to stop the language converter from converting these important bits
-                                       // of data, but put the headline hint inside a content block because the language converter is supposed to
-                                       // be able to convert that piece of data.
-                                       $editlink = '<editsection page="' . htmlspecialchars($editlinkArgs[0]);
-                                       $editlink .= '" section="' . htmlspecialchars($editlinkArgs[1]) .'"';
-                                       if ( isset($editlinkArgs[2]) ) {
-                                               $editlink .= '>' . $editlinkArgs[2] . '</editsection>';
-                                       } else {
-                                               $editlink .= '/>';
-                                       }
+                               // Output edit section links as markers with styles that can be customized by skins
+                               if ( $isTemplate ) {
+                                       # Put a T flag in the section identifier, to indicate to extractSections()
+                                       # that sections inside <includeonly> should be counted.
+                                       $editlinkArgs = array( $titleText, "T-$sectionIndex"/*, null */ );
                                } else {
-                                       // Output edit section links directly as markup like we used to
-                                       if ( $isTemplate ) {
-                                               # Put a T flag in the section identifier, to indicate to extractSections()
-                                               # that sections inside <includeonly> should be counted.
-                                               $editlink = $sk->doEditSectionLink( Title::newFromText( $titleText ), "T-$sectionIndex", null, $this->mOptions->getUserLang() );
-                                       } else {
-                                               $editlink = $sk->doEditSectionLink( $this->mTitle, $sectionIndex, $headlineHint, $this->mOptions->getUserLang() );
-                                       }
+                                       $editlinkArgs = array( $this->mTitle->getPrefixedText(), $sectionIndex, $headlineHint );
+                               }
+                               // We use a bit of pesudo-xml for editsection markers. The language converter is run later on
+                               // Using a UNIQ style marker leads to the converter screwing up the tokens when it converts stuff
+                               // And trying to insert strip tags fails too. At this point all real inputted tags have already been escaped
+                               // so we don't have to worry about a user trying to input one of these markers directly.
+                               // We use a page and section attribute to stop the language converter from converting these important bits
+                               // of data, but put the headline hint inside a content block because the language converter is supposed to
+                               // be able to convert that piece of data.
+                               $editlink = '<editsection page="' . htmlspecialchars($editlinkArgs[0]);
+                               $editlink .= '" section="' . htmlspecialchars($editlinkArgs[1]) .'"';
+                               if ( isset($editlinkArgs[2]) ) {
+                                       $editlink .= '>' . $editlinkArgs[2] . '</editsection>';
+                               } else {
+                                       $editlink .= '/>';
                                }
                        } else {
                                $editlink = '';
index 52d96d4..99d680c 100644 (file)
@@ -21,7 +21,6 @@ class ParserOptions {
        var $mSkin = null;               # Reference to the preferred skin
        var $mDateFormat = null;         # Date format index
        var $mEditSection = true;        # Create "edit section" links
-       var $mEditSectionTokens = false; # Output replaceable tokens for editsections instead of markup
        var $mAllowSpecialInclusion;     # Allow inclusion of special pages
        var $mTidy = false;              # Ask for tidy cleanup
        var $mInterfaceMessage = false;  # Which lang to call for PLURAL and GRAMMAR
@@ -57,10 +56,7 @@ class ParserOptions {
        function getAllowExternalImages()           { return $this->mAllowExternalImages; }
        function getAllowExternalImagesFrom()       { return $this->mAllowExternalImagesFrom; }
        function getEnableImageWhitelist()          { return $this->mEnableImageWhitelist; }
-       function getEditSection()                   { $this->optionUsed('editsection');
-                                                                                                 return $this->mEditSection; }
-       function getEditSectionTokens()             { $this->optionUsed('editsectiontokens');
-                                                                                                 return $this->mEditSectionTokens; }
+       function getEditSection()                   { return $this->mEditSection; }
        function getNumberHeadings()                { $this->optionUsed('numberheadings');
                                                                                                  return $this->mNumberHeadings; }
        function getAllowSpecialInclusion()         { return $this->mAllowSpecialInclusion; }
@@ -126,7 +122,6 @@ class ParserOptions {
        function setEnableImageWhitelist( $x )      { return wfSetVar( $this->mEnableImageWhitelist, $x ); }
        function setDateFormat( $x )                { return wfSetVar( $this->mDateFormat, $x ); }
        function setEditSection( $x )               { return wfSetVar( $this->mEditSection, $x ); }
-       function setEditSectionTokens( $x )         { return wfSetVar( $this->mEditSectionTokens, $x ); }
        function setNumberHeadings( $x )            { return wfSetVar( $this->mNumberHeadings, $x ); }
        function setAllowSpecialInclusion( $x )     { return wfSetVar( $this->mAllowSpecialInclusion, $x ); }
        function setTidy( $x )                      { return wfSetVar( $this->mTidy, $x); }
@@ -175,7 +170,7 @@ class ParserOptions {
        function initialiseFromUser( $userInput ) {
                global $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages;
                global $wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion, $wgMaxArticleSize;
-               global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth, $wgCleanSignatures, $wgUseEditSectionTokens;
+               global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth, $wgCleanSignatures;
                global $wgExternalLinkTarget, $wgLang;
 
                wfProfileIn( __METHOD__ );
@@ -205,7 +200,6 @@ class ParserOptions {
                $this->mMaxTemplateDepth = $wgMaxTemplateDepth;
                $this->mCleanSignatures = $wgCleanSignatures;
                $this->mExternalLinkTarget = $wgExternalLinkTarget;
-               $this->mEditSectionTokens = $wgUseEditSectionTokens;
 
                $this->mNumberHeadings = $user->getOption( 'numberheadings' );
                $this->mMath = $user->getOption( 'math' );
@@ -310,10 +304,12 @@ class ParserOptions {
 
                $confstr .= $wgRenderHashAppend;
 
-               if ( !$this->mEditSection && in_array( 'editsection', $forOptions ) )
+               if ( !in_array( 'editsection', $forOptions ) ) {
+                       $confstr .= '!*';
+               } elseif ( !$this->mEditSection ) {
                        $confstr .= '!edit=0';
-               if ( $this->mEditSectionTokens && in_array( 'editsectiontokens', $forOptions ) )
-                       $confstr .= '!estok=1';
+               }
+               
                if (  $this->mIsPrintable && in_array( 'printable', $forOptions ) )
                        $confstr .= '!printable=1';