mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-27 15:30:42 +00:00
Remove "minor_edit" variable
This is almost never used and greatly complicates edit stash hooks. It now always set to false. Change-Id: I7f13773766e12f3d4b86451fdf3ae23e067ac373
This commit is contained in:
parent
6af0857c55
commit
4091c87bad
|
@ -2077,7 +2077,6 @@ class AbuseFilter {
|
|||
|
||||
$vars->setVar( 'ACTION', 'edit' );
|
||||
$vars->setVar( 'SUMMARY', $row->rc_comment );
|
||||
$vars->setVar( 'minor_edit', $row->rc_minor );
|
||||
|
||||
$vars->setLazyLoadVar( 'new_wikitext', 'revision-text-by-id',
|
||||
array( 'revid' => $row->rc_this_oldid ) );
|
||||
|
|
|
@ -114,7 +114,7 @@ class AbuseFilterHooks {
|
|||
|
||||
// Load vars for filters to check
|
||||
$vars = self::newVariableHolderForEdit(
|
||||
$user, $title, $page, $summary, $minoredit, $oldtext, $text
|
||||
$user, $title, $page, $summary, $oldtext, $text
|
||||
);
|
||||
|
||||
$filter_result = AbuseFilter::filterAction( $vars, $title );
|
||||
|
@ -135,14 +135,13 @@ class AbuseFilterHooks {
|
|||
* @param Title $title
|
||||
* @param WikiPage|null $page
|
||||
* @param string $summary
|
||||
* @param bool $minoredit
|
||||
* @param string $oldtext
|
||||
* @param string $text
|
||||
* @return AbuseFilterVariableHolder
|
||||
* @throws MWException
|
||||
*/
|
||||
private static function newVariableHolderForEdit(
|
||||
User $user, Title $title, $page, $summary, $minoredit, $oldtext, $text
|
||||
User $user, Title $title, $page, $summary, $oldtext, $text
|
||||
) {
|
||||
$vars = new AbuseFilterVariableHolder();
|
||||
$vars->addHolders(
|
||||
|
@ -151,7 +150,6 @@ class AbuseFilterHooks {
|
|||
);
|
||||
$vars->setVar( 'action', 'edit' );
|
||||
$vars->setVar( 'summary', $summary );
|
||||
$vars->setVar( 'minor_edit', $minoredit );
|
||||
$vars->setVar( 'old_wikitext', $oldtext );
|
||||
$vars->setVar( 'new_wikitext', $text );
|
||||
// TODO: set old_content and new_content vars, use them
|
||||
|
@ -801,14 +799,8 @@ class AbuseFilterHooks {
|
|||
// Do this outside the synchronous stash lock to avoid any chance of slowdown.
|
||||
DeferredUpdates::addCallableUpdate(
|
||||
function () use ( $user, $page, $summary, $oldtext, $text ) {
|
||||
// Case A: if the edit turns out to be non-minor
|
||||
$vars = self::newVariableHolderForEdit(
|
||||
$user, $page->getTitle(), $page, $summary, false, $oldtext, $text
|
||||
);
|
||||
AbuseFilter::filterAction( $vars, $page->getTitle(), 'default', $user, 'stash' );
|
||||
// Case B: if the edit turns out to be minor
|
||||
$vars = self::newVariableHolderForEdit(
|
||||
$user, $page->getTitle(), $page, $summary, true, $oldtext, $text
|
||||
$user, $page->getTitle(), $page, $summary, $oldtext, $text
|
||||
);
|
||||
AbuseFilter::filterAction( $vars, $page->getTitle(), 'default', $user, 'stash' );
|
||||
},
|
||||
|
|
|
@ -4,6 +4,11 @@ class AbuseFilterVariableHolder {
|
|||
|
||||
public static $varBlacklist = array( 'context' );
|
||||
|
||||
public function __construct() {
|
||||
// Backwards-compatibility (unused now)
|
||||
$this->setVar( 'minor_edit', false );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $variable
|
||||
* @param $datum
|
||||
|
|
Loading…
Reference in a new issue