Index: trunk/phase3/includes/ExternalUser.php |
— | — | @@ -285,4 +285,22 @@ |
286 | 286 | 'eu_external_id' => $this->getId() ), |
287 | 287 | __METHOD__ ); |
288 | 288 | } |
| 289 | + |
| 290 | + /** |
| 291 | + * Check whether this external user id is already linked with |
| 292 | + * a local user. |
| 293 | + * @return Mixed User if the account is linked, Null otherwise. |
| 294 | + */ |
| 295 | + public final function getLocalUser(){ |
| 296 | + $dbr = wfGetDb( DB_SLAVE ); |
| 297 | + $row = $dbr->selectRow( |
| 298 | + 'external_user', |
| 299 | + '*', |
| 300 | + array( 'eu_external_id' => $this->getId() ) |
| 301 | + ); |
| 302 | + return $row |
| 303 | + ? User::newFromId( $row->fetchObject()->eu_wiki_id ) |
| 304 | + : null; |
| 305 | + } |
| 306 | + |
289 | 307 | } |