* @return int|null The corresponding user's ID, or null if user is nonexistent
*/
public static function idFromName( $name, $flags = self::READ_NORMAL ) {
+ // Don't explode on self::$idCacheByName[$name] if $name is not a string but e.g. a User object
+ $name = (string)$name;
$nt = Title::makeTitleSafe( NS_USER, $name );
if ( is_null( $nt ) ) {
// Illegal name
}
$dbr = wfGetDB( DB_REPLICA );
$actorWhere = ActorMigration::newMigration()->getWhere( $dbr, 'rev_user', $this );
+ $tsField = isset( $actorWhere['tables']['temp_rev_user'] )
+ ? 'revactor_timestamp' : 'rev_timestamp';
$time = $dbr->selectField(
[ 'revision' ] + $actorWhere['tables'],
- 'rev_timestamp',
+ $tsField,
[ $actorWhere['conds'] ],
__METHOD__,
- [ 'ORDER BY' => 'rev_timestamp ASC' ],
+ [ 'ORDER BY' => "$tsField ASC" ],
$actorWhere['joins']
);
if ( !$time ) {