Ejegg has uploaded a new change for review.

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

Change subject: Log full URLs on spam blacklist hit
......................................................................

Log full URLs on spam blacklist hit

When a regex detects a URL on the blacklist, use an expanded regex
that matches the full line to get the URL to log.

Bug: 55356
Change-Id: I6dfbc1b70f9a305e76664ac28ccb90fe1594f342
---
M SpamBlacklist_body.php
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SpamBlacklist 
refs/changes/14/169314/1

diff --git a/SpamBlacklist_body.php b/SpamBlacklist_body.php
index 15fbc72..19f69ac 100644
--- a/SpamBlacklist_body.php
+++ b/SpamBlacklist_body.php
@@ -94,7 +94,10 @@
                                        wfDebugLog( 'SpamBlacklist', "Match!\n" 
);
                                        global $wgRequest;
                                        $ip = $wgRequest->getIP();
-                                       $imploded = implode( ' ', $matches[0] );
+                                       $fullUrls = array();
+                                       $fullLineRegex = substr( $regex, 0, 
strrpos( $regex, '/' ) ) . '.*/Sim';
+                                       preg_match_all( $fullLineRegex, $links, 
$fullUrls );
+                                       $imploded = implode( ' ', $fullUrls[0] 
);
                                        wfDebugLog( 'SpamBlacklistHit', "$ip 
caught submitting spam: $imploded\n" );
                                        if( !$preventLog ) {
                                                $this->logFilterHit( $title, 
$imploded ); // Log it
@@ -102,7 +105,7 @@
                                        if( $retVal === false ){
                                                $retVal = array();
                                        }
-                                       $retVal = array_merge( $retVal, 
$matches[1] );
+                                       $retVal = array_merge( $retVal, 
$fullUrls[1] );
                                }
                        }
                        if ( is_array( $retVal ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dfbc1b70f9a305e76664ac28ccb90fe1594f342
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SpamBlacklist
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to