To avoid user permissions persisting for up to 1 hour beyond their expiry
time.
Bug: T163691
Change-Id: I85b578e6b7816639c3d0101d66efb1efedb17af6
$ttl = $cache->adaptiveTTL( wfTimestamp( TS_UNIX, $this->mTouched ), $ttl );
+ // if a user group membership is about to expire, the cache needs to
+ // expire at that time (T163691)
+ foreach ( $this->mGroupMemberships as $ugm ) {
+ if ( $ugm->getExpiry() ) {
+ $secondsUntilExpiry = wfTimestamp( TS_UNIX, $ugm->getExpiry() ) - time();
+ if ( $secondsUntilExpiry > 0 && $secondsUntilExpiry < $ttl ) {
+ $ttl = $secondsUntilExpiry;
+ }
+ }
+ }
+
return $data;
},