Changeset 526 for trunk/admin/xcache.php


Ignore:
Timestamp:
2008-02-18T14:28:31+01:00 (6 years ago)
Author:
moo
Message:

allow user decide to show used or free blocks/percent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/xcache.php

    r522 r526  
    7777function freeblock_to_graph($freeblocks, $size) 
    7878{ 
    79     global $free_graph_width; 
     79    global $graph_width, $usage_graph_width, $free_graph_width; 
    8080 
    8181    // cached in static variable 
    8282    static $graph_initial; 
    8383    if (!isset($graph_initial)) { 
    84         for ($i = 0; $i < $free_graph_width; $i ++) { 
    85             $graph_initial[$i] = 0; 
    86         } 
     84        $graph_initial = array_fill(0, $graph_width, 0); 
    8785    } 
    8886    $graph = $graph_initial; 
    8987    foreach ($freeblocks as $b) { 
    90         $begin = $b['offset'] / $size * $free_graph_width; 
    91         $end = ($b['offset'] + $b['size']) / $size * $free_graph_width; 
     88        $begin = $b['offset'] / $size * $graph_width; 
     89        $end = ($b['offset'] + $b['size']) / $size * $graph_width; 
    9290 
    9391        if ((int) $begin == (int) $end) { 
     
    106104    $c = 255; 
    107105    foreach ($graph as $k => $v) { 
     106        if (!isset($free_graph_width)) { 
     107            $v = 1 - $v; 
     108        } 
    108109        $v = (int) ($v * $c); 
    109110        $r = $g = $c - $v; 
Note: See TracChangeset for help on using the changeset viewer.