Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b5ec3fe

Browse files
committedApr 6, 2013
use exceptions instead of $trigger_errors
1 parent 2f87420 commit b5ec3fe

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed
 

‎core/classes/MantisUser.class.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,10 @@ private static function GetFromDatabase( $p_field, $p_value ) {
273273
* If the second parameter is true (default), trigger an error if the user can't be found.
274274
* If the second parameter is false, return false if the user can't be found.
275275
* @param int $p_user_id user id
276-
* @param bool $p_trigger_errors trigger errors
277276
* @throws MantisBT\Exception\User_By_ID_Not_Found
278277
* @return array
279278
*/
280-
function user_cache_row( $p_user_id, $p_trigger_errors = true ) {
279+
function user_cache_row( $p_user_id ) {
281280
$t_query = 'SELECT * FROM {user} WHERE id=%d';
282281
$t_result = db_query( $t_query, array( $p_user_id ) );
283282

@@ -286,10 +285,7 @@ function user_cache_row( $p_user_id, $p_trigger_errors = true ) {
286285
if ( $t_row ) {
287286
return $t_row;
288287
} else {
289-
if( $p_trigger_errors ) {
290-
throw new MantisBT\Exception\User_By_ID_Not_Found( $p_user_id );
291-
}
292-
return false;
288+
throw new MantisBT\Exception\User_By_ID_Not_Found( $p_user_id );
293289
}
294290
}
295291

‎core/user_api.php

-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ function user_cache_array_rows( $p_user_id_array ) {
6969
* check to see if user exists by id
7070
* return true if it does, false otherwise
7171
*
72-
* Use user_cache_row() to benefit from caching if called multiple times
73-
* and because if the user does exist the data may well be wanted
74-
*
7572
* @param int $p_user_id User ID
7673
* @return bool
7774
* @throws MantisBT\Exception\User_By_UserID_Not_Found

0 commit comments

Comments
 (0)
Please sign in to comment.