View Issue Details

IDProjectCategoryView StatusLast Update
0020121mantisbtbugtrackerpublic2016-08-28 01:12
Reportercproensa Assigned Tocproensa  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0-beta.3 
Target Version1.3.1Fixed in Version1.3.1 
Summary0020121: bug_cache_database_result does not update bugnote statistics
Description

function bug_cache_database_result in bug_api.php

when it is called to store bugnote statistics (array $p_stats)
if the bug is already in $g_cache_bug, statistics are not stored

This may not happen in standard code, but trying some modifications i have encountered this issue:

example:
filter_api reads a list of bugs. The first time it reads them, builds the bugnote stats array and stores in cache in the same call (thus working fine)
however, if in the process of building stats, a funcion of the kind "has access level" is called, this will store the bug in cache. Then when trying to store the actual stats, bug_cache_database_result will not do it

The issue would cause a repeated db query whenever bugnote stats are used (eg, for each bug in view_all_bug pages), because they cant be loaded from cache

Additional Information


function bug_cache_database_result( array $p_bug_database_result, array $p_stats = null ) {
global $g_cache_bug;

if( !is_array( $p_bug_database_result ) || <b>isset( $g_cache_bug[(int)$p_bug_database_result['id']]</b> ) ) {
    return $g_cache_bug[(int)$p_bug_database_result['id']];
}

return bug_add_to_cache( $p_bug_database_result, $p_stats );

}

TagsNo tags attached.

Activities

Related Changesets

MantisBT: master-1.3.x 6d6cd558

2015-09-17 10:03

cproensa

Committer: dregad


Details Diff
Force storing empty bugnote statistics

(1) When a bug has no bugnotes, or visible ones, force storing a 'false'
value as bugnote stats in bug cache, to avoid querying the database again
later.

(2) Additionally, when the function bug_cache_database_result is called
with a stats array parameter, and the bug has already been cached, force
the creation of the stats index. Previously this wasn't possible if the
bug had already been cached without the bugnote stats.

Fixes 0020121
Affected Issues
0020121
mod - core/bug_api.php Diff File
mod - core/filter_api.php Diff File