2declare( strict_types=1 );
6use CallbackFilterIterator;
26 $this->tempUserConfig = $tempUserConfig;
27 $this->userRegistrationLookup = $userRegistrationLookup;
41 !$this->tempUserConfig->isTempName( $user->getName() ) ||
42 !$user->isRegistered()
47 $userId = $user->
getId();
49 if ( !$this->expiryCache->has( $userId ) ) {
50 $registration = $this->userRegistrationLookup->getFirstRegistration( $user );
52 $this->expiryCache->set( $userId, $this->getExpirationState( $registration ) );
55 return $this->expiryCache->get( $userId );
64 $users = is_array( $users ) ? new ArrayIterator( $users ) : new IteratorIterator( $users );
65 $timestampsById = $this->userRegistrationLookup->getFirstRegistrationBatch(
66 new CallbackFilterIterator(
69 $user->isRegistered() && $this->tempUserConfig->isTempName( $user->getName() )
73 foreach ( $timestampsById as $userId => $registrationTimestamp ) {
74 $this->expiryCache->set(
76 $this->getExpirationState( $registrationTimestamp )
87 private function getExpirationState( $registration ): bool {
88 if ( !is_string( $registration ) ) {
92 $expireAfterDays = $this->tempUserConfig->getExpireAfterDays();
93 $expiresAt = (int)
wfTimestamp( TS_UNIX, $registration ) + $expireAfterDays * 86400;
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
if(!defined('MW_SETUP_CALLBACK'))