From: Matthew Flaschen Date: Sat, 3 Aug 2013 20:52:00 +0000 (-0400) Subject: Commenting and doc fixes around the spam regexes X-Git-Tag: 1.31.0-rc.0~18947 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=efe86f6f128a6723f515ef4eaa24aaeb4dab3fc5;p=lhc%2Fweb%2Fwiklou.git Commenting and doc fixes around the spam regexes Follow-up to clarify 6e838747487661faf0f404911f062f75ccf950a4 , fix an older inaccurate comment, and fix a docblock copy-and-paste error. Change-Id: I14e4ff2a5c3e61d7a9a27428953f1579d9d8436b --- diff --git a/includes/EditPage.php b/includes/EditPage.php index f244828ee0..7049814539 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1404,9 +1404,14 @@ class EditPage { # Check for spam $match = self::matchSummarySpamRegex( $this->summary ); if ( $match === false && $this->section == 'new' ) { + # $wgSpamRegex is enforced on this new heading/summary because, unlike + # regular summaries, it is added to the actual wikitext. if ( $this->sectiontitle !== '' ) { + # This branch is taken when the API is used with the 'sectiontitle' parameter. $match = self::matchSpamRegex( $this->sectiontitle ); } else { + # This branch is taken when the "Add Topic" user interface is used, or the API + # is used with the 'summary' parameter. $match = self::matchSpamRegex( $this->summary ); } } @@ -1604,8 +1609,7 @@ class EditPage { } } - // If sectiontitle is set, use it, otherwise use the summary as the section title (for - // backwards compatibility with old forms/bots). + // If sectiontitle is set, use it, otherwise use the summary as the section title. if ( $this->sectiontitle !== '' ) { $sectionTitle = $this->sectiontitle; } else { @@ -1890,11 +1894,11 @@ class EditPage { } /** - * Check given input text against $wgSpamRegex, and return the text of the first match. + * Check given input text against $wgSummarySpamRegex, and return the text of the first match. * * @param $text string * - * @return string|bool matching string or false + * @return string|bool matching string or false */ public static function matchSummarySpamRegex( $text ) { global $wgSummarySpamRegex;