Changeset 902 in svn for trunk/admin/xcache.php


Ignore:
Timestamp:
2012-05-29T02:25:41Z (3 years ago)
Author:
Xuefer
Message:

improve config handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/xcache.php

    r868 r902  
    7777function freeblock_to_graph($freeblocks, $size)
    7878{
    79     global $graph_width, $usage_graph_width, $free_graph_width;
     79    global $config;
    8080
    8181    // cached in static variable
    8282    static $graph_initial;
    8383    if (!isset($graph_initial)) {
    84         $graph_initial = array_fill(0, $graph_width, 0);
     84        $graph_initial = array_fill(0, $config['percent_graph_width'], 0);
    8585    }
    8686    $graph = $graph_initial;
    8787    foreach ($freeblocks as $b) {
    88         $begin = $b['offset'] / $size * $graph_width;
    89         $end = ($b['offset'] + $b['size']) / $size * $graph_width;
     88        $begin = $b['offset'] / $size * $config['percent_graph_width'];
     89        $end = ($b['offset'] + $b['size']) / $size * $config['percent_graph_width'];
    9090
    9191        if ((int) $begin == (int) $end) {
     
    104104    $c = 255;
    105105    foreach ($graph as $k => $v) {
    106         if (!isset($free_graph_width)) {
     106        if ($config['percent_graph_type'] != 'free') {
    107107            $v = 1 - $v;
    108108        }
Note: See TracChangeset for help on using the changeset viewer.