Skip to content

Commit f31c5a4

Browse files
committed
EditAccount: post-1.23 hack to prevent fatals by reintroducing a function removed from MW core
1 parent 4eb5737 commit f31c5a4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

SpecialEditAccount_body.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ function generateRandomScrambledPassword() {
515515
// This suffix shouldn't reduce the entropy of the intentionally
516516
// scrambled password.
517517
$REQUIRED_CHARS = 'A1a';
518-
return ( wfGenerateToken() . $REQUIRED_CHARS );
518+
return ( self::generateToken() . $REQUIRED_CHARS );
519519
}
520520

521521
/**
@@ -704,4 +704,13 @@ public static function isAccountDisabled( $user ) {
704704

705705
return (bool) $retVal;
706706
}
707+
708+
/**
709+
* Copypasta from pre-1.23 /includes/GlobalFunctions.php
710+
* @see https://git.wikimedia.org/commitdiff/mediawiki%2Fcore/118567a4ba0ded669f43a58713733cab915afe39
711+
*/
712+
public static function generateToken( $salt = '' ) {
713+
$salt = serialize( $salt );
714+
return md5( mt_rand( 0, 0x7fffffff ) . $salt );
715+
}
707716
}

0 commit comments

Comments
 (0)