Skip to content

Commit

Permalink
Remove bug_hash which is no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
vboctor committed Nov 25, 2017
1 parent 7aa72aa commit 4bd8891
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions core/bug_api.php
Expand Up @@ -978,40 +978,6 @@ function bug_text_clear_cache( $p_bug_id = null ) {
return true;
}

/**
* Get hash for the bug information. Used in scenarios like ETag for REST API.
* A proper hash will be returned even if the issue doesn't exist.
*
* @param integer $p_bug_id The bug id.
* @param integer|null $p_user_id The user id or null for current logged in user.
* @return string The hash.
*/
function bug_hash( $p_bug_id, $p_user_id = null ) {
# This is needed for cases where a bug has been updated, and a new hash is to be calculated.
bug_clear_cache( $p_bug_id );

# Change this version when it is desired to force clients to refresh issues.
$t_version = 'v1';

if( auth_is_user_authenticated() ) {
$t_user_id = $p_user_id ? (int)$p_user_id : auth_get_current_user_id();
} else {
$t_user_id = $p_user_id ?: '';
}

if( bug_exists( $p_bug_id ) ) {
$t_bug_data = bug_get( $p_bug_id, false );
$t_last_updated = $t_bug_data->last_updated;
} else {
$t_last_updated = '';
}

$t_bug_id = (int)$p_bug_id;

$t_str_to_hash = $t_bug_id . '_' . $t_last_updated . '_' . $t_user_id . '_' . $t_version;
return hash( 'sha256', $t_str_to_hash );
}

/**
* Check if a bug exists
* @param integer $p_bug_id Integer representing bug identifier.
Expand Down

0 comments on commit 4bd8891

Please sign in to comment.