Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/77552


Change subject: Commenting and doc fixes around the spam regexes
......................................................................

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
---
M includes/EditPage.php
1 file changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/52/77552/1

diff --git a/includes/EditPage.php b/includes/EditPage.php
index 1b59430..4906e7a 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -1403,9 +1403,14 @@
                # 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 );
                        }
                }
@@ -1603,8 +1608,7 @@
                                }
                        }
 
-                       // 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 {
@@ -1889,11 +1893,11 @@
        }
 
        /**
-        * 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;

-- 
To view, visit https://gerrit.wikimedia.org/r/77552
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14e4ff2a5c3e61d7a9a27428953f1579d9d8436b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to