Little cosmetic bug in check_disk.plugin.php

Discussion in 'Tips/Tricks/Mods' started by martinfst, Dec 11, 2006.

  1. martinfst

    martinfst ISPConfig Developer ISPConfig Developer

    I just started to use ISPconfig (as a replacement for DirectAdmin) on a Ubuntu 6.10 server. Using several guidelines found (and modified accordingly), I have all up-n-running and it's looking good.

    I did see a little off screen display in my filesystem overview, which is on many pages, so I dived into the system and found a little bug in /home/admispconfig/ispconfig/lib/plugins/check_disk.plugin.php. As the array df_out created in line 58 is dynamically updated (by the unset function), you cannot use the sizeof function in the <for> loop, as the value changes during execution. On my install, the last two lines were not presented correctly. I've patched my install like:

         53     $fd = popen ("df -h", "r");
         54     while (!feof($fd)) {
         55         $buffer .= fgets($fd, 4096);
         56     }
         58         $df_out = split("\n",$buffer);
         59         $df_num=sizeof($df_out);              <=== Added variable
         60         for($i=0;$i<$df_num;$i++){            <=== Changed for loop 
         61           if(ltrim($df_out[$i]) != $df_out[$i]){
         62             if(isset($df_out[($i-1)])){
         63               $df_out[($i-1)] .= $df_out[$i];
         64               unset($df_out[$i]);
         65             }
         66           }
         67         }
    Well it's cosmetic, but anyway. Maybe one of the devs can enter this in the core? BTW, I use ISPconfig 2.2.8.

  2. falko

    falko Super Moderator ISPConfig Developer

    Thanks. I've corrected this in the SVN repository, so it will be in the next release. :)

Share This Page