diff --git a/includes/ChangeTags/ChangeTagger.php b/includes/ChangeTags/ChangeTagger.php index 71933df40..a54e0fe1d 100644 --- a/includes/ChangeTags/ChangeTagger.php +++ b/includes/ChangeTags/ChangeTagger.php @@ -98,6 +98,7 @@ class ChangeTagger { $logType = $recentChange->getAttribute( 'rc_log_type' ) ?: 'edit'; if ( $logType === 'newusers' ) { + // XXX: as of 1.43, the following is never true $action = $recentChange->getAttribute( 'rc_log_action' ) === 'autocreate' ? 'autocreateaccount' : 'createaccount'; diff --git a/includes/VariableGenerator/RCVariableGenerator.php b/includes/VariableGenerator/RCVariableGenerator.php index 9783eea4c..0d4a48624 100644 --- a/includes/VariableGenerator/RCVariableGenerator.php +++ b/includes/VariableGenerator/RCVariableGenerator.php @@ -68,7 +68,7 @@ class RCVariableGenerator extends VariableGenerator { * @return VariableHolder|null */ public function getVars(): ?VariableHolder { - if ( $this->rc->getAttribute( 'rc_type' ) == RC_LOG ) { + if ( $this->rc->getAttribute( 'rc_source' ) === RecentChange::SRC_LOG ) { switch ( $this->rc->getAttribute( 'rc_log_type' ) ) { case 'move': $this->addMoveVars(); @@ -136,6 +136,7 @@ class RCVariableGenerator extends VariableGenerator { private function addCreateAccountVars(): self { $this->vars->setVar( 'action', + // XXX: as of 1.43, the following is never true $this->rc->getAttribute( 'rc_log_action' ) === 'autocreate' ? 'autocreateaccount' : 'createaccount' diff --git a/includes/View/AbuseFilterView.php b/includes/View/AbuseFilterView.php index a045f1e7d..6a1b87e35 100644 --- a/includes/View/AbuseFilterView.php +++ b/includes/View/AbuseFilterView.php @@ -15,6 +15,7 @@ use MediaWiki\Title\Title; use OOUI; use RecentChange; use UnexpectedValueException; +use Wikimedia\Assert\Assert; use Wikimedia\Rdbms\IExpression; use Wikimedia\Rdbms\IReadableDatabase; use Wikimedia\Rdbms\OrExpressionGroup; @@ -24,29 +25,22 @@ abstract class AbuseFilterView extends ContextSource { private const MAP_ACTION_TO_LOG_TYPE = [ // action => [ rc_log_type, rc_log_action ] - 'move' => [ 'move', 'move' ], - 'createaccount' => [ 'newusers', [ 'create', 'autocreate' ] ], + 'move' => [ 'move', [ 'move', 'move_redir' ] ], + 'createaccount' => [ 'newusers', [ 'create', 'create2', 'byemail', 'autocreate' ] ], 'delete' => [ 'delete', 'delete' ], 'upload' => [ 'upload', [ 'upload', 'overwrite', 'revert' ] ], ]; - /** - * @var AbuseFilterPermissionManager - */ - protected $afPermManager; + protected AbuseFilterPermissionManager $afPermManager; /** * @var array The parameters of the current request */ - protected $mParams; + protected array $mParams; - /** - * @var LinkRenderer - */ - protected $linkRenderer; + protected LinkRenderer $linkRenderer; - /** @var string */ - protected $basePageName; + protected string $basePageName; /** * @param AbuseFilterPermissionManager $afPermManager @@ -125,6 +119,7 @@ abstract class AbuseFilterView extends ContextSource { * @return IExpression */ public function buildTestConditions( IReadableDatabase $db, $action = false ) { + Assert::parameterType( [ 'string', 'false' ], $action, '$action' ); $editSources = [ RecentChange::SRC_EDIT, RecentChange::SRC_NEW,