r82511 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82510‎ | r82511 | r82512 >
Date:15:03, 20 February 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Per Platonides; follow-up r78201: add "stubthreshold" to ParserOptions; also provides a proper fix to r81765
Modified paths:
  • /trunk/phase3/includes/parser/LinkHolderArray.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserOptions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/LinkHolderArray.php
@@ -104,16 +104,6 @@
105105 }
106106
107107 /**
108 - * Get the stub threshold
109 - */
110 - function getStubThreshold() {
111 - if ( !isset( $this->stubThreshold ) ) {
112 - $this->stubThreshold = $this->parent->getUser()->getStubThreshold();
113 - }
114 - return $this->stubThreshold;
115 - }
116 -
117 - /**
118108 * FIXME: update documentation. makeLinkObj() is deprecated.
119109 * Replace <!--LINK--> link placeholders with actual links, in the buffer
120110 * Placeholders created in Skin::makeLinkObj()
@@ -148,7 +138,7 @@
149139 wfProfileIn( __METHOD__.'-check' );
150140 $dbr = wfGetDB( DB_SLAVE );
151141 $page = $dbr->tableName( 'page' );
152 - $threshold = $this->getStubThreshold();
 142+ $threshold = $this->parent->getOptions()->getStubThreshold();
153143
154144 # Sort by namespace
155145 ksort( $this->internals );
@@ -305,7 +295,7 @@
306296 $output = $this->parent->getOutput();
307297 $linkCache = LinkCache::singleton();
308298 $sk = $this->parent->getOptions()->getSkin( $this->parent->mTitle );
309 - $threshold = $this->getStubThreshold();
 299+ $threshold = $this->parent->getOptions()->getStubThreshold();
310300 $titlesToBeConverted = '';
311301 $titlesAttrs = array();
312302
Index: trunk/phase3/includes/parser/ParserOptions.php
@@ -41,6 +41,7 @@
4242 var $mNumberHeadings; # Automatically number headings
4343 var $mMath; # User math preference (as integer)
4444 var $mThumbSize; # Thumb size preferred by the user.
 45+ private $mStubThreshold; # Maximum article size of an article to be marked as "stub"
4546 var $mUserLang; # Language code of the User language.
4647
4748 /**
@@ -80,6 +81,8 @@
8182 return $this->mMath; }
8283 function getThumbSize() { $this->optionUsed('thumbsize');
8384 return $this->mThumbSize; }
 85+ function getStubThreshold() { $this->optionUsed('stubthreshold');
 86+ return $this->mStubThreshold; }
8487
8588 function getIsPreview() { return $this->mIsPreview; }
8689 function getIsSectionPreview() { return $this->mIsSectionPreview; }
@@ -145,6 +148,7 @@
146149 function setMath( $x ) { return wfSetVar( $this->mMath, $x ); }
147150 function setUserLang( $x ) { return wfSetVar( $this->mUserLang, $x ); }
148151 function setThumbSize( $x ) { return wfSetVar( $this->mThumbSize, $x ); }
 152+ function setStubThreshold( $x ) { return wfSetVar( $this->mStubThreshold, $x ); }
149153 function setPreSaveTransform( $x ) { return wfSetVar( $this->mPreSaveTransform, $x ); }
150154
151155 function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); }
@@ -210,6 +214,7 @@
211215 $this->mNumberHeadings = $user->getOption( 'numberheadings' );
212216 $this->mMath = $user->getOption( 'math' );
213217 $this->mThumbSize = $user->getOption( 'thumbsize' );
 218+ $this->mStubThreshold = $user->getStubThreshold();
214219 $this->mUserLang = $wgLang->getCode();
215220
216221 wfProfileOut( __METHOD__ );
@@ -276,9 +281,8 @@
277282 // Space assigned for the stubthreshold but unused
278283 // since it disables the parser cache, its value will always
279284 // be 0 when this function is called by parsercache.
280 - // The conditional is here to avoid a confusing 0
281 - if ( true || in_array( 'stubthreshold', $forOptions ) )
282 - $confstr .= '!0' ;
 285+ if ( in_array( 'stubthreshold', $forOptions ) )
 286+ $confstr .= '!' . $this->mStubThreshold;
283287 else
284288 $confstr .= '!*' ;
285289

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78201* (bug 19006) {{REVISIONUSER}} no longer acts like {{CURRENTUSER}} in some cases...ialex18:17, 10 December 2010
r81765Hack to shortcut it to zero until User::getStubThreshold() produces a call to...platonides17:58, 8 February 2011

Comments

#Comment by Platonides (talk | contribs)   16:09, 20 February 2011

Good.

For the record: This doesn't make people with thresholds start using those available caches yet. This is just the first step. Article needs updating for that.

Status & tagging log