jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/347594 )
Change subject: Remove $wgDisableUserGroupExpiry feature flag
......................................................................
Remove $wgDisableUserGroupExpiry feature flag
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
---
M HISTORY
M includes/DefaultSettings.php
M includes/SiteStats.php
M includes/api/ApiQueryAllImages.php
M includes/api/ApiQueryAllUsers.php
M includes/api/ApiQueryContributors.php
M includes/api/ApiQueryUsers.php
M includes/api/ApiUserrights.php
M includes/specials/SpecialUserrights.php
M includes/specials/pagers/ActiveUsersPager.php
M includes/specials/pagers/ContribsPager.php
M includes/specials/pagers/NewFilesPager.php
M includes/specials/pagers/UsersPager.php
M includes/user/UserGroupMembership.php
14 files changed, 33 insertions(+), 107 deletions(-)
Approvals:
Florianschmidtwelzow: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY b/HISTORY
index be90221..9259814 100644
--- a/HISTORY
+++ b/HISTORY
@@ -27,9 +27,6 @@
$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
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 7c18fcc..f8d2d75 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -5912,15 +5912,6 @@
*/
$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
/************************************************************************//**
diff --git a/includes/SiteStats.php b/includes/SiteStats.php
index ac5e49e..d253805 100644
--- a/includes/SiteStats.php
+++ b/includes/SiteStats.php
@@ -194,7 +194,6 @@
wfMemcKey( 'SiteStats', 'groupcounts', $group ),
$cache::TTL_HOUR,
function ( $oldValue, &$ttl, array &$setOpts ) use (
$group ) {
- global $wgDisableUserGroupExpiry;
$dbr = wfGetDB( DB_REPLICA );
$setOpts += Database::getCacheSetOptions( $dbr
);
@@ -204,9 +203,7 @@
'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__
);
diff --git a/includes/api/ApiQueryAllImages.php
b/includes/api/ApiQueryAllImages.php
index daeedbe..250bee6 100644
--- a/includes/api/ApiQueryAllImages.php
+++ b/includes/api/ApiQueryAllImages.php
@@ -205,9 +205,7 @@
[
'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' );
diff --git a/includes/api/ApiQueryAllUsers.php
b/includes/api/ApiQueryAllUsers.php
index 0f0b2af..fd95e17 100644
--- a/includes/api/ApiQueryAllUsers.php
+++ b/includes/api/ApiQueryAllUsers.php
@@ -122,9 +122,7 @@
[
'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() )
]
]
] );
@@ -147,9 +145,7 @@
$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' );
@@ -165,9 +161,7 @@
$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() )
] )
] );
}
diff --git a/includes/api/ApiQueryContributors.php
b/includes/api/ApiQueryContributors.php
index 183409d..693d954 100644
--- a/includes/api/ApiQueryContributors.php
+++ b/includes/api/ApiQueryContributors.php
@@ -163,9 +163,7 @@
[
'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 );
diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php
index 4515f7f..a5d06c8 100644
--- a/includes/api/ApiQueryUsers.php
+++ b/includes/api/ApiQueryUsers.php
@@ -172,10 +172,8 @@
$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 ) {
diff --git a/includes/api/ApiUserrights.php b/includes/api/ApiUserrights.php
index d857e4a..2a364d9 100644
--- a/includes/api/ApiUserrights.php
+++ b/includes/api/ApiUserrights.php
@@ -58,7 +58,7 @@
$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 {
diff --git a/includes/specials/SpecialUserrights.php
b/includes/specials/SpecialUserrights.php
index 127b530..002b47c 100644
--- a/includes/specials/SpecialUserrights.php
+++ b/includes/specials/SpecialUserrights.php
@@ -215,7 +215,7 @@
* @return bool
*/
public function canProcessExpiries() {
- return !$this->getConfig()->get( 'DisableUserGroupExpiry' );
+ return true;
}
/**
diff --git a/includes/specials/pagers/ActiveUsersPager.php
b/includes/specials/pagers/ActiveUsersPager.php
index 0d6f493..e2f4d4b 100644
--- a/includes/specials/pagers/ActiveUsersPager.php
+++ b/includes/specials/pagers/ActiveUsersPager.php
@@ -101,9 +101,7 @@
$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 ) {
@@ -111,9 +109,7 @@
'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() )
]
) . ')';
}
diff --git a/includes/specials/pagers/ContribsPager.php
b/includes/specials/pagers/ContribsPager.php
index 1133625..7d303de 100644
--- a/includes/specials/pagers/ContribsPager.php
+++ b/includes/specials/pagers/ContribsPager.php
@@ -228,10 +228,8 @@
'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() )
]
];
}
diff --git a/includes/specials/pagers/NewFilesPager.php
b/includes/specials/pagers/NewFilesPager.php
index b781930..e2d9d42 100644
--- a/includes/specials/pagers/NewFilesPager.php
+++ b/includes/specials/pagers/NewFilesPager.php
@@ -77,9 +77,7 @@
[
'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() )
]
];
}
diff --git a/includes/specials/pagers/UsersPager.php
b/includes/specials/pagers/UsersPager.php
index d599599..9aef9ad 100644
--- a/includes/specials/pagers/UsersPager.php
+++ b/includes/specials/pagers/UsersPager.php
@@ -112,9 +112,7 @@
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 != '' ) {
diff --git a/includes/user/UserGroupMembership.php
b/includes/user/UserGroupMembership.php
index 81a4083..cf05df3 100644
--- a/includes/user/UserGroupMembership.php
+++ b/includes/user/UserGroupMembership.php
@@ -49,11 +49,6 @@
* @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;
@@ -77,26 +72,15 @@
* @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 );
}
/**
@@ -117,19 +101,11 @@
* @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',
+ ];
}
/**
@@ -140,7 +116,6 @@
* @return bool Whether or not anything was deleted
*/
public function delete( IDatabase $dbw = null ) {
- global $wgDisableUserGroupExpiry;
if ( wfReadOnly() ) {
return false;
}
@@ -149,14 +124,10 @@
$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;
}
@@ -182,7 +153,6 @@
* @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 );
}
@@ -206,7 +176,7 @@
// 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'],
@@ -245,16 +215,11 @@
* @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;
}
/**
@@ -262,8 +227,7 @@
* @return bool
*/
public function isExpired() {
- global $wgDisableUserGroupExpiry;
- if ( $wgDisableUserGroupExpiry || !$this->expiry ) {
+ if ( !$this->expiry ) {
return false;
} else {
return wfTimestampNow() > $this->expiry;
@@ -276,8 +240,7 @@
* @param IDatabase|null $dbw
*/
public static function purgeExpired( IDatabase $dbw = null ) {
- global $wgDisableUserGroupExpiry;
- if ( $wgDisableUserGroupExpiry || wfReadOnly() ) {
+ if ( wfReadOnly() ) {
return;
}
--
To view, visit https://gerrit.wikimedia.org/r/347594
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5b532d79fd1e8b178490cf2617499ae62967de2c
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TTO <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: TTO <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits