diff --git a/RELEASE-NOTES-1.37 b/RELEASE-NOTES-1.37 index 99ef994b516..1d295f7330a 100644 --- a/RELEASE-NOTES-1.37 +++ b/RELEASE-NOTES-1.37 @@ -87,6 +87,8 @@ because of Phabricator reports. handler without changing the status, the edit form will now be displayed. * User::clearNotification() which had been deprecated in 1.35 has been removed. Use WatchlistManager::clearTitleUserNotification() instead. +* Autopromote class, deprecated since 1.35, was removed. Use + UserGroupManager instead. === Deprecations in 1.37 === * JobQueue::getWiki, deprecated in 1.33, now emits deprecation warnings. diff --git a/autoload.php b/autoload.php index 1bea16509d4..ece09e5b32e 100644 --- a/autoload.php +++ b/autoload.php @@ -170,7 +170,6 @@ $wgAutoloadLocalClasses = [ 'AuthManagerSpecialPage' => __DIR__ . '/includes/specialpage/AuthManagerSpecialPage.php', 'AutoCommitUpdate' => __DIR__ . '/includes/deferred/AutoCommitUpdate.php', 'AutoloadGenerator' => __DIR__ . '/includes/utils/AutoloadGenerator.php', - 'Autopromote' => __DIR__ . '/includes/Autopromote.php', 'BacklinkCache' => __DIR__ . '/includes/cache/BacklinkCache.php', 'BacklinkJobUtils' => __DIR__ . '/includes/jobqueue/utils/BacklinkJobUtils.php', 'BackupDumper' => __DIR__ . '/maintenance/includes/BackupDumper.php', diff --git a/includes/Autopromote.php b/includes/Autopromote.php deleted file mode 100644 index b90796b2061..00000000000 --- a/includes/Autopromote.php +++ /dev/null @@ -1,70 +0,0 @@ -getUserGroupManager() - ->getUserAutopromoteGroups( $user ); - } - - /** - * Get the groups for the given user based on the given criteria. - * - * Does not return groups the user already belongs to or has once belonged. - * - * - * @param User $user The user to get the groups for - * @param string $event Key in $wgAutopromoteOnce (each one has groups/criteria) - * - * @return string[] Groups the user should be promoted to. - * - * @see $wgAutopromoteOnce - * - * @deprecated since 1.35 (hard deprecated since 1.36). Use UserGroupManager::getUserAutopromoteOnceGroups. - */ - public static function getAutopromoteOnceGroups( User $user, $event ) { - wfDeprecated( __METHOD__, '1.35' ); - - return MediaWikiServices::getInstance() - ->getUserGroupManager() - ->getUserAutopromoteOnceGroups( $user, $event ); - } -} diff --git a/tests/phpunit/includes/AutopromoteTest.php b/tests/phpunit/includes/AutopromoteTest.php deleted file mode 100644 index 3ab2c970873..00000000000 --- a/tests/phpunit/includes/AutopromoteTest.php +++ /dev/null @@ -1,66 +0,0 @@ -hideDeprecated( 'Autopromote::getAutopromoteGroups' ); - - $this->setMwGlobals( [ - 'wgAutopromote' => [ - 'autoconfirmed' => [ APCOND_EDITCOUNT, $requirement ] - ] - ] ); - - $user = $this->getTestUser()->getUser(); - $userEditTrackerMock = $this->createNoOpMock( - UserEditTracker::class, - [ 'getUserEditCount' ] - ); - if ( $requirement > 0 ) { - $userEditTrackerMock->expects( $this->once() ) - ->method( 'getUserEditCount' ) - ->with( $user ) - ->willReturn( $editCount ); - } else { - $userEditTrackerMock->expects( $this->never() ) - ->method( 'getUserEditCount' ); - } - $this->setService( 'UserEditTracker', $userEditTrackerMock ); - - $result = Autopromote::getAutopromoteGroups( $user ); - if ( $editCount >= $requirement ) { - $this->assertContains( - 'autoconfirmed', - $result, - 'User must be promoted if they meet edit count requirement' - ); - } else { - $this->assertNotContains( - 'autoconfirmed', - $result, - 'User must not be promoted if they fail edit count requirement' - ); - } - } - - public static function provideEditCountsAndRequirements() { - return [ - 'user with sufficient editcount' => [ 100, 10 ], - 'user with insufficient editcount' => [ 4, 10 ], - 'edit count requirement set to 0' => [ 1, 0 ], - ]; - } -}