Really disable the minor_edit variable

The variable was disabled with I7f13773766e12f3d4b86451fdf3ae23e067ac373
in 2016, but not in the same way as old_text and old_html were disabled
in 2009. This patch uses the methods introduced with
Ife168522e6b1d8eb94ebbb8a16ae8831ec1dc497 to disable minor_edit in a
standard way, so that it won't be showed in new AbuseLog entries, and
won't be usable when writing filter syntax.
A warning will be emitted if a pre-existing filter is using it, so that
we'll be able to completely disable it in the future.

Change-Id: I5ad5219ee19a5e6ba2bfdffb4e0aad63c8951491
This commit is contained in:
Daimona Eaytoy 2018-12-29 14:14:27 +01:00
parent e7684d8925
commit 921db0397e
4 changed files with 6 additions and 9 deletions

View file

@ -381,7 +381,7 @@
"abusefilter-edit-builder-vars-old-text-stripped": "Old page text, stripped of any markup",
"abusefilter-edit-builder-vars-old-links": "Links in the page, before the edit",
"abusefilter-edit-builder-vars-old-html": "Old page wikitext, parsed into HTML (no more in use)",
"abusefilter-edit-builder-vars-minor-edit": "Whether or not the edit is marked as minor",
"abusefilter-edit-builder-vars-minor-edit": "Whether or not the edit is marked as minor (no more in use)",
"abusefilter-edit-builder-vars-file-sha1": "SHA1 hash of file contents",
"abusefilter-edit-builder-vars-file-size": "Size of the file in bytes",
"abusefilter-edit-builder-vars-file-mime": "MIME type of the file",

View file

@ -161,7 +161,6 @@ class AbuseFilter {
'moved_to_recent_contributors' => 'movedto-recent-contributors',
'moved_to_first_contributor' => 'movedto-first-contributor',
'old_links' => 'old-links',
'minor_edit' => 'minor-edit',
'file_sha1' => 'file-sha1',
'file_size' => 'file-size',
'file_mime' => 'file-mime',
@ -175,7 +174,8 @@ class AbuseFilter {
/** @var array Old vars which aren't in use anymore */
public static $disabledVars = [
'old_text' => 'old-text-stripped',
'old_html' => 'old-html'
'old_html' => 'old-html',
'minor_edit' => 'minor-edit'
];
public static $deprecatedVars = [

View file

@ -821,7 +821,6 @@ class AbuseFilterHooks {
// Load vars for filters to check
$vars->setVar( 'summary', $summary );
$vars->setVar( 'minor_edit', false );
$vars->setVar( 'old_wikitext', $oldtext );
$vars->setVar( 'new_wikitext', $text );
// TODO: set old_content and new_content vars, use them

View file

@ -13,11 +13,6 @@ class AbuseFilterVariableHolder {
*/
public $mVarsVersion = 2;
public function __construct() {
// Backwards-compatibility (unused now)
$this->setVar( 'minor_edit', false );
}
/**
* @param string $variable
* @param mixed $datum
@ -63,6 +58,9 @@ class AbuseFilterVariableHolder {
} elseif ( $this->mVars[$variable] instanceof AFPData ) {
return $this->mVars[$variable];
}
} elseif ( array_key_exists( $variable, AbuseFilter::$disabledVars ) ) {
wfWarn( "Disabled variable $variable requested. Please fix the filter as this will " .
"be removed soon." );
}
return new AFPData();
}