Last modified: 2008-06-09 15:04:43 UTC
It would be helpful if there was a variable to either - limit the number of chars in an auto-summary (currently 200), or - completely disable auto-summaries (though this can also be done by setting MediaWiki:Autosumm-new to " ") This could rather easily be done by editing the getAutosummary function in Article.php (I myself am not qualified for this, unfortunatly).
Here's how I think it might be done: (However, I don't know how to register the new variable $autoSummChars so it's customizable in Special:Allmessages...) public static function getAutosummary( $oldtext, $newtext, $flags ) { # This code is UGLY UGLY UGLY. # Somebody PLEASE come up with a more elegant way to do it. #Redirect autosummaries $summary = self::getRedirectAutosummary( $newtext ); if ($summary) return $summary; #Blanking autosummaries if (!($flags & EDIT_NEW)) $summary = self::getBlankingAutosummary( $oldtext, $newtext ); if ($summary) return $summary; #New page autosummaries if ($flags & EDIT_NEW && strlen($newtext)) { #If they're making a new article, give its text, truncated, in the summary. if ($autoSummChars > 0) { global $wgContLang; $truncatedtext = $wgContLang->truncate( str_replace("\n", ' ', $newtext), max( 0, $autoSummChars - strlen( wfMsgForContent( 'autosumm-new') ) ), '...' ); $summary = wfMsgForContent( 'autosumm-new', $truncatedtext ); } else { $summary = ""; } } if ($summary) return $summary; return $summary; }
Created attachment 3213 [details] proposed patch The previous comment stripped the whitespaces, so here's a slightly altered version as an attachment. I've marked my changes with "-- FND".
Please submit patches as unified diffs against Subversion trunk.
Not so important for a three-line patch, though. Anyway, note that the variable should be a global declared in DefaultSettings.php, not a local variable that was never assigned a value as here.
Created attachment 3214 [details] proposed patch (revised) Here's the revised version as a patch. Please note that it's untested, as I don't have a MW installation to test it on at the moment. But it's very simple, so I would have to be a complete moron to screw this one up... (In reply to comment #3) > Please submit patches as unified diffs against Subversion trunk. Thanks to Brion and Simetrical, I actually know what that means and figured out how to do it... (In reply to comment #4) > Anyway, note that the variable > should be a global declared in DefaultSettings.php, not a local variable that > was never assigned a value as here. I wasn't sure whether declaring/initializing the variable in DefaultSettings.php would suffice - well, I guess it does...
This is done in 1.13, see [[mw:Manual:$wgUseAutomaticEditSummaries]]