diff --git a/extension.json b/extension.json index 8c26fd2a..fb244da5 100644 --- a/extension.json +++ b/extension.json @@ -18,7 +18,8 @@ } }, "AvailableRights": [ - "spamblacklistlog" + "spamblacklistlog", + "sboverride" ], "LogTypes": [ "spamblacklist" diff --git a/i18n/en.json b/i18n/en.json index 52a9be86..3b69cacf 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -10,11 +10,13 @@ "spam-blacklisted-email-text": "Your email address is currently forbidden from sending emails to other users.", "spam-blacklisted-email-signup": "The given email address is currently forbidden from use.", "spam-blacklisted-link": "{{int:spamprotectiontext}}\n{{int:spamprotectionmatch|$1}}", - "spam-invalid-lines": "The following spam block list {{PLURAL:$1|line is an|lines are}} invalid regular {{PLURAL:$1|expression|expressions}} and {{PLURAL:$1|needs|need}} to be corrected before saving the page:", - "spam-blacklist-desc": "Regex-based anti-spam tool allowing to forbid URLs in pages and email addresses for registered users", - "log-name-spamblacklist": "Spam block list log", - "log-description-spamblacklist": "These events track spam block list hits.", - "logentry-spamblacklist-hit": "{{GENDER:$2|$1}} caused a spam block list hit on $3 by attempting to add $4.", - "right-spamblacklistlog": "View the spam block list log", - "action-spamblacklistlog": "view the spam block list log" + "spam-invalid-lines": "The following spam blacklist {{PLURAL:$1|line is an|lines are}} invalid regular {{PLURAL:$1|expression|expressions}} and {{PLURAL:$1|needs|need}} to be corrected before saving the page:", + "spam-blacklist-desc": "Regex-based anti-spam tool allowing to blacklist URLs in pages and email addresses for registered users", + "log-name-spamblacklist": "Spam blacklist log", + "log-description-spamblacklist": "These events track spam blacklist hits.", + "logentry-spamblacklist-hit": "{{GENDER:$2|$1}} caused a spam blacklist hit on $3 by attempting to add $4.", + "right-spamblacklistlog": "View the spam blacklist log", + "action-spamblacklistlog": "view the spam blacklist log", + "right-sboverride": "Bypass the spam blacklist", + "action-sboverride": "Bypass the spam blacklist" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 981a6449..e3ee3f50 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -24,5 +24,7 @@ "log-description-spamblacklist": "Description of spam blacklist log", "logentry-spamblacklist-hit": "Log entry that is created when a user adds a link that is forbidden by the spam blacklist.\n\n{{logentry}}\nAdditional parameters:\n* $4 - the URL the user tried to add", "right-spamblacklistlog": "{{doc-right|spamblacklistlog}}", - "action-spamblacklistlog": "{{doc-action|spamblacklistlog}}" + "action-spamblacklistlog": "{{doc-action|spamblacklistlog}}", + "right-sboverride": "{{doc-right|sboverride}}", + "action-sboverride": "{{doc-action|sboverride}}" } diff --git a/includes/Hooks.php b/includes/Hooks.php index 148a3c2c..8eca345e 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -61,6 +61,12 @@ class Hooks implements User $user, $minoredit ) { + if ( MediaWikiServices::getInstance()->getPermissionManager() + ->userHasRight( $user, 'sboverride' ) + ) { + return true; + } + $title = $context->getTitle(); try { // Try getting the update directly @@ -251,6 +257,12 @@ class Hooks implements $pageText, &$error ) { + if ( MediaWikiServices::getInstance()->getPermissionManager() + ->userHasRight( $user, 'sboverride' ) + ) { + return; + } + $title = $upload->getTitle(); // get the link from the not-yet-saved page content.