| @@ 36-45 (lines=10) @@ | ||
| 33 | * @param string $usernameOrIp The username or IP address. |
|
| 34 | * @return integer The user's ID. |
|
| 35 | */ |
|
| 36 | public function getUserId($usernameOrIp) |
|
| 37 | { |
|
| 38 | $userTable = $this->labsHelper->getTable('user'); |
|
| 39 | $sql = "SELECT user_id FROM $userTable WHERE user_name = :username LIMIT 1"; |
|
| 40 | $resultQuery = $this->replicas->prepare($sql); |
|
| 41 | $resultQuery->bindParam("username", $usernameOrIp); |
|
| 42 | $resultQuery->execute(); |
|
| 43 | $userId = (int)$resultQuery->fetchColumn(); |
|
| 44 | return $userId; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Get total edit counts for the top 10 projects for this user. |
|
| @@ 14-23 (lines=10) @@ | ||
| 11 | * @param string $username The username to find. |
|
| 12 | * @return int |
|
| 13 | */ |
|
| 14 | public function getId($databaseName, $username) |
|
| 15 | { |
|
| 16 | $userTable = $this->getTableName($databaseName, 'user'); |
|
| 17 | $sql = "SELECT user_id FROM $userTable WHERE user_name = :username LIMIT 1"; |
|
| 18 | $resultQuery = $this->projectsConnection->prepare($sql); |
|
| 19 | $resultQuery->bindParam("username", $username); |
|
| 20 | $resultQuery->execute(); |
|
| 21 | $userId = (int)$resultQuery->fetchColumn(); |
|
| 22 | return $userId; |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||