summaryrefslogtreecommitdiff
path: root/includes/User.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-10-18 09:31:31 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-10-18 09:31:31 +0200
commit80f7dc77d430774192b929d780f96260066df2ee (patch)
tree102eaae7fc9ec567f2af76e96da3de2d1e83afcf /includes/User.php
parentcccd7bb4d819334c07e0dadaf16cbfdef31880e1 (diff)
Update to MediaWiki 1.25.3
Diffstat (limited to 'includes/User.php')
-rw-r--r--includes/User.php27
1 files changed, 16 insertions, 11 deletions
diff --git a/includes/User.php b/includes/User.php
index 8ea491ce..663a80b7 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -526,19 +526,24 @@ class User implements IDBAccessObject {
* If the code is invalid or has expired, returns NULL.
*
* @param string $code Confirmation code
+ * @param int $flags User::READ_* bitfield
* @return User|null
*/
- public static function newFromConfirmationCode( $code ) {
- $dbr = wfGetDB( DB_SLAVE );
- $id = $dbr->selectField( 'user', 'user_id', array(
- 'user_email_token' => md5( $code ),
- 'user_email_token_expires > ' . $dbr->addQuotes( $dbr->timestamp() ),
- ) );
- if ( $id !== false ) {
- return User::newFromId( $id );
- } else {
- return null;
- }
+ public static function newFromConfirmationCode( $code, $flags = 0 ) {
+ $db = ( $flags & self::READ_LATEST ) == self::READ_LATEST
+ ? wfGetDB( DB_MASTER )
+ : wfGetDB( DB_SLAVE );
+
+ $id = $db->selectField(
+ 'user',
+ 'user_id',
+ array(
+ 'user_email_token' => md5( $code ),
+ 'user_email_token_expires > ' . $db->addQuotes( $db->timestamp() ),
+ )
+ );
+
+ return $id ? User::newFromId( $id ) : null;
}
/**