}
// Purge old, expired memberships from the DB
- JobQueueGroup::singleton()->push( new UserGroupExpiryJob() );
+ $hasExpiredRow = $dbw->selectField(
+ 'user_groups',
+ '1',
+ [ 'ug_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ],
+ __METHOD__
+ );
+ if ( $hasExpiredRow ) {
+ JobQueueGroup::singleton()->lazyPush( new UserGroupExpiryJob() );
+ }
// Check that the values make sense
if ( $this->group === null ) {
$lbFactory = $services->getDBLoadBalancerFactory();
$ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
- $dbw = $services->getDBLoadBalancer()->getConnection( DB_MASTER );
+ $dbw = $services->getDBLoadBalancer()->getConnectionRef( DB_MASTER );
- $lockKey = $dbw->getDomainID() . ':usergroups-prune'; // specific to this wiki
+ $lockKey = "{$dbw->getDomainID()}:UserGroupMembership:purge"; // per-wiki
$scopedLock = $dbw->getScopedLockAndFlush( $lockKey, __METHOD__, 0 );
if ( !$scopedLock ) {
return false; // already running
// link to the group description page, if it exists
$linkTitle = self::getGroupPage( $group );
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( $linkTitle ) {
if ( $format === 'wiki' ) {
$linkPage = $linkTitle->getFullText();
$groupLink = "[[$linkPage|$groupName]]";
} else {
- $groupLink = Linker::link( $linkTitle, htmlspecialchars( $groupName ) );
+ $groupLink = $linkRenderer->makeLink( $linkTitle, $groupName );
}
} else {
$groupLink = htmlspecialchars( $groupName );