当前位置: 首页>>代码示例>>PHP>>正文


PHP bug_cache_database_result函数代码示例

本文整理汇总了PHP中bug_cache_database_result函数的典型用法代码示例。如果您正苦于以下问题:PHP bug_cache_database_result函数的具体用法?PHP bug_cache_database_result怎么用?PHP bug_cache_database_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bug_cache_database_result函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filter_cache_result

/**
 *  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_id_array_lastmod = array_unique($p_id_array_lastmod);
    $t_where_string = ' WHERE {bugnote}.bug_id in (' . implode(', ', $t_id_array_lastmod) . ')';
    $t_query = 'SELECT DISTINCT bug_id,MAX(last_modified) as last_modified, COUNT(last_modified) as count FROM {bugnote} ' . $t_where_string . ' GROUP BY bug_id';
    # perform query
    $t_result = db_query($t_query);
    $t_row_count = db_num_rows($t_result);
    while ($t_row = db_fetch_array($t_result)) {
        $t_stats[$t_row['bug_id']] = $t_row;
    }
    $t_rows = array();
    foreach ($p_rows as $t_row) {
        if (!isset($t_stats[$t_row['id']])) {
            $t_rows[] = bug_row_to_object(bug_cache_database_result($t_row));
        } else {
            $t_rows[] = bug_row_to_object(bug_cache_database_result($t_row, $t_stats[$t_row['id']]));
        }
    }
    return $t_rows;
}
开发者ID:vipjaven,项目名称:mantisbt,代码行数:27,代码来源:filter_api.php

示例2: filter_cache_result

/**
 *  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($p_rows, $p_id_array_lastmod)
{
    $t_bugnote_table = db_get_table('bugnote');
    $t_id_array_lastmod = array_unique($p_id_array_lastmod);
    $t_where_string = "WHERE {$t_bugnote_table}.bug_id in (" . implode(", ", $t_id_array_lastmod) . ')';
    $t_query = "SELECT DISTINCT bug_id,MAX(last_modified) as last_modified, COUNT(last_modified) as count FROM {$t_bugnote_table} {$t_where_string} GROUP BY bug_id";
    # perform query
    $t_result = db_query_bound($t_query);
    $t_row_count = db_num_rows($t_result);
    for ($i = 0; $i < $t_row_count; $i++) {
        $t_row = db_fetch_array($t_result);
        $t_stats[$t_row['bug_id']] = $t_row;
    }
    $t_rows = array();
    foreach ($p_rows as $t_row) {
        if (!isset($t_stats[$t_row['id']])) {
            $t_rows[] = bug_row_to_object(bug_cache_database_result($t_row, false));
        } else {
            $t_rows[] = bug_row_to_object(bug_cache_database_result($t_row, $t_stats[$t_row['id']]));
        }
    }
    return $t_rows;
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:29,代码来源:filter_api.php

示例3: summary_print_by_age

/**
 * Print list of bugs opened from the longest time
 * @return void
 */
function summary_print_by_age()
{
    $t_project_id = helper_get_current_project();
    $t_resolved = config_get('bug_resolved_status_threshold');
    $t_specific_where = helper_project_specific_where($t_project_id);
    if (' 1<>1' == $t_specific_where) {
        return;
    }
    $t_query = 'SELECT * FROM {bug}
				WHERE status < ' . db_param() . '
				AND ' . $t_specific_where . '
				ORDER BY date_submitted ASC, priority DESC';
    $t_result = db_query($t_query, array($t_resolved));
    $t_count = 0;
    $t_private_bug_threshold = config_get('private_bug_threshold');
    while ($t_row = db_fetch_array($t_result)) {
        # as we select all from bug_table, inject into the cache.
        bug_cache_database_result($t_row);
        # Skip private bugs unless user has proper permissions
        if (VS_PRIVATE == bug_get_field($t_row['id'], 'view_state') && false == access_has_bug_level($t_private_bug_threshold, $t_row['id'])) {
            continue;
        }
        if ($t_count++ == 10) {
            break;
        }
        $t_bugid = string_get_bug_view_link($t_row['id']);
        $t_summary = string_display_line($t_row['summary']);
        $t_days_open = intval((time() - $t_row['date_submitted']) / SECONDS_PER_DAY);
        echo '<tr>' . "\n";
        echo '<td class="small">' . $t_bugid . ' - ' . $t_summary . '</td><td class="right">' . $t_days_open . '</td>' . "\n";
        echo '</tr>' . "\n";
    }
}
开发者ID:gtn,项目名称:mantisbt,代码行数:37,代码来源:summary_api.php

示例4: db_param

 if ($f_version_id != -1 && $f_version_id != $t_version_id) {
     continue;
 }
 $query = "SELECT sbt.*, dbt.fixed_in_version AS parent_version, rt.source_bug_id\n      FROM {$t_bug_table} AS sbt\n      LEFT JOIN {$t_relation_table} AS rt\n        ON sbt.id=rt.destination_bug_id AND rt.relationship_type=" . BUG_DEPENDANT . "\n      LEFT JOIN {$t_bug_table} AS dbt ON dbt.id=rt.source_bug_id\n      WHERE sbt.project_id=" . db_param() . "\n        AND sbt.fixed_in_version=" . db_param() . "\n      ORDER BY sbt.status ASC, sbt.last_updated DESC";
 $t_description = version_get_field($t_version_id, 'description');
 $t_first_entry = true;
 $t_issue_ids = array();
 $t_issue_parents = array();
 $t_issue_handlers = array();
 $t_result = db_query_bound($query, array($t_project_id, $t_version));
 while ($t_row = db_fetch_array($t_result)) {
     # hide private bugs if user doesn't have access to view them.
     if (!$t_can_view_private && $t_row['view_state'] == VS_PRIVATE) {
         continue;
     }
     bug_cache_database_result($t_row);
     # check limit_Reporter (Issue #4770)
     # reporters can view just issues they reported
     if (ON === $t_limit_reporters && $t_user_access_level_is_reporter && !bug_is_user_reporter($t_row['id'], $t_user_id)) {
         continue;
     }
     $t_issue_id = $t_row['id'];
     $t_issue_parent = $t_row['source_bug_id'];
     $t_parent_version = $t_row['parent_version'];
     if (!helper_call_custom_function('changelog_include_issue', array($t_issue_id))) {
         continue;
     }
     if (0 === strcasecmp($t_parent_version, $t_version)) {
         $t_issue_ids[] = $t_issue_id;
         $t_issue_parents[] = $t_issue_parent;
     } else {
开发者ID:WebuddhaInc,项目名称:mantisbt-plugin-wbquickreport,代码行数:31,代码来源:changelog_page.php

示例5: summary_print_by_age

function summary_print_by_age()
{
    $t_mantis_bug_table = db_get_table('mantis_bug_table');
    $t_project_id = helper_get_current_project();
    $t_user_id = auth_get_current_user_id();
    $t_resolved = config_get('bug_resolved_status_threshold');
    $specific_where = helper_project_specific_where($t_project_id);
    if (' 1<>1' == $specific_where) {
        return;
    }
    $query = "SELECT * FROM {$t_mantis_bug_table}\n\t\t\t\tWHERE status < {$t_resolved}\n\t\t\t\tAND {$specific_where}\n\t\t\t\tORDER BY date_submitted ASC, priority DESC";
    $result = db_query($query);
    $t_count = 0;
    $t_private_bug_threshold = config_get('private_bug_threshold');
    while ($row = db_fetch_array($result)) {
        // as we select all from bug_table, inject into the cache.
        bug_cache_database_result($row);
        // Skip private bugs unless user has proper permissions
        if (VS_PRIVATE == bug_get_field($row['id'], 'view_state') && false == access_has_bug_level($t_private_bug_threshold, $row['id'])) {
            continue;
        }
        if ($t_count++ == 10) {
            break;
        }
        $t_bugid = string_get_bug_view_link($row['id']);
        $t_summary = string_display_line($row['summary']);
        $t_days_open = intval((time() - $row['date_submitted']) / SECONDS_PER_DAY);
        print "<tr " . helper_alternate_class() . ">\n";
        print "<td class=\"small\">{$t_bugid} - {$t_summary}</td><td class=\"right\">{$t_days_open}</td>\n";
        print "</tr>\n";
    }
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:32,代码来源:summary_api.php

示例6: filter_get_bug_rows


//.........这里部分代码省略.........
    $t_page_count = ceil($bug_count / $p_per_page);
    if ($t_page_count < 1) {
        $t_page_count = 1;
    }
    # write the value back in case the caller wants to know
    $p_page_count = $t_page_count;
    # Make sure $p_page_number isn't past the last page.
    if ($p_page_number > $t_page_count) {
        $p_page_number = $t_page_count;
    }
    # Make sure $p_page_number isn't before the first page
    if ($p_page_number < 1) {
        $p_page_number = 1;
    }
    # Now add the rest of the criteria i.e. sorting, limit.
    # if sort is blank then default the sort and direction.  This is to fix the
    # symptoms of #3953.  Note that even if the main problem is fixed, we may
    # have to keep this code for a while to handle filters saved with this blank field.
    if (is_blank($t_filter['sort'])) {
        $t_filter['sort'] = 'last_updated';
        $t_filter['dir'] = 'DESC';
    }
    $t_order_array = array();
    $t_sort_fields = split(',', $t_filter['sort']);
    $t_dir_fields = split(',', $t_filter['dir']);
    if ('on' == $t_filter['sticky_issues'] && NULL !== $p_show_sticky) {
        $t_order_array[] = "sticky DESC";
    }
    $t_join = '';
    for ($i = 0; $i < count($t_sort_fields); $i++) {
        $c_sort = db_prepare_string($t_sort_fields[$i]);
        if (!in_array($t_sort_fields[$i], array_slice($t_sort_fields, $i + 1))) {
            # if sorting by a custom field
            if (strpos($c_sort, 'custom_') === 0) {
                $t_custom_field = substr($c_sort, strlen('custom_'));
                $t_custom_field_id = custom_field_get_id_from_name($t_custom_field);
                $t_join .= " LEFT JOIN {$t_custom_field_string_table} ON ( ( {$t_custom_field_string_table}.bug_id = {$t_bug_table}.id ) AND ( {$t_custom_field_string_table}.field_id = {$t_custom_field_id} ) )";
                $c_sort = "{$t_custom_field_string_table}.value";
                $t_select_clauses[] = "{$t_custom_field_string_table}.value";
            }
            if ('DESC' == $t_dir_fields[$i]) {
                $c_dir = 'DESC';
            } else {
                $c_dir = 'ASC';
            }
            $t_order_array[] = "{$c_sort} {$c_dir}";
        }
    }
    # add basic sorting if necessary
    if (!in_array('last_updated', $t_sort_fields)) {
        $t_order_array[] = 'last_updated DESC';
    }
    if (!in_array('date_submitted', $t_sort_fields)) {
        $t_order_array[] = 'date_submitted DESC';
    }
    $t_order = " ORDER BY " . implode(', ', $t_order_array);
    $t_select = implode(', ', array_unique($t_select_clauses));
    $query2 = "SELECT DISTINCT {$t_select}\r\n\t\t\t\t\t{$t_from}\r\n\t\t\t\t\t{$t_join}\r\n\t\t\t\t\t{$t_where}\r\n\t\t\t\t\t{$t_order}";
    # Figure out the offset into the db query
    #
    # for example page number 1, per page 5:
    #     t_offset = 0
    # for example page number 2, per page 5:
    #     t_offset = 5
    $c_per_page = db_prepare_int($p_per_page);
    $c_page_number = db_prepare_int($p_page_number);
    $t_offset = ($c_page_number - 1) * $c_per_page;
    # perform query
    $result2 = db_query($query2, $c_per_page, $t_offset);
    $row_count = db_num_rows($result2);
    $t_id_array_lastmod = array();
    for ($i = 0; $i < $row_count; $i++) {
        $row = db_fetch_array($result2);
        $t_id_array_lastmod[] = db_prepare_int($row['id']);
        $row['date_submitted'] = db_unixtimestamp($row['date_submitted']);
        $row['last_updated'] = db_unixtimestamp($row['last_updated']);
        array_push($rows, $row);
    }
    $t_id_array_lastmod = array_unique($t_id_array_lastmod);
    // paulr: it should be impossible for t_id_array_lastmod to be array():
    // that would imply that $t_id_array is null which aborts this function early
    //if ( count( $t_id_array_lastmod ) > 0 ) {
    $t_where = "WHERE {$t_bugnote_table}.bug_id in (" . implode(", ", $t_id_array_lastmod) . ")";
    $query3 = "SELECT DISTINCT bug_id,MAX(last_modified) as last_modified, COUNT(last_modified) as count FROM {$t_bugnote_table} {$t_where} GROUP BY bug_id";
    # perform query
    $result3 = db_query($query3);
    $row_count = db_num_rows($result3);
    for ($i = 0; $i < $row_count; $i++) {
        $row = db_fetch_array($result3);
        $t_stats[$row['bug_id']] = $row;
    }
    foreach ($rows as $row) {
        if (!isset($t_stats[$row['id']])) {
            bug_cache_database_result($row, false);
        } else {
            bug_cache_database_result($row, $t_stats[$row['id']]);
        }
    }
    return $rows;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:101,代码来源:filter_api.php

示例7: filter_cache_result

/**
 *  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;
}
开发者ID:spring,项目名称:spring-website,代码行数:20,代码来源:filter_api.php

示例8: gantt_get_issues_and_related_in_version

function gantt_get_issues_and_related_in_version($p_project_id, $p_version_name)
{
    $t_bug_table = db_get_table('bug');
    $t_relation_table = db_get_table('bug_relationship');
    $t_bug_datas = array();
    $t_project_id = db_prepare_int($p_project_id);
    $t_version_name = db_prepare_string($p_version_name);
    $t_can_view_private = access_has_project_level(config_get('private_bug_threshold'), $t_project_id);
    $t_limit_reporters = config_get('limit_reporters');
    $t_user_access_level_is_reporter = REPORTER == access_get_project_level($t_project_id);
    $t_user_id = auth_get_current_user_id();
    $query = "SELECT sbt.*, {$t_relation_table}.source_bug_id as parent_issue, dbt.target_version as parent_version FROM {$t_bug_table} AS sbt\n              LEFT JOIN {$t_relation_table} ON sbt.id={$t_relation_table}.destination_bug_id AND {$t_relation_table}.relationship_type=2\n              LEFT JOIN {$t_bug_table} AS dbt ON dbt.id={$t_relation_table}.source_bug_id\n              WHERE sbt.project_id=" . db_param() . " AND sbt.target_version=" . db_param() . " ORDER BY sbt.status ASC, sbt.last_updated DESC";
    $t_result = db_query_bound($query, array($t_project_id, $t_version_name));
    // Filter ids according to level access
    while ($t_row = db_fetch_array($t_result)) {
        # hide private bugs if user doesn't have access to view them.
        if (!$t_can_view_private && $t_row['view_state'] == VS_PRIVATE) {
            continue;
        }
        bug_cache_database_result($t_row);
        # check limit_Reporter (Issue #4770)
        # reporters can view just issues they reported
        if (ON === $t_limit_reporters && $t_user_access_level_is_reporter && !bug_is_user_reporter($t_row['id'], $t_user_id)) {
            continue;
        }
        $t_issue_id = $t_row['id'];
        if (!helper_call_custom_function('roadmap_include_issue', array($t_issue_id))) {
            continue;
        }
        if (!isset($t_bug_datas[$t_issue_id])) {
            $t_bug_datas[$t_issue_id] = $t_row;
        }
    }
    return $t_bug_datas;
}
开发者ID:martijnveen,项目名称:GanttChart,代码行数:35,代码来源:gantt_api.php


注:本文中的bug_cache_database_result函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。