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:
Aaron Schulz 2016-06-27 13:05:23 -07:00
parent 6af0857c55
commit 4091c87bad
3 changed files with 8 additions and 12 deletions

View file

@ -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 ) );

View file

@ -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' );
},

View file

@ -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