public $mName;
/** @var string */
public $mRealName;
-
- /**
- * These fields were marked "@private", but were defined as public to
- * maintain compatibility with PHP4 code since PHP4 didn't support access
- * restrictions. AuthManager makes password handling pluggable, meaning
- * these fields don't make sense anymore. If this broke something, see
- * T89459 for the context of the change.
- * @deprecated These are mostly unused, but kept for now to raise errors on attempted access.
- */
- // @{
+ /** @var Password|null */
private $mPassword = null;
- private $mNewpassword;
- private $mNewpassTime;
- private $mPasswordExpires;
- // @}
/** @var string */
public $mEmail;
$data[$name] = $this->$name;
}
$data['mVersion'] = self::VERSION;
- $key = wfMemcKey( 'user', 'id', $this->mId );
-
$opts = Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
- ObjectCache::getMainWANInstance()->set( $key, $data, 3600, $opts );
+
+ $cache = ObjectCache::getMainWANInstance();
+ $key = wfMemcKey( 'user', 'id', $this->mId );
+ $cache->set( $key, $data, $cache::TTL_HOUR, $opts );
}
/** @name newFrom*() static factory methods */
return false;
}
- global $wgMemc;
-
$limits = $wgRateLimits[$action];
$keys = array();
$id = $this->getId();
$keys[wfMemcKey( 'limiter', $action, 'user', $id )] = $userLimit;
}
+ $cache = ObjectCache::getLocalClusterInstance();
+
$triggered = false;
foreach ( $keys as $key => $limit ) {
list( $max, $period ) = $limit;
$summary = "(limit $max in {$period}s)";
- $count = $wgMemc->get( $key );
+ $count = $cache->get( $key );
// Already pinged?
if ( $count ) {
if ( $count >= $max ) {
} else {
wfDebug( __METHOD__ . ": adding record for $key $summary\n" );
if ( $incrBy > 0 ) {
- $wgMemc->add( $key, 0, intval( $period ) ); // first ping
+ $cache->add( $key, 0, intval( $period ) ); // first ping
}
}
if ( $incrBy > 0 ) {
- $wgMemc->incr( $key, $incrBy );
+ $cache->incr( $key, $incrBy );
}
}
* @param bool $throttle If true, reset the throttle timestamp to the present
*/
public function setNewpassword( $str, $throttle = true ) {
+ $id = $this->getId();
+ if ( $id == 0 ) {
+ throw new LogicException( 'Cannot set new password for a user that is not in the database.' );
+ }
+
$dbw = wfGetDB( DB_MASTER );
$passwordFactory = new PasswordFactory();
__METHOD__
);
try {
- $mNewpassword = $passwordFactory->newFromCiphertext( $row->user_newpassword );
+ $newPassword = $passwordFactory->newFromCiphertext( $row->user_newpassword );
} catch ( PasswordError $e ) {
wfDebug( 'Invalid password hash found in database.' );
- $mNewpassword = PasswordFactory::newInvalidPassword();
+ $newPassword = PasswordFactory::newInvalidPassword();
}
- if ( $mNewpassword->equals( $plaintext ) ) {
+ if ( $newPassword->equals( $plaintext ) ) {
if ( is_null( $row->user_newpass_time ) ) {
return true;
}