Skip to content

Commit

Permalink
use exceptions instead of $trigger_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis committed Apr 6, 2013
1 parent 2f87420 commit b5ec3fe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
8 changes: 2 additions & 6 deletions core/classes/MantisUser.class.php
Expand Up @@ -273,11 +273,10 @@ private static function GetFromDatabase( $p_field, $p_value ) {
* If the second parameter is true (default), trigger an error if the user can't be found.
* If the second parameter is false, return false if the user can't be found.
* @param int $p_user_id user id
* @param bool $p_trigger_errors trigger errors
* @throws MantisBT\Exception\User_By_ID_Not_Found
* @return array
*/
function user_cache_row( $p_user_id, $p_trigger_errors = true ) {
function user_cache_row( $p_user_id ) {
$t_query = 'SELECT * FROM {user} WHERE id=%d';
$t_result = db_query( $t_query, array( $p_user_id ) );

Expand All @@ -286,10 +285,7 @@ function user_cache_row( $p_user_id, $p_trigger_errors = true ) {
if ( $t_row ) {
return $t_row;
} else {
if( $p_trigger_errors ) {
throw new MantisBT\Exception\User_By_ID_Not_Found( $p_user_id );
}
return false;
throw new MantisBT\Exception\User_By_ID_Not_Found( $p_user_id );
}
}

Expand Down
3 changes: 0 additions & 3 deletions core/user_api.php
Expand Up @@ -69,9 +69,6 @@ function user_cache_array_rows( $p_user_id_array ) {
* check to see if user exists by id
* return true if it does, false otherwise
*
* Use user_cache_row() to benefit from caching if called multiple times
* and because if the user does exist the data may well be wanted
*
* @param int $p_user_id User ID
* @return bool
* @throws MantisBT\Exception\User_By_UserID_Not_Found
Expand Down

0 comments on commit b5ec3fe

Please sign in to comment.