* @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
$this->isAnon() ? [ 'user_ip' => $this->getName() ] : [ 'user_id' => $this->getId() ],
__METHOD__ );
$rev = $timestamp ? Revision::loadFromTimestamp( $dbr, $utp, $timestamp ) : null;
- return [ [ 'wiki' => wfWikiID(), 'link' => $utp->getLocalURL(), 'rev' => $rev ] ];
+ return [
+ [
+ 'wiki' => WikiMap::getWikiIdFromDomain( WikiMap::getCurrentWikiDomain() ),
+ 'link' => $utp->getLocalURL(),
+ 'rev' => $rev
+ ]
+ ];
}
/**
}
$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 ) {