- /**
- * @param object $row
- * @param string $prefix Field prefix, such as 'rev_' or 'ar_'.
- *
- * @return UserIdentityValue
- */
- private function getUserIdentityFromRowObject( $row, $prefix = 'rev_' ) {
- $idField = "{$prefix}user";
- $nameField = "{$prefix}user_text";
-
- $userId = intval( $row->$idField );
-
- if ( isset( $row->user_name ) ) {
- $userName = $row->user_name;
- } elseif ( isset( $row->$nameField ) ) {
- $userName = $row->$nameField;
- } else {
- $userName = User::whoIs( $userId );
- }
-
- if ( $userName === false ) {
- wfWarn( __METHOD__ . ': Cannot determine user name for user ID ' . $userId );
- $userName = '';
- }
-
- return new UserIdentityValue( $userId, $userName );
- }
-