[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Revert "Restrict sending mails to new users"
Hello Urbanecm, Niharika29, EddieGP, TerraCodes, jenkins-bot, Zoranzoki21, I'd like you to do a code review. Please visit https://gerrit.wikimedia.org/r/403571 to review the following change. Change subject: Revert "Restrict sending mails to new users" .. Revert "Restrict sending mails to new users" This reverts commit c29cb66cbc2b32a8e000d042df50da145fea93a7. Bug: T184470 Change-Id: Ib11dbd457fc6ddaad73ab7c3cc99a7790bacc5d4 --- M wmf-config/InitialiseSettings.php 1 file changed, 0 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/71/403571/1 diff --git a/wmf-config/InitialiseSettings.php b/wmf-config/InitialiseSettings.php index 4eb8ce0..b140c67 100644 --- a/wmf-config/InitialiseSettings.php +++ b/wmf-config/InitialiseSettings.php @@ -8993,7 +8993,6 @@ 'global-renamer' => [ // T142123, T71651 'autopatrol' => true, 'centralauth-rename' => true, - 'sendemail-new-users' => true, ], 'massmessage-sender' => [ // T59611, T142123 'autopatrol' => true, @@ -9037,7 +9036,6 @@ 'massmessage' => true, 'userrights' => true, 'userrights-interwiki' => true, - 'sendemail-new-users' => true, ], ], 'mkwiki' => [ @@ -9755,11 +9753,9 @@ ], 'bureaucrat' => [ 'noratelimit' => true, - 'sendemail-new-users' => true, ], 'steward' => [ 'noratelimit' => true, - 'sendemail-new-users' => true, ], // 'rollback' => array( 'rollback' => true, ), 'import' => [ 'importupload' => true, 'import' => true ], @@ -9773,7 +9769,6 @@ 'move-subpages' => false, // for now... 'movefile' => false, // r93871 CR 'editcontentmodel' => false, // temp, pending T85847 - 'sendemail-new-users' => false, ], 'autoconfirmed' => [ 'reupload' => true, -- To view, visit https://gerrit.wikimedia.org/r/403571 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib11dbd457fc6ddaad73ab7c3cc99a7790bacc5d4 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: DmazaGerrit-Reviewer: EddieGP Gerrit-Reviewer: Niharika29 Gerrit-Reviewer: TerraCodes Gerrit-Reviewer: Urbanecm Gerrit-Reviewer: Zoranzoki21 Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Revert "Prevent new users from being sent emails"
Hello Niharika29, Florianschmidtwelzow, jenkins-bot, MaxSem, Siebrand, Samwilson, Kaldari, Dbarratt, MusikAnimal, I'd like you to do a code review. Please visit https://gerrit.wikimedia.org/r/403485 to review the following change. Change subject: Revert "Prevent new users from being sent emails" .. Revert "Prevent new users from being sent emails" This reverts commit b52421dedd45fc035a2993d10ea90c878cd77453. Per T184470 Change-Id: I2f5fe8993c6e186cd2df0841292653f8fecc0254 --- M includes/DefaultSettings.php M includes/specials/SpecialEmailuser.php M includes/user/User.php M languages/i18n/en.json M languages/i18n/qqq.json 5 files changed, 3 insertions(+), 37 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/85/403485/1 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 06c9ffb..3cd7ef1 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -5166,7 +5166,6 @@ $wgGroupPermissions['user']['applychangetags'] = true; $wgGroupPermissions['user']['changetags'] = true; $wgGroupPermissions['user']['editcontentmodel'] = true; -$wgGroupPermissions['user']['sendemail-new-users'] = true; // Implicit group for accounts that pass $wgAutoConfirmAge $wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true; diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index d57ba09..30eb38d 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -224,45 +224,15 @@ wfDebug( "Target is invalid user.\n" ); return 'notarget'; - } - - if ( !$target->isEmailConfirmed() ) { + } elseif ( !$target->isEmailConfirmed() ) { wfDebug( "User has no valid email.\n" ); return 'noemail'; - } - - if ( !$target->canReceiveEmail() ) { + } elseif ( !$target->canReceiveEmail() ) { wfDebug( "User does not allow user emails.\n" ); return 'nowikiemail'; - } - - if ( - $target->getEditCount() === 0 - && ( $sender === null || !$sender->isAllowed( 'sendemail-new-users' ) ) - ) { - // Determine if target has any other logged actions. - $dbr = wfGetDB( DB_REPLICA ); - $log_id = $dbr->selectField( - 'logging', - 'log_id', - [ - 'log_user' => $target->getId(), - "NOT (log_type = 'newusers' AND log_action = 'autocreate')", - ], - __METHOD__, - [ 'LIMIT' => 1 ] - ); - - if ( !$log_id ) { - wfDebug( "User has no logged actions on this wiki.\n" ); - - return 'nowikiemail'; - } - } - - if ( $sender !== null ) { + } elseif ( $sender !== null ) { $blacklist = $target->getOption( 'email-blacklist', [] ); if ( $blacklist ) { $lookup = CentralIdLookup::factory(); diff --git a/includes/user/User.php b/includes/user/User.php index f31d61b..854ebbd 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -178,7 +178,6 @@ 'reupload-shared', 'rollback', 'sendemail', - 'sendemail-new-users', 'siteadmin', 'suppressionlog', 'suppressredirect', diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 767c0a6..5083bed 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1237,7 +1237,6 @@ "right-siteadmin": "Lock and unlock the database", "right-override-export-depth": "Export pages including linked pages up to a depth of 5", "right-sendemail": "Send email to other users", - "right-sendemail-new-users": "Send email to users with no logged actions", "right-managechangetags": "Create and (de)activate [[Special:Tags|tags]]", "right-applychangetags": "Apply [[Special:Tags|tags]] along with one's changes", "right-changetags": "Add and remove arbitrary [[Special:Tags|tags]] on individual revisions and log entries", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 7b5b3c2..862f64c 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1431,7 +1431,6 @@ "right-siteadmin": "{{doc-right|siteadmin}}",
[MediaWiki-commits] [Gerrit] mediawiki/vendor[master]: Update wikimedia/equivset (1.0.0 => 1.2.0)
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/391875 ) Change subject: Update wikimedia/equivset (1.0.0 => 1.2.0) .. Update wikimedia/equivset (1.0.0 => 1.2.0) Version bumped to make use of new character mappings Bug: T179834 Change-Id: I7f74ec4b282ee3e888cf58b86fba1cca1d57e1c8 --- M composer.json M composer.lock M composer/autoload_classmap.php M composer/autoload_static.php M composer/installed.json M wikimedia/equivset/COPYING R wikimedia/equivset/README.md M wikimedia/equivset/data/equivset.in M wikimedia/equivset/dist/equivset.json M wikimedia/equivset/dist/equivset.ser M wikimedia/equivset/dist/equivset.txt D wikimedia/equivset/phpunit.xml M wikimedia/equivset/src/Command/GenerateEquivset.php M wikimedia/equivset/src/Equivset.php A wikimedia/equivset/src/EquivsetInterface.php 15 files changed, 491 insertions(+), 255 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor refs/changes/75/391875/1 -- To view, visit https://gerrit.wikimedia.org/r/391875 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7f74ec4b282ee3e888cf58b86fba1cca1d57e1c8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/vendor Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Enable per-filter profiling on enwiki
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/390153 ) Change subject: Enable per-filter profiling on enwiki .. Enable per-filter profiling on enwiki Bug: T179323 Change-Id: I283a3959d6426e6b37f57a65c58ee88253fce7e7 --- M wmf-config/abusefilter.php 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/53/390153/1 diff --git a/wmf-config/abusefilter.php b/wmf-config/abusefilter.php index 4b9f087..fb53f44 100644 --- a/wmf-config/abusefilter.php +++ b/wmf-config/abusefilter.php @@ -108,6 +108,7 @@ $wgGroupPermissions['sysop']['abusefilter-view-private'] = true; $wgGroupPermissions['abusefilter-helper']['abusefilter-view-private'] = true; // T175684 $wgAbuseFilterNotificationsPrivate = true; // T46045 + $wgAbuseFilterProfile = true; break; case 'enwikibooks': $wgGroupPermissions['*']['abusefilter-view'] = false; -- To view, visit https://gerrit.wikimedia.org/r/390153 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I283a3959d6426e6b37f57a65c58ee88253fce7e7 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Change threshold for slow AbuseFilter logging to 800ms
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/386547 ) Change subject: Change threshold for slow AbuseFilter logging to 800ms .. Change threshold for slow AbuseFilter logging to 800ms Bug: T179039 Change-Id: Ib765b991684ea5a89f639e6eb153267dec9542ea --- M wmf-config/abusefilter.php 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/47/386547/1 diff --git a/wmf-config/abusefilter.php b/wmf-config/abusefilter.php index ae98e71..3638e2d 100644 --- a/wmf-config/abusefilter.php +++ b/wmf-config/abusefilter.php @@ -32,6 +32,8 @@ // T113164 Change default AbuseFilter IP block duration to not indefinite $wgAbuseFilterAnonBlockDuration = '1 week'; +$wgAbuseFilterSlowFilterRuntimeLimit = 800; + // Custom permissions switch ( $wgDBname ) { case 'arwiki': -- To view, visit https://gerrit.wikimedia.org/r/386547 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib765b991684ea5a89f639e6eb153267dec9542ea Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Add AbuseFilterSlow channel to monolog
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/386385 ) Change subject: Add AbuseFilterSlow channel to monolog .. Add AbuseFilterSlow channel to monolog Bug: T178853 Change-Id: I4659f98c23a1f578939054449980a5a5154f444d --- M wmf-config/InitialiseSettings.php 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/85/386385/1 diff --git a/wmf-config/InitialiseSettings.php b/wmf-config/InitialiseSettings.php index 4e3ef43..c40f575 100644 --- a/wmf-config/InitialiseSettings.php +++ b/wmf-config/InitialiseSettings.php @@ -5252,6 +5252,7 @@ 'DBQuery' => 'warning', 'LoginNotify' => 'debug', 'WMDE' => 'debug', // WMDE & Addshore T174948 (Can be removed after 2017/10/14) + 'AbuseFilterSlow' => 'debug', ], '+private' => [ -- To view, visit https://gerrit.wikimedia.org/r/386385 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4659f98c23a1f578939054449980a5a5154f444d Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Update email mute copy on preferences page
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/383874 ) Change subject: Update email mute copy on preferences page .. Update email mute copy on preferences page Bug: T176365 Change-Id: Iabe26fe12ee212217ab6b05016638a683df94b05 --- M languages/i18n/en.json 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/74/383874/1 diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 6bf32b2..b669c15 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1061,8 +1061,8 @@ "timezoneregion-europe": "Europe", "timezoneregion-indian": "Indian Ocean", "timezoneregion-pacific": "Pacific Ocean", - "allowemail": "Enable email from other users", - "email-blacklist-label": "Prohibit these users from sending emails to me:", + "allowemail": "Allow other users to email me directly", + "email-blacklist-label": "Prohibit these users from emailing me directly:", "prefs-searchoptions": "Search", "prefs-namespaces": "Namespaces", "default": "default", -- To view, visit https://gerrit.wikimedia.org/r/383874 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iabe26fe12ee212217ab6b05016638a683df94b05 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Enable $wgAbuseFilterProfile on ptwiki
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/383858 ) Change subject: Enable $wgAbuseFilterProfile on ptwiki .. Enable $wgAbuseFilterProfile on ptwiki Bug: T177641 Change-Id: I6d8593ffa025eea86dafda47c911cb817dcd --- M wmf-config/abusefilter.php 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/58/383858/1 diff --git a/wmf-config/abusefilter.php b/wmf-config/abusefilter.php index e8170e3..cd24543 100644 --- a/wmf-config/abusefilter.php +++ b/wmf-config/abusefilter.php @@ -335,6 +335,9 @@ $wgGroupPermissions['abusefilter']['abusefilter-modify'] = true; $wgGroupPermissions['autoconfirmed']['abusefilter-log-detail'] = false; // T44012 break; + case 'ptwiki': + $wgAbuseFilterProfile = true; + break; case 'ptwiktionary': $wgGroupPermissions['sysop']['abusefilter-modify-restricted'] = true; $wgGroupPermissions['sysop']['abusefilter-revert'] = true; -- To view, visit https://gerrit.wikimedia.org/r/383858 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6d8593ffa025eea86dafda47c911cb817dcd Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...AbuseFilter[master]: Add wikimedia/equivset for string normalization (ccnorm)
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/383719 ) Change subject: Add wikimedia/equivset for string normalization (ccnorm) .. Add wikimedia/equivset for string normalization (ccnorm) Update extension to use the new library wikimedia/equivset for string normalization and remove soft dependency on AntiSpoof extension Change-Id: I2ff8233d3eadeef1089fef4aef46d43345bd955a --- M composer.json M includes/parser/AbuseFilterParser.php M tests/phpunit/parserTest.php 3 files changed, 8 insertions(+), 15 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter refs/changes/19/383719/1 diff --git a/composer.json b/composer.json index 66c4393..cdc17da 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": "GPL-2.0+", "require": { "php": ">=5.4", - "composer/installers": "1.*,>=1.0.1" + "wikimedia/equivset": "^1.0" }, "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", diff --git a/includes/parser/AbuseFilterParser.php b/includes/parser/AbuseFilterParser.php index df98722..6deac8e 100644 --- a/includes/parser/AbuseFilterParser.php +++ b/includes/parser/AbuseFilterParser.php @@ -1,5 +1,7 @@ normalize($s); } /** diff --git a/tests/phpunit/parserTest.php b/tests/phpunit/parserTest.php index 6d7322a..ab5ac91 100644 --- a/tests/phpunit/parserTest.php +++ b/tests/phpunit/parserTest.php @@ -55,11 +55,6 @@ * @dataProvider readTests */ public function testParser( $testName, $rule, $expected ) { - if ( !class_exists( 'AntiSpoof' ) && preg_match( '/(?:cc)?norm(?:\(|_)/i', $rule ) ) { - // The norm and ccnorm parser functions aren't working correctly without AntiSpoof - $this->markTestSkipped( 'Parser test ' . $testName . ' requires the AntiSpoof extension' ); - } - foreach ( self::getParsers() as $parser ) { $actual = $parser->parse( $rule ); $this->assertEquals( $expected, $actual, 'Running parser test ' . $testName ); -- To view, visit https://gerrit.wikimedia.org/r/383719 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2ff8233d3eadeef1089fef4aef46d43345bd955a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AbuseFilter Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Enable AbuseFilter runtime profile on Portuguese Wikipedia
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/382080 ) Change subject: Enable AbuseFilter runtime profile on Portuguese Wikipedia .. Enable AbuseFilter runtime profile on Portuguese Wikipedia Bug: T177336 Change-Id: Ie0056fe3b24c9de7cedf461df0bd28374ed1ad72 --- M wmf-config/InitialiseSettings.php 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/80/382080/1 diff --git a/wmf-config/InitialiseSettings.php b/wmf-config/InitialiseSettings.php index 4c6f633..e29cbc0 100644 --- a/wmf-config/InitialiseSettings.php +++ b/wmf-config/InitialiseSettings.php @@ -13002,6 +13002,7 @@ 'enwiki' => true, 'mediawikiwiki' => true, 'metawiki' => true, + 'ptwiki' => true, 'testwiki' => true, 'wikidatawiki' => true, ], -- To view, visit https://gerrit.wikimedia.org/r/382080 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie0056fe3b24c9de7cedf461df0bd28374ed1ad72 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...AbuseFilter[master]: Add slow filters debug data to the logs.
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/380621 ) Change subject: Add slow filters debug data to the logs. .. Add slow filters debug data to the logs. When $wgAbuseFilterRuntimeProfile is true, all filters taking longer than $wgAbuseFilterRuntimeLimit will be logged for later analysis Bug: T174205 Change-Id: Id81833afa8421476a6cee47eb3393acdb3a38d65 --- M AbuseFilter.php M extension.json M includes/AbuseFilter.class.php 3 files changed, 39 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter refs/changes/21/380621/1 diff --git a/AbuseFilter.php b/AbuseFilter.php index 7f13eaf..6746897 100644 --- a/AbuseFilter.php +++ b/AbuseFilter.php @@ -122,3 +122,8 @@ * Whether to record runtime metrics for all filters combined. */ $wgAbuseFilterRuntimeProfile = false; + +/** + * Runtime in miliseconds before a filter is considered slow. + */ +$wgAbuseFilterRuntimeLimit = 100; diff --git a/extension.json b/extension.json index a043b6c..a183d64 100644 --- a/extension.json +++ b/extension.json @@ -249,7 +249,8 @@ }, "AbuseFilterLogIPMaxAge": 7776000, "AbuseFilterProfile": false, - "AbuseFilterRuntimeProfile": false + "AbuseFilterRuntimeProfile": false, + "AbuseFilterRuntimeLimit": 100 }, "load_composer_autoloader": true, "manifest_version": 1 diff --git a/includes/AbuseFilter.class.php b/includes/AbuseFilter.class.php index 3ce5cdb..0a09ef7 100644 --- a/includes/AbuseFilter.class.php +++ b/includes/AbuseFilter.class.php @@ -529,12 +529,12 @@ * @return bool */ public static function checkFilter( $row, $vars, $profile = false, $prefix = '' ) { - global $wgAbuseFilterProfile; + global $wgAbuseFilterProfile, $wgAbuseFilterRuntimeProfile, $wgAbuseFilterRuntimeLimit; $filterID = $prefix . $row->af_id; $startConds = $startTime = null; - if ( $profile && $wgAbuseFilterProfile ) { + if ( $profile && ( $wgAbuseFilterProfile || $wgAbuseFilterRuntimeProfile ) ) { $startConds = self::$condCount; $startTime = microtime( true ); } @@ -558,19 +558,43 @@ $result = false; } - if ( $profile && $wgAbuseFilterProfile ) { - $endTime = microtime( true ); - $endConds = self::$condCount; + if ( $profile ) { + $timeTaken = microtime( true ) - $startTime; + $condsUsed = self::$condCount - $startConds; - $timeTaken = $endTime - $startTime; - $condsUsed = $endConds - $startConds; - self::recordProfilingResult( $row->af_id, $timeTaken, $condsUsed ); + if ( $wgAbuseFilterProfile ) { + self::recordProfilingResult( $row->af_id, $timeTaken, $condsUsed ); + } + + $runtime = $timeTaken * 1000; + if ( $wgAbuseFilterRuntimeProfile && $runtime > $wgAbuseFilterRuntimeLimit ) { + self::recordSlowFilter( $row->af_id, $runtime, $condsUsed ); + } } return $result; } /** +* Logs slow filter's runtime data for later analysis +* +* @param int $filterId +* @param float $runtime +* @param int $totalConditions +*/ + private static function recordSlowFilter( $filterId, $runtime, $totalConditions ) { + $logger = LoggerFactory::getInstance( 'AbuseFilterRuntime' ); + $logger->info( 'Edit filter is taking too long', + [ + 'wiki' => wfWikiID(), + 'filter_id' => $filterId, + 'runtime' => $runtime, + 'total_conditions' => $totalConditions + ] + ); + } + + /** * @param int $filter */ public static function resetFilterProfile( $filter ) { -- To view, visit https://gerrit.wikimedia.org/r/380621 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id81833afa8421476a6cee47eb3393acdb3a38d65 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AbuseFilter Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Enable user email blacklist on meta
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/379418 ) Change subject: Enable user email blacklist on meta .. Enable user email blacklist on meta Bug: T174694 Change-Id: I8e3f98849aa48b174f65295cfe189330da7c4b0a --- M wmf-config/InitialiseSettings.php 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/18/379418/1 diff --git a/wmf-config/InitialiseSettings.php b/wmf-config/InitialiseSettings.php index bf8b0bf..cd3f0d5 100644 --- a/wmf-config/InitialiseSettings.php +++ b/wmf-config/InitialiseSettings.php @@ -4920,6 +4920,11 @@ 'default' => true, ], +'wgEnableUserEmailBlacklist' => [ + 'default' => false, + 'metawiki' => true, +], + 'wgAutoConfirmCount' => [ 'default' => 0, 'arwiki' => 50, // T14123 -- To view, visit https://gerrit.wikimedia.org/r/379418 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8e3f98849aa48b174f65295cfe189330da7c4b0a Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...AbuseFilter[master]: [WIP] Add cclike operator to normalize and compare a string ...
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/379159 ) Change subject: [WIP] Add cclike operator to normalize and compare a string to a list .. [WIP] Add cclike operator to normalize and compare a string to a list cclike operator will normalize the left operand and compare against the normalized version of each of the elements in the right operand Bug: T65242 Change-Id: I4034c0054a6849babbf2d96ea13dc97d3660d5b4 --- M i18n/en.json M includes/AbuseFilter.class.php M includes/parser/AFPData.php M includes/parser/AbuseFilterParser.php M includes/parser/AbuseFilterTokenizer.php A tests/parserTests/cclike.r A tests/parserTests/cclike.t 7 files changed, 33 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter refs/changes/59/379159/1 diff --git a/i18n/en.json b/i18n/en.json index 0d32b9f..b526401 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -220,6 +220,7 @@ "abusefilter-edit-builder-misc-stringlit": "String literal (\"\")", "abusefilter-edit-builder-misc-tern": "Ternary operator (X ? Y : Z)", "abusefilter-edit-builder-misc-cond": "Conditional (if X then Y else Z)", + "abusefilter-edit-builder-misc-cclike": "Normalize string and compare against list", "abusefilter-edit-builder-group-funcs": "Functions", "abusefilter-edit-builder-funcs-length": "String length (length)", "abusefilter-edit-builder-funcs-lcase": "To lower case (lcase)", diff --git a/includes/AbuseFilter.class.php b/includes/AbuseFilter.class.php index 3ce5cdb..6eac7db 100644 --- a/includes/AbuseFilter.class.php +++ b/includes/AbuseFilter.class.php @@ -56,6 +56,7 @@ ], 'misc' => [ 'in' => 'in', + 'cclike' => 'cclike', 'contains' => 'contains', 'like' => 'like', '""' => 'stringlit', diff --git a/includes/parser/AFPData.php b/includes/parser/AFPData.php index d5a0069..66f6a5e 100644 --- a/includes/parser/AFPData.php +++ b/includes/parser/AFPData.php @@ -156,6 +156,31 @@ } /** +* Normalizes operands and compares if they are equal +* +* @param $a AFPData +* @param $b AFPData +* @return AFPData +*/ + public static function keywordCclike( $a, $b ) { + $a = $a->toString(); + $b = $b->toList(); + + if ( $a == '' || !$b ) { + return new AFPData( self::DBOOL, false ); + } + + $a = AbuseFilterParser::ccnorm( $a ); + foreach ( $b as $val ) { + if ( $a === AbuseFilterParser::ccnorm( $val->toString() ) ) { + return new AFPData( self::DBOOL, true ); + } + } + + return new AFPData( self::DBOOL, false ); + } + + /** * @param $a AFPData * @param $b AFPData * @return AFPData diff --git a/includes/parser/AbuseFilterParser.php b/includes/parser/AbuseFilterParser.php index f9bd15b..e94732f 100644 --- a/includes/parser/AbuseFilterParser.php +++ b/includes/parser/AbuseFilterParser.php @@ -48,7 +48,8 @@ 'contains' => 'keywordContains', 'rlike' => 'keywordRegex', 'irlike' => 'keywordRegexInsensitive', - 'regex' => 'keywordRegex' + 'regex' => 'keywordRegex', + 'cclike' => 'keywordCclike' ]; public static $funcCache = []; @@ -1105,7 +1106,7 @@ * @param $s * @return mixed */ - protected function ccnorm( $s ) { + public static function ccnorm( $s ) { if ( is_callable( 'AntiSpoof::normalizeString' ) ) { $s = AntiSpoof::normalizeString( $s ); } else { diff --git a/includes/parser/AbuseFilterTokenizer.php b/includes/parser/AbuseFilterTokenizer.php index 025314e..0ce1969 100644 --- a/includes/parser/AbuseFilterTokenizer.php +++ b/includes/parser/AbuseFilterTokenizer.php @@ -54,7 +54,7 @@ public static $keywords = [ 'in', 'like', 'true', 'false', 'null', 'contains', 'matches', - 'rlike', 'irlike', 'regex', 'if', 'then', 'else', 'end', + 'rlike', 'irlike', 'regex', 'if', 'then', 'else', 'end', 'cclike', ]; /** diff --git a/tests/parserTests/cclike.r b/tests/parserTests/cclike.r new file mode 100644 index 000..4736e08 --- /dev/null +++ b/tests/parserTests/cclike.r @@ -0,0 +1 @@ +MATCH diff --git a/tests/parserTests/cclike.t b/tests/parserTests/cclike.t new file mode 100644 index 000..70646cd --- /dev/null +++ b/tests/parserTests/cclike.t @@ -0,0 +1 @@ +"4any0ne" cclike ["FOO", "AANYONE"] -- To view, visit
[MediaWiki-commits] [Gerrit] mediawiki...AntiSpoof[master]: Sync equivset.in with Equivalence sets page
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/377184 ) Change subject: Sync equivset.in with Equivalence sets page .. Sync equivset.in with Equivalence sets page equivset.in and Extension:AntiSpoof/Equivalence_sets page was out of sync. Change-Id: I07690229ffaef13fad34c0767e9983bee467aac6 --- M maintenance/equivset.in 1 file changed, 73 insertions(+), 73 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AntiSpoof refs/changes/84/377184/1 diff --git a/maintenance/equivset.in b/maintenance/equivset.in index 9512a2c..b5d5670 100644 --- a/maintenance/equivset.in +++ b/maintenance/equivset.in @@ -170,32 +170,32 @@ 17A ź => 5A Z 17C ż => 5A Z 17E ž => 5A Z -180 ƀ => b +180 ƀ => 62 b 181 Ɓ => 42 B -182 Ƃ => b -183 ƃ => b -184 Ƅ => b -185 ƅ => b +182 Ƃ => 62 b +183 ƃ => 62 b +184 Ƅ => 62 b +185 ƅ => 62 b 187 Ƈ => 43 C 188 ƈ => 43 C 189 Ɖ => 44 D 18A Ɗ => 44 D -18B Ƌ => d -18C ƌ => d +18B Ƌ => 64 d +18C ƌ => 64 d 18F Ə => 1DD ǝ 190 Ɛ => 45 E 191 Ƒ => 46 F -192 ƒ => f +192 ƒ => 66 f 193 Ɠ => 47 G -196 Ɩ => l -197 Ɨ => l +196 Ɩ => 6C l +197 Ɨ => 6C l 198 Ƙ => 4B K 199 ƙ => 4B K -19A ƚ => l -19D Ɲ => N +19A ƚ => 6C l +19D Ɲ => 4E N 1A1 ơ => 1A0 Ơ 1A4 Ƥ => 50 P -1A5 ƥ => p +1A5 ƥ => 70 p 1A6 Ʀ => 52 R 1A7 Ƨ => 32 2 1A8 ƨ => 32 2 @@ -205,15 +205,15 @@ 1AE Ʈ => 54 T 1B1 Ʊ => 55 U 1B2 Ʋ => 55 U -1B3 Ƴ => Y -1B4 ƴ => y +1B3 Ƴ => 59 Y +1B4 ƴ => 79 y 1B5 Ƶ => 5A Z 1B6 ƶ => 5A Z 1B7 Ʒ => 33 3 1BC Ƽ => 35 5 1BD ƽ => 35 5 1BF ƿ => 50 P -1C0 ǀ => | +1C0 ǀ => 7C | 1C3 ǃ => 49 I 1C4 DŽ => 1F1 DZ 1C6 dž => 1F3 dz @@ -248,7 +248,7 @@ 21C Ȝ => 33 3 21D ȝ => 33 3 21E Ȟ => 48 H -220 Ƞ => n +220 Ƞ => 6E n 222 Ȣ => 38 8 223 ȣ => 38 8 224 Ȥ => 5A Z @@ -275,7 +275,7 @@ 269 ɩ => 49 I 26B ɫ => 49 I 26D ɭ => 49 I -26F ɯ => W +26F ɯ => 57 W 26F ɯ => 4D M 271 ɱ => 4D M 272 ɲ => 4E N @@ -315,7 +315,7 @@ 399 Ι => 31 1 39A Κ => 4B K 39C Μ => 4D M -39D Ν => N +39D Ν => 4E N 39F Ο => 30 0 3A1 Ρ => 50 P 3A4 Τ => 54 T @@ -324,7 +324,7 @@ 3A7 Χ => 58 X 3AC ά => 41 A 3AE ή => 48 H -3B1 α => a +3B1 α => 61 a 3B2 β => 42 B 3B4 δ => 394 Δ 3B5 ε => 45 E @@ -347,11 +347,11 @@ 3C6 φ => 278 ɸ 3C7 χ => 58 X 3C8 ψ => 3A8 Ψ -3C9 ω => w +3C9 ω => 77 w 3CB ϋ => 59 Y 3CC ό => 4F O 3CD ύ => 59 Y -3D2 ϒ => Y +3D2 ϒ => 59 Y 3D3 ϓ => 59 Y 3D5 ϕ => 278 ɸ 3DC Ϝ => 46 F @@ -359,13 +359,13 @@ 3E8 Ϩ => 32 2 3E9 ϩ => 32 2 3F2 ϲ => 43 C -3F3 ϳ => j +3F3 ϳ => 6A j 3F4 ϴ => 4F O 3F9 Ϲ => 43 C 404 Є => 45 E 405 Ѕ => 35 5 406 І => 31 1 -408 Ј => J +408 Ј => 4A J 40B Ћ => 48 H 410 А => 41 A 411 Б => 36 6 @@ -381,7 +381,7 @@ 420 Р => 50 P 421 С => 43 C 422 Т => 54 T -423 У => y +423 У => 79 y 424 Ф => 278 ɸ 425 Х => 58 X 427 Ч => 34 4 @@ -427,16 +427,16 @@ 463 ѣ => 42 B 472 Ѳ => 4F O 473 ѳ => 4F O -474 Ѵ => V -475 ѵ => v +474 Ѵ => 56 V +475 ѵ => 76 v 47D ѽ => 47C Ѽ 48A Ҋ => 418 И 48B ҋ => 418 И -48C Ҍ => b -48D ҍ => b +48C Ҍ => 62 b +48D ҍ => 62 b 491 ґ => 490 Ґ -492 Ғ => F -493 ғ => F +492 Ғ => 46 F +493 ғ => 46 F 496 Җ => 416 Ж 497 җ => 416 Ж 498 Ҙ => 33 3 @@ -453,16 +453,16 @@ 4AB ҫ => 43 C 4AC Ҭ => 54 T 4AD ҭ => 54 T -4AE Ү => Y -4AF ү => Y -4B0 Ұ => Y -4B1 ұ => Y +4AE Ү => 59 Y +4AF ү => 59 Y +4B0 Ұ => 59 Y +4B1 ұ => 59 Y 4B2 Ҳ => 58 X 4B3 ҳ => 58 X -4B6 Ҷ => y -4B7 ҷ => y -4BA Һ => h -4BB һ => h +4B6 Ҷ => 79 y +4B7 ҷ => 79 y +4BA Һ => 68 h +4BB һ => 68 h 4BD ҽ => 4BC Ҽ 4BE Ҿ => 4BC Ҽ 4BF ҿ => 4BC Ҽ @@ -474,8 +474,8 @@ 4C8 ӈ => 48 H 4C9 Ӊ => 48 H 4CA ӊ => 48 H -4CB Ӌ => y -4CC ӌ => y +4CB Ӌ => 79 y +4CC ӌ => 79 y 4CD Ӎ => 4D M 4CE ӎ => 4D M 4D4 Ӕ => C6 Æ @@ -488,16 +488,16 @@ 4E8 Ө => 4F O 4E9 ө => 4F O 4EB ӫ => 4F O -500 Ԁ => d -501 ԁ => d +500 Ԁ => 64 d +501 ԁ => 64 d 50B ԋ => 48 H 50C Ԍ => 47 G 50D ԍ => 47 G 531 Ա => 561 ա -531 Ա => U +531 Ա => 55 U 532 Բ => 562 բ 533 Գ => 563 գ -533 Գ => q +533 Գ => 71 q 534 Դ => 564 դ 535 Ե => 565 ե 536 Զ => 566 զ @@ -515,7 +515,7 @@ 542 Ղ => 572 ղ 543 Ճ => 573 ճ 544 Մ => 574 մ -544 Մ => U +544 Մ => 55 U 545 Յ => 575 յ 545 Յ => 33 3 546 Ն => 576 ն @@ -537,16 +537,16 @@ 555 Օ => 585 օ 555 Օ => 30 0 556 Ֆ => 586 ֆ -563 գ => q -566 զ => q -570 հ => h -575 յ => j -578 ո => n -57C ռ => n -57D ս => u -581 ց => g -584 ք => p -585 օ => o +563 գ => 71 q +566 զ => 71 q +570 հ => 68 h +575 յ => 6A j +578 ո => 6E n +57C ռ => 6E n +57D ս => 75 u +581 ց => 67 g +584 ք => 70 p +585 օ => 6F o 589 ։ => 3A : 59C ֜ => 301 ́ 5AF ֯ => 30A ̊ @@ -701,44 +701,44 @@ 101D ဝ => 30 0 1036 ံ => 30A ̊ 1040 ၀ => 30 0 -10E7 ყ => y +10E7 ყ => 79 y 10F3 ჳ => 33 3 13A1 Ꭱ => 52 R 13A5 Ꭵ => 31 1 -13A9 Ꭹ => Y +13A9 Ꭹ => 59 Y 13AA Ꭺ => 41 A -13AB Ꭻ => J +13AB Ꭻ => 4A J 13AC Ꭼ => 45 E 13B1 Ꮁ => 52 R -13B3 Ꮃ => W +13B3 Ꮃ => 57 W 13B7 Ꮇ => 4D M 13BB Ꮋ => 48 H -13BD Ꮍ => y +13BD Ꮍ => 79 y 13BE Ꮎ => 4F O 13C0 Ꮐ => 47 G -13C2 Ꮒ => h +13C2 Ꮒ => 68 h 13C3 Ꮓ => 5A Z 13CE Ꮞ => 34 4 -13CF Ꮟ => b +13CF Ꮟ => 62 b 13D2
[MediaWiki-commits] [Gerrit] mediawiki...AbuseFilter[master]: Fix confusing warning message on throtthled filters
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/376091 ) Change subject: Fix confusing warning message on throtthled filters .. Fix confusing warning message on throtthled filters A confusing warning message was displayed when filters have af_throttled = true. That message was replaced with a new one reflecting the behavior that is actually ocurring and how to solve it Bug: T54321 Change-Id: I5c6e434249d5c9649eb2d7c5b16b9ecb1f530c8a --- M i18n/en.json M includes/Views/AbuseFilterViewEdit.php 2 files changed, 13 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter refs/changes/91/376091/1 diff --git a/i18n/en.json b/i18n/en.json index 649fc3e..7db1687 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -135,7 +135,7 @@ "abusefilter-edit-status-label": "Statistics:", "abusefilter-edit-status": "Of the last $1 {{PLURAL:$1|action|actions}}, this filter has matched $2 ($3%).", "abusefilter-edit-status-profile": "Of the last $1 {{PLURAL:$1|action|actions}}, this filter has matched $2 ($3%).\nOn average, its run time is $4 ms, and it consumes $5 {{PLURAL:$5|condition|conditions}} of the condition limit.", - "abusefilter-edit-throttled": "'''Warning:''' This filter was automatically disabled as a safety measure.\nIt reached the limit of matching more than $1% of actions.", + "abusefilter-edit-throttled": "'''Warning:''' This filter was automatically flagged as harmful. As a safety measure, the following actions will not execute ($1). Please review and [[mw:Extension:AbuseFilter/Conditions|optimize]] your conditions to remove this restriction", "abusefilter-edit-new": "New filter", "abusefilter-edit-save": "Save filter", "abusefilter-edit-id": "Filter ID:", diff --git a/includes/Views/AbuseFilterViewEdit.php b/includes/Views/AbuseFilterViewEdit.php index d4f6cc1..d33fc3e 100644 --- a/includes/Views/AbuseFilterViewEdit.php +++ b/includes/Views/AbuseFilterViewEdit.php @@ -527,18 +527,21 @@ } if ( isset( $row->af_throttled ) && $row->af_throttled ) { - global $wgAbuseFilterEmergencyDisableThreshold; + global $wgAbuseFilterRestrictions; - // determine emergency disable value for this action - $emergencyDisableThreshold = AbuseFilter::getEmergencyValue( - $wgAbuseFilterEmergencyDisableThreshold, - $row->af_group + $filterActions = explode( ',', $row->af_actions ); + + $throttledActions = array_intersect_key( + array_flip( $filterActions ), + array_filter( $wgAbuseFilterRestrictions ) ); - $threshold_percent = sprintf( '%.2f', $emergencyDisableThreshold * 100 ); - $flags .= $out->parse( - $this->msg( 'abusefilter-edit-throttled' )->numParams( $threshold_percent )->text() - ); + if ( !empty( $throttledActions ) ) { + $throttledActions = join( '|', array_keys( $throttledActions ) ); + $flags .= $out->parse( + $this->msg( 'abusefilter-edit-throttled' )->rawParams( $throttledActions )->text() + ); + } } foreach ( $checkboxes as $checkboxId ) { -- To view, visit https://gerrit.wikimedia.org/r/376091 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5c6e434249d5c9649eb2d7c5b16b9ecb1f530c8a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AbuseFilter Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Enable AbuseFilter runtime profile
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/375072 ) Change subject: Enable AbuseFilter runtime profile .. Enable AbuseFilter runtime profile Enable AbuseFilter runtime profile Bug: T161059 Change-Id: Icda1a20a5e7abd73363ee0b5f3c7c7823adae963 --- M wmf-config/InitialiseSettings.php 1 file changed, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/72/375072/1 diff --git a/wmf-config/InitialiseSettings.php b/wmf-config/InitialiseSettings.php index 4a4553e..80330e1 100644 --- a/wmf-config/InitialiseSettings.php +++ b/wmf-config/InitialiseSettings.php @@ -12956,10 +12956,18 @@ 'default' => 86400, ], ], - 'wgAbuseFilterParserClass' => [ 'default' => 'AbuseFilterParser', ], +'wgAbuseFilterRuntimeProfile' => [ + 'default' => false, + 'commonswiki' => true, + 'enwiki' => true, + 'mediawikiwiki' => true, + 'metawiki' => true, + 'testwiki' => true, + 'wikidatawiki' => true, +], # @} 'wgThumbLimits' => [ -- To view, visit https://gerrit.wikimedia.org/r/375072 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icda1a20a5e7abd73363ee0b5f3c7c7823adae963 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...AbuseFilter[master]: Add runtime metrics to statsd
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/373561 ) Change subject: Add runtime metrics to statsd .. Add runtime metrics to statsd Metrics per edit: - Execution time of all filters - Number of filters executed - Number of conditions executed Due to the current structure of abuse filter there was not a clean way to include filter actions and abuselog creation as part of the runtime metrics. Bug: T161059 Change-Id: I6208b620453863133c6623aa419775f63c7d3eb1 --- M AbuseFilter.php M extension.json M includes/AbuseFilter.class.php 3 files changed, 49 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter refs/changes/61/373561/1 diff --git a/AbuseFilter.php b/AbuseFilter.php index 4a06b06..7f13eaf 100644 --- a/AbuseFilter.php +++ b/AbuseFilter.php @@ -117,3 +117,8 @@ * Whether to record the average time taken and average number of conditions used by each filter. */ $wgAbuseFilterProfile = false; + +/** + * Whether to record runtime metrics for all filters combined. + */ +$wgAbuseFilterRuntimeProfile = false; diff --git a/extension.json b/extension.json index f8d3abc..a043b6c 100644 --- a/extension.json +++ b/extension.json @@ -248,7 +248,8 @@ "_merge_strategy": "array_plus" }, "AbuseFilterLogIPMaxAge": 7776000, - "AbuseFilterProfile": false + "AbuseFilterProfile": false, + "AbuseFilterRuntimeProfile": false }, "load_composer_autoloader": true, "manifest_version": 1 diff --git a/includes/AbuseFilter.class.php b/includes/AbuseFilter.class.php index 4b1418f..d041fa8 100644 --- a/includes/AbuseFilter.class.php +++ b/includes/AbuseFilter.class.php @@ -878,7 +878,7 @@ public static function filterAction( $vars, $title, $group = 'default', $user = null, $mode = 'execute' ) { - global $wgUser, $wgTitle, $wgRequest; + global $wgUser, $wgTitle, $wgRequest, $wgAbuseFilterRuntimeProfile; $context = RequestContext::getMain(); $oldContextTitle = $context->getTitle(); @@ -905,6 +905,10 @@ $cache = ObjectCache::getLocalClusterInstance(); $stashKey = self::getStashKey( $cache, $vars, $group ); $isForEdit = ( $vars->getVar( 'action' )->toString() === 'edit' ); + + if ( $wgAbuseFilterRuntimeProfile ) { + $startTime = microtime( true ); + } $filter_matched = false; if ( $mode === 'execute' && $isForEdit ) { @@ -933,6 +937,13 @@ if ( $mode === 'stash' ) { // Save the filter stash result and do nothing further $cacheData = [ 'matches' => $filter_matched, 'tags' => self::$tagsToSet ]; + + // Add runtime metrics in cache for later use + if ( $wgAbuseFilterRuntimeProfile ) { + $cacheData['condCount'] = self::$condCount; + $cacheData['runtime'] = ( microtime( true ) - $startTime ) * 1000; + } + $cache->set( $stashKey, $cacheData, $cache::TTL_MINUTE ); $logger->debug( __METHOD__ . ": cache store for '$title' (key $stashKey)." ); $statsd->increment( 'abusefilter.check-stash.store' ); @@ -942,13 +953,24 @@ $matched_filters = array_keys( array_filter( $filter_matched ) ); + // Save runtime metrics only on edits + if ( $wgAbuseFilterRuntimeProfile && $mode === 'execute' && $isForEdit ) { + if ( $cacheData ) { + $runtime = $cacheData['runtime']; + $condCount = $cacheData['condCount']; + } else { + $runtime = ( microtime( true ) - $startTime ) * 1000; + $condCount = self::$condCount; + } + + self::recordRuntimeProfilingResult( count( $matched_filters ), $condCount, $runtime ); + } + if ( count( $matched_filters ) == 0 ) { $status = Status::newGood(); } else { $status = self::executeFilterActions( $matched_filters, $title, $vars ); - $actions_taken = $status->getValue(); - $action = $vars->getVar( 'ACTION' )->toString(); // If $wgUser isn't safe to load (e.g. a failure during @@ -980,6 +1002,7 @@ if ( $wgTitle !== $oldWgTitle ) { $wgTitle = $oldWgTitle; } + if (
[MediaWiki-commits] [Gerrit] mediawiki...AbuseFilter[master]: Remove manual implementation of AntiSpoof::equivString
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/371205 ) Change subject: Remove manual implementation of AntiSpoof::equivString .. Remove manual implementation of AntiSpoof::equivString Cleaned ccnorm method to use AntiSpoof::normalizeString instead going after AntiSpoof extension files and doing a manual implementation of it. Also removed composer requirement for AntiSpoof extension. Bug: T172766 Depends-On: I731733671b650b6bb2f480c41c4f6f2d2f5c62e8 Change-Id: Ib38ba0b06918e81e8af03032eef95e3942773bc1 --- M composer.json M includes/parser/AbuseFilterParser.php 2 files changed, 10 insertions(+), 28 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter refs/changes/05/371205/1 diff --git a/composer.json b/composer.json index 485f881..ebfd697 100644 --- a/composer.json +++ b/composer.json @@ -6,8 +6,7 @@ "license": "GPL-2.0+", "require": { "php": ">=5.4", - "composer/installers": "1.*,>=1.0.1", - "mediawiki/anti-spoof": "dev-master" + "composer/installers": "1.*,>=1.0.1" }, "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", diff --git a/includes/parser/AbuseFilterParser.php b/includes/parser/AbuseFilterParser.php index 097e248..fc4528e 100644 --- a/includes/parser/AbuseFilterParser.php +++ b/includes/parser/AbuseFilterParser.php @@ -1106,34 +1106,17 @@ * @return mixed */ protected function ccnorm( $s ) { - static $replacementArray = null; - - if ( is_null( $replacementArray ) ) { - global $wgExtensionDirectory; - - if ( is_readable( "$wgExtensionDirectory/AntiSpoof/equivset.php" ) ) { - // Satisfy analyzer. - $equivset = null; - // Contains a map of characters in $equivset. - require "$wgExtensionDirectory/AntiSpoof/equivset.php"; - - // strtr in ReplacementArray->replace() doesn't like this. - if ( isset( $equivset[''] ) ) { - unset( $equivset[''] ); - } - - $replacementArray = new ReplacementArray( $equivset ); - } else { - // AntiSpoof isn't available, so just create a dummy - wfDebugLog( - 'AbuseFilter', - "Can't compute normalized string (ccnorm) as the AntiSpoof Extension isn't installed." - ); - $replacementArray = new ReplacementArray( [] ); - } + if ( is_callable( [ 'AntiSpoof' , 'normalizeString' ] ) ) { + $s = AntiSpoof::normalizeString( $s ); + } else { + // AntiSpoof isn't available, so ignore and return same string + wfDebugLog( + 'AbuseFilter', + "Can't compute normalized string (ccnorm) as the AntiSpoof Extension isn't installed." + ); } - return $replacementArray->replace( $s ); + return $s; } /** -- To view, visit https://gerrit.wikimedia.org/r/371205 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib38ba0b06918e81e8af03032eef95e3942773bc1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AbuseFilter Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...AntiSpoof[master]: Add normalizeString method
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/371204 ) Change subject: Add normalizeString method .. Add normalizeString method To make use of AntiSpoof normalization there was not a method that would take a string and return a normalized version of it. Grouping that functionality here will allow for later improvements on making it more strict. Bug: T172766 Change-Id: I731733671b650b6bb2f480c41c4f6f2d2f5c62e8 --- M AntiSpoof_body.php M tests/phpunit/AntiSpoofTest.php 2 files changed, 25 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AntiSpoof refs/changes/04/371204/1 diff --git a/AntiSpoof_body.php b/AntiSpoof_body.php index c5a7a5f..181babb 100644 --- a/AntiSpoof_body.php +++ b/AntiSpoof_body.php @@ -434,4 +434,12 @@ // And return the canonical version of the name return [ "OK", $testName ]; } + + /** +* @param $str +* @return string +*/ + public static function normalizeString( $str ) { + return self::listToString( self::equivString( self::stringToList( $str ) ) ); + } } diff --git a/tests/phpunit/AntiSpoofTest.php b/tests/phpunit/AntiSpoofTest.php index 73f2dd7..b1de8ad 100644 --- a/tests/phpunit/AntiSpoofTest.php +++ b/tests/phpunit/AntiSpoofTest.php @@ -3,7 +3,7 @@ public function providePositives() { return [ - /** Format: username -> spoofing attempt */ + /** Format: string -> spoofing attempt */ [ 'Laura Fiorucci', 'Låura Fiorucci' ], [ 'Lucien leGrey', 'Lucien le6rey' ], [ 'Poco a poco', 'Poco a ƿoco' ], @@ -18,13 +18,26 @@ * @covers AntiSpoof::checkUnicodeString * @dataProvider providePositives */ - public function testCheckUnicodeString( $userName, $spooferName ) { - $a = AntiSpoof::checkUnicodeString( $userName ); - $b = AntiSpoof::checkUnicodeString( $spooferName ); + public function testCheckUnicodeString( $strA, $strB ) { + $a = AntiSpoof::checkUnicodeString( $strA ); + $b = AntiSpoof::checkUnicodeString( $strB ); $this->assertEquals( 'OK', $a[0] ); $this->assertEquals( 'OK', $b[0] ); $this->assertEquals( $a[1], $b[1] ); } + + /** +* String normalization check +* +* @covers AntiSpoof:normalizeString: +* @dataProvider providePositives +*/ + public function testNormalizeString( $strA, $strB ) { + $a = AntiSpoof::normalizeString( $strA ); + $b = AntiSpoof::normalizeString( $strB ); + + $this->assertEquals( $a, $b ); + } } -- To view, visit https://gerrit.wikimedia.org/r/371204 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I731733671b650b6bb2f480c41c4f6f2d2f5c62e8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AntiSpoof Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...PageAssessments[master]: Fix Special:PageAssessments limit bug
Dmaza has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/364912 ) Change subject: Fix Special:PageAssessments limit bug .. Fix Special:PageAssessments limit bug Special:PageAssessments list limit was off by 1 Bug: T168600 Change-Id: I239d5e70bf147f035c1c5a1dc91c6b6cf8da2e1e --- M src/SpecialPage.php 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageAssessments refs/changes/12/364912/1 diff --git a/src/SpecialPage.php b/src/SpecialPage.php index 30d3142..8ab5c18 100644 --- a/src/SpecialPage.php +++ b/src/SpecialPage.php @@ -121,10 +121,8 @@ . Html::closeElement( 'tr' ) . Html::closeElement( 'thead' ) . Html::openElement( 'tbody' ); - $row = $res->fetchObject(); - while ( $row ) { + for ( $i = 0; $i < $num && $row = $res->fetchObject(); $i++ ) { $html .= $this->formatResult( $skin, $row ); - $row = $res->fetchObject(); } $html .= HTML::closeElement( 'tbody' ) . HTML::closeElement( 'table' ); -- To view, visit https://gerrit.wikimedia.org/r/364912 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I239d5e70bf147f035c1c5a1dc91c6b6cf8da2e1e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PageAssessments Gerrit-Branch: master Gerrit-Owner: Dmaza___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits