예제 #1
0
/**
 * return the timestamp for the most recent time at which a bugnote
 * associated with the bug was modified and the total bugnote
 * count in one db query
 * @param integer $p_bug_id Integer representing bug identifier.
 * @return object consisting of bugnote stats
 * @access public
 * @uses database_api.php
 */
function bug_get_bugnote_stats($p_bug_id)
{
    global $g_cache_bug;
    $c_bug_id = (int) $p_bug_id;
    if (array_key_exists('_stats', $g_cache_bug[$c_bug_id])) {
        return $g_cache_bug[$c_bug_id]['_stats'];
    } else {
        $t_stats = bug_get_bugnote_stats_array(array($p_bug_id));
        return $t_stats[$p_bug_id];
    }
}
예제 #2
0
/**
 *  Cache the filter results with bugnote stats for later use
 * @param array $p_rows             Results of the filter query.
 * @param array $p_id_array_lastmod Array of bug ids.
 * @return array
 */
function filter_cache_result(array $p_rows, array $p_id_array_lastmod)
{
    $t_stats = bug_get_bugnote_stats_array($p_id_array_lastmod);
    $t_rows = array();
    foreach ($p_rows as $t_row) {
        $b = $t_stats[$t_row['id']];
        if (array_key_exists($t_row['id'], $t_stats)) {
            $t_rows[] = bug_row_to_object(bug_cache_database_result($t_row, $t_stats[$t_row['id']]));
        } else {
            $t_rows[] = bug_row_to_object(bug_cache_database_result($t_row));
        }
    }
    return $t_rows;
}