This feature flag was added to comply with WMF's schema change policy.
It is no longer needed now that the feature is enabled on WMF sites.
External MW installations will run update.php or manually do DB updates
as required before upgrading MW.
Bug: T162517
Change-Id: I5b532d79fd1e8b178490cf2617499ae62967de2c
$wgNamespacesWithSubpages[NS_TEMPLATE] to false to keep the old behavior.
* $wgRunJobsAsync is now false by default (T142751). This change only affects
wikis with $wgJobRunRate > 0.
-* A temporary feature flag, $wgDisableUserGroupExpiry, is provided to disable
- new features that rely on the schema changes to the user_groups table. This
- feature flag will likely be removed before 1.29 is released.
* (T158474) "Unknown user" has been added to $wgReservedUsernames.
* (T156983) $wgRateLimitsExcludedIPs now accepts CIDR ranges as well as single IPs.
* $wgDummyLanguageCodes is deprecated. Additional language code mappings may be
*/
$wgBotPasswordsDatabase = false;
-/**
- * Whether to disable user group expiry. This is a transitional feature flag
- * in accordance with WMF schema change policy, and will be removed later
- * (hopefully before MW 1.29 release).
- *
- * @since 1.29
- */
-$wgDisableUserGroupExpiry = false;
-
/** @} */ # end of user rights settings
/************************************************************************//**
wfMemcKey( 'SiteStats', 'groupcounts', $group ),
$cache::TTL_HOUR,
function ( $oldValue, &$ttl, array &$setOpts ) use ( $group ) {
- global $wgDisableUserGroupExpiry;
$dbr = wfGetDB( DB_REPLICA );
$setOpts += Database::getCacheSetOptions( $dbr );
'COUNT(*)',
[
'ug_group' => $group,
- $wgDisableUserGroupExpiry ?
- '1' :
- 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
+ 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
],
__METHOD__
);
[
'ug_group' => User::getGroupsWithPermission( 'bot' ),
'ug_user = img_user',
- $this->getConfig()->get( 'DisableUserGroupExpiry' ) ?
- '1' :
- 'ug_expiry IS NULL OR ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
+ 'ug_expiry IS NULL OR ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
]
] ] );
$groupCond = ( $params['filterbots'] == 'nobots' ? 'NULL' : 'NOT NULL' );
[
'ug1.ug_user=user_id',
'ug1.ug_group' => $params['group'],
- $this->getConfig()->get( 'DisableUserGroupExpiry' ) ?
- '1' :
- 'ug1.ug_expiry IS NULL OR ug1.ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
+ 'ug1.ug_expiry IS NULL OR ug1.ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
]
]
] );
$this->addJoinConds( [ 'ug1' => [ 'LEFT OUTER JOIN',
array_merge( [
'ug1.ug_user=user_id',
- $this->getConfig()->get( 'DisableUserGroupExpiry' ) ?
- '1' :
- 'ug1.ug_expiry IS NULL OR ug1.ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
+ 'ug1.ug_expiry IS NULL OR ug1.ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
], $exclude )
] ] );
$this->addWhere( 'ug1.ug_user IS NULL' );
$this->addFields( [ 'groups' =>
$db->buildGroupConcatField( '|', 'user_groups', 'ug_group', [
'ug_user=user_id',
- $this->getConfig()->get( 'DisableUserGroupExpiry' ) ?
- '1' :
- 'ug_expiry IS NULL OR ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
+ 'ug_expiry IS NULL OR ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
] )
] );
}
[
'ug_user=rev_user',
'ug_group' => $limitGroups,
- $this->getConfig()->get( 'DisableUserGroupExpiry' ) ?
- '1' :
- 'ug_expiry IS NULL OR ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
+ 'ug_expiry IS NULL OR ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
]
] ] );
$this->addWhereIf( 'ug_user IS NULL', $excludeGroups );
$this->addJoinConds( [ 'user_groups' => [ 'INNER JOIN', 'ug_user=user_id' ] ] );
$this->addFields( [ 'user_name' ] );
$this->addFields( UserGroupMembership::selectFields() );
- if ( !$this->getConfig()->get( 'DisableUserGroupExpiry' ) ) {
- $this->addWhere( 'ug_expiry IS NULL OR ug_expiry >= ' .
- $db->addQuotes( $db->timestamp() ) );
- }
+ $this->addWhere( 'ug_expiry IS NULL OR ug_expiry >= ' .
+ $db->addQuotes( $db->timestamp() ) );
$userGroupsRes = $this->select( __METHOD__ );
foreach ( $userGroupsRes as $row ) {
$params = $this->extractRequestParams();
// Figure out expiry times from the input
- // @todo Remove this isset check when removing $wgDisableUserGroupExpiry
+ // $params['expiry'] may not be set in subclasses
if ( isset( $params['expiry'] ) ) {
$expiry = (array)$params['expiry'];
} else {
* @return bool
*/
public function canProcessExpiries() {
- return !$this->getConfig()->get( 'DisableUserGroupExpiry' );
+ return true;
}
/**
$tables[] = 'user_groups';
$conds[] = 'ug_user = user_id';
$conds['ug_group'] = $this->groups;
- if ( !$this->getConfig()->get( 'DisableUserGroupExpiry' ) ) {
- $conds[] = 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() );
- }
+ $conds[] = 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() );
}
if ( $this->excludegroups !== [] ) {
foreach ( $this->excludegroups as $group ) {
'user_groups', '1', [
'ug_user = user_id',
'ug_group' => $group,
- $this->getConfig()->get( 'DisableUserGroupExpiry' ) ?
- '1' :
- 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
+ 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
]
) . ')';
}
'LEFT JOIN', [
'ug_user = rev_user',
'ug_group' => $groupsWithBotPermission,
- $this->getConfig()->get( 'DisableUserGroupExpiry' ) ?
- '1' :
- 'ug_expiry IS NULL OR ug_expiry >= ' .
- $this->mDb->addQuotes( $this->mDb->timestamp() )
+ 'ug_expiry IS NULL OR ug_expiry >= ' .
+ $this->mDb->addQuotes( $this->mDb->timestamp() )
]
];
}
[
'ug_group' => $groupsWithBotPermission,
'ug_user = img_user',
- $this->getConfig()->get( 'DisableUserGroupExpiry' ) ?
- '1' :
- 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
+ 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
]
];
}
if ( $this->requestedGroup != '' ) {
$conds['ug_group'] = $this->requestedGroup;
- if ( !$this->getConfig()->get( 'DisableUserGroupExpiry' ) ) {
- $conds[] = 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() );
- }
+ $conds[] = 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() );
}
if ( $this->requestedUser != '' ) {
* @param string|null $expiry Timestamp of expiry in TS_MW format, or null if no expiry
*/
public function __construct( $userId = 0, $group = null, $expiry = null ) {
- global $wgDisableUserGroupExpiry;
- if ( $wgDisableUserGroupExpiry ) {
- $expiry = null;
- }
-
$this->userId = (int)$userId;
$this->group = $group; // TODO throw on invalid group?
$this->expiry = $expiry ?: null;
* @return string|null Timestamp of expiry in TS_MW format, or null if no expiry
*/
public function getExpiry() {
- global $wgDisableUserGroupExpiry;
- if ( $wgDisableUserGroupExpiry ) {
- return null;
- }
-
return $this->expiry;
}
protected function initFromRow( $row ) {
- global $wgDisableUserGroupExpiry;
-
$this->userId = (int)$row->ug_user;
$this->group = $row->ug_group;
- if ( $wgDisableUserGroupExpiry ) {
- $this->expiry = null;
- } else {
- $this->expiry = $row->ug_expiry === null ?
- null :
- wfTimestamp( TS_MW, $row->ug_expiry );
- }
+ $this->expiry = $row->ug_expiry === null ?
+ null :
+ wfTimestamp( TS_MW, $row->ug_expiry );
}
/**
* @return array
*/
public static function selectFields() {
- global $wgDisableUserGroupExpiry;
- if ( $wgDisableUserGroupExpiry ) {
- return [
- 'ug_user',
- 'ug_group',
- ];
- } else {
- return [
- 'ug_user',
- 'ug_group',
- 'ug_expiry',
- ];
- }
+ return [
+ 'ug_user',
+ 'ug_group',
+ 'ug_expiry',
+ ];
}
/**
* @return bool Whether or not anything was deleted
*/
public function delete( IDatabase $dbw = null ) {
- global $wgDisableUserGroupExpiry;
if ( wfReadOnly() ) {
return false;
}
$dbw = wfGetDB( DB_MASTER );
}
- if ( $wgDisableUserGroupExpiry ) {
- $dbw->delete( 'user_groups', $this->getDatabaseArray( $dbw ), __METHOD__ );
- } else {
- $dbw->delete(
- 'user_groups',
- [ 'ug_user' => $this->userId, 'ug_group' => $this->group ],
- __METHOD__ );
- }
+ $dbw->delete(
+ 'user_groups',
+ [ 'ug_user' => $this->userId, 'ug_group' => $this->group ],
+ __METHOD__ );
if ( !$dbw->affectedRows() ) {
return false;
}
* @return bool Whether or not anything was inserted
*/
public function insert( $allowUpdate = false, IDatabase $dbw = null ) {
- global $wgDisableUserGroupExpiry;
if ( $dbw === null ) {
$dbw = wfGetDB( DB_MASTER );
}
// Don't collide with expired user group memberships
// Do this after trying to insert, in order to avoid locking
- if ( !$wgDisableUserGroupExpiry && !$affected ) {
+ if ( !$affected ) {
$conds = [
'ug_user' => $row['ug_user'],
'ug_group' => $row['ug_group'],
* @return array
*/
protected function getDatabaseArray( IDatabase $db ) {
- global $wgDisableUserGroupExpiry;
-
- $a = [
+ return [
'ug_user' => $this->userId,
'ug_group' => $this->group,
+ 'ug_expiry' => $this->expiry ? $db->timestamp( $this->expiry ) : null,
];
- if ( !$wgDisableUserGroupExpiry ) {
- $a['ug_expiry'] = $this->expiry ? $db->timestamp( $this->expiry ) : null;
- }
- return $a;
}
/**
* @return bool
*/
public function isExpired() {
- global $wgDisableUserGroupExpiry;
- if ( $wgDisableUserGroupExpiry || !$this->expiry ) {
+ if ( !$this->expiry ) {
return false;
} else {
return wfTimestampNow() > $this->expiry;
* @param IDatabase|null $dbw
*/
public static function purgeExpired( IDatabase $dbw = null ) {
- global $wgDisableUserGroupExpiry;
- if ( $wgDisableUserGroupExpiry || wfReadOnly() ) {
+ if ( wfReadOnly() ) {
return;
}