From 19f1eccc531da5ba4078c1c0f370c5454e59b1b6 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 20 Feb 2011 15:03:25 +0000 Subject: [PATCH] Per Platonides; follow-up r78201: add "stubthreshold" to ParserOptions; also provides a proper fix to r81765 --- includes/parser/LinkHolderArray.php | 14 ++------------ includes/parser/ParserOptions.php | 10 +++++++--- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index 05519c496a..31e121f427 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -103,16 +103,6 @@ class LinkHolderArray { return $retVal; } - /** - * Get the stub threshold - */ - function getStubThreshold() { - if ( !isset( $this->stubThreshold ) ) { - $this->stubThreshold = $this->parent->getUser()->getStubThreshold(); - } - return $this->stubThreshold; - } - /** * FIXME: update documentation. makeLinkObj() is deprecated. * Replace link placeholders with actual links, in the buffer @@ -148,7 +138,7 @@ class LinkHolderArray { wfProfileIn( __METHOD__.'-check' ); $dbr = wfGetDB( DB_SLAVE ); $page = $dbr->tableName( 'page' ); - $threshold = $this->getStubThreshold(); + $threshold = $this->parent->getOptions()->getStubThreshold(); # Sort by namespace ksort( $this->internals ); @@ -305,7 +295,7 @@ class LinkHolderArray { $output = $this->parent->getOutput(); $linkCache = LinkCache::singleton(); $sk = $this->parent->getOptions()->getSkin( $this->parent->mTitle ); - $threshold = $this->getStubThreshold(); + $threshold = $this->parent->getOptions()->getStubThreshold(); $titlesToBeConverted = ''; $titlesAttrs = array(); diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index c97502186b..7a6b877cde 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -41,6 +41,7 @@ class ParserOptions { var $mNumberHeadings; # Automatically number headings var $mMath; # User math preference (as integer) var $mThumbSize; # Thumb size preferred by the user. + private $mStubThreshold; # Maximum article size of an article to be marked as "stub" var $mUserLang; # Language code of the User language. /** @@ -80,6 +81,8 @@ class ParserOptions { return $this->mMath; } function getThumbSize() { $this->optionUsed('thumbsize'); return $this->mThumbSize; } + function getStubThreshold() { $this->optionUsed('stubthreshold'); + return $this->mStubThreshold; } function getIsPreview() { return $this->mIsPreview; } function getIsSectionPreview() { return $this->mIsSectionPreview; } @@ -145,6 +148,7 @@ class ParserOptions { function setMath( $x ) { return wfSetVar( $this->mMath, $x ); } function setUserLang( $x ) { return wfSetVar( $this->mUserLang, $x ); } function setThumbSize( $x ) { return wfSetVar( $this->mThumbSize, $x ); } + function setStubThreshold( $x ) { return wfSetVar( $this->mStubThreshold, $x ); } function setPreSaveTransform( $x ) { return wfSetVar( $this->mPreSaveTransform, $x ); } function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); } @@ -210,6 +214,7 @@ class ParserOptions { $this->mNumberHeadings = $user->getOption( 'numberheadings' ); $this->mMath = $user->getOption( 'math' ); $this->mThumbSize = $user->getOption( 'thumbsize' ); + $this->mStubThreshold = $user->getStubThreshold(); $this->mUserLang = $wgLang->getCode(); wfProfileOut( __METHOD__ ); @@ -276,9 +281,8 @@ class ParserOptions { // Space assigned for the stubthreshold but unused // since it disables the parser cache, its value will always // be 0 when this function is called by parsercache. - // The conditional is here to avoid a confusing 0 - if ( true || in_array( 'stubthreshold', $forOptions ) ) - $confstr .= '!0' ; + if ( in_array( 'stubthreshold', $forOptions ) ) + $confstr .= '!' . $this->mStubThreshold; else $confstr .= '!*' ; -- 2.20.1