MarcoAurelio has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379003 )

Change subject: Update cleanupSpam.php to hide its activity from RecentChanges
......................................................................

Update cleanupSpam.php to hide its activity from RecentChanges

Spam cleanup activities, mostly when it comes from automated processes
(the so called 'spambots') can involve a fair ammount of edits and log
actions to accomplish. As such, to avoid cluttering
Special:RecentChanges this patch makes the activities of the system
account under which it operates the cleanupSpam.php maintenance script
to be marked as 'bot' and removing them from RecentChanges

It also switches from doDeleteArticle() to doDeleteArticleReal() to
delete the pages with database consistency.

To prepare this patch I had the help of Bartosz Dziewoński which I'd also like 
to thank and I'll credit as co-author as well.

Change-Id: Ifde08056a7481b877b4b82699cc0a5ea3f962dd9
Co-Authored-by: Bartosz Dziewoński <matma....@gmail.com>
Bug: T176206
---
M maintenance/cleanupSpam.php
1 file changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/03/379003/1

diff --git a/maintenance/cleanupSpam.php b/maintenance/cleanupSpam.php
index 4e47cfb..72095cf 100644
--- a/maintenance/cleanupSpam.php
+++ b/maintenance/cleanupSpam.php
@@ -131,14 +131,17 @@
                                $page->doEditContent(
                                        $content,
                                        wfMessage( 'spam_reverting', $domain 
)->inContentLanguage()->text(),
-                                       EDIT_UPDATE,
+                                       // Hide edit from RecentChanges and 
mark it as bot
+                                       EDIT_UPDATE | EDIT_FORCE_BOT | 
EDIT_SUPPRESS_RC,
                                        $rev->getId()
                                );
                        } elseif ( $this->hasOption( 'delete' ) ) {
                                // Didn't find a non-spammy revision, blank the 
page
                                $this->output( "deleting\n" );
-                               $page->doDeleteArticle(
-                                       wfMessage( 'spam_deleting', $domain 
)->inContentLanguage()->text()
+                               $page->doDeleteArticleReal(
+                                       wfMessage( 'spam_deleting', $domain 
)->inContentLanguage()->text(),
+                                       // Hide deletion from RecentChanges
+                                       EDIT_SUPPRESS_RC
                                );
                        } else {
                                // Didn't find a non-spammy revision, blank the 
page
@@ -148,7 +151,9 @@
                                $this->output( "blanking\n" );
                                $page->doEditContent(
                                        $content,
-                                       wfMessage( 'spam_blanking', $domain 
)->inContentLanguage()->text()
+                                       wfMessage( 'spam_blanking', $domain 
)->inContentLanguage()->text(),
+                                       // Hide edit from RecentChanges and 
mark it as bot as well
+                                       EDIT_UPDATE | EDIT_FORCE_BOT | 
EDIT_SUPPRESS_RC
                                );
                        }
                        $this->commitTransaction( $dbw, __METHOD__ );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifde08056a7481b877b4b82699cc0a5ea3f962dd9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarcoAurelio <maure...@tools.wmflabs.org>

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

Reply via email to