Last modified: 2008-06-09 15:04:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T10968, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 8968 - Configuration variable to truncate or disable automatic edit summaries
Configuration variable to truncate or disable automatic edit summaries
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
unspecified
All All
: Low enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-13 17:48 UTC by FND
Modified: 2008-06-09 15:04 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
proposed patch (1.47 KB, patch)
2007-02-13 18:24 UTC, FND
Details
proposed patch (revised) (1.36 KB, patch)
2007-02-13 19:39 UTC, FND
Details

Description FND 2007-02-13 17:48:12 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).
Comment 1 FND 2007-02-13 18:02:08 UTC
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;
	}
Comment 2 FND 2007-02-13 18:24:09 UTC
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".
Comment 3 Rob Church 2007-02-13 18:28:52 UTC
Please submit patches as unified diffs against Subversion trunk.
Comment 4 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-02-13 18:54:38 UTC
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.
Comment 5 FND 2007-02-13 19:39:41 UTC
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...
Comment 6 Chad H. 2008-06-09 15:04:43 UTC
This is done in 1.13, see [[mw:Manual:$wgUseAutomaticEditSummaries]]

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links