Revision: 6426
          http://ipcop.svn.sourceforge.net/ipcop/?rev=6426&view=rev
Author:   owes
Date:     2012-02-27 12:18:49 +0000 (Mon, 27 Feb 2012)
Log Message:
-----------
Use available space function from lib.

Modified Paths:
--------------
    ipcop/trunk/html/cgi-bin/index.cgi
    ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0

Modified: ipcop/trunk/html/cgi-bin/index.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/index.cgi  2012-02-27 12:15:21 UTC (rev 6425)
+++ ipcop/trunk/html/cgi-bin/index.cgi  2012-02-27 12:18:49 UTC (rev 6426)
@@ -16,7 +16,7 @@
 # along with IPCop.  If not, see <http://www.gnu.org/licenses/>.
 #
 # (c) The SmoothWall Team
-# (c) 2007-2011, the IPCop team
+# (c) 2007-2012, the IPCop team
 #
 # $Id$
 #
@@ -155,49 +155,19 @@
 }
 
 # Diskspace usage warning
-open(DF, '/bin/df -B M -x rootfs|');
-my @df = <DF>;
-close DF;
+my $free = &General::getavailabledisk('/root');
+if ($free < 15) {
 
-# skip first line:
-# Filesystem            Size  Used Avail Use% Mounted on
-shift(@df);
-chomp(@df);
-
-# merge all lines to one single line separated by spaces
-my $all_inOneLine = join(' ', @df);
-
-# now get all entries in an array
-my @all_entries = split(' ', $all_inOneLine);
-
-# loop over all entries. Six entries belong together.
-while (@all_entries > 0) {
-    my $device  = shift(@all_entries);
-    my $size    = shift(@all_entries);
-    my $used    = shift(@all_entries);
-    my $free    = shift(@all_entries);
-    my $percent = shift(@all_entries);
-    my $mount   = shift(@all_entries);
-
-    if (($device =~ m/root/) || ($device =~ m/md0/)) {
-        $free =~ m/^(\d+)M$/;
-        if ($1 < 15) {
-
-            # available:plain value in MB, and not %used as 10% is too much to 
waste on small disk
-            # and root size should not vary during time
-            $warnmessage .= "<li> $Lang::tr{'filesystem full'}: $device 
<b>$Lang::tr{'free'}=$1M</b> !</li>\n";
-        }
-
-    }
-    else {
-        $percent =~ m/^(\d+)\%$/;
-        if ($1 > 90) {
-            my $freepercent = int(100 - $1);
-            $warnmessage .=
-                "<li> $Lang::tr{'filesystem full'}: $device 
<b>$Lang::tr{'free'}=$freepercent%</b> !</li>\n";
-        }
-    }
+    # available:plain value in MB, and not %used as 10% is too much to waste 
on small disk
+    # and root size should not vary during time
+    $warnmessage .= "<li> $Lang::tr{'filesystem full'}: /root 
<b>$Lang::tr{'free'}=${free}M</b> !</li>\n";
 }
+my $percent = &General::getavailabledisk('/var/log', 'use');
+if ($percent > 90) {
+    my $freepercent = int(100 - $percent);
+    $warnmessage .=
+        "<li> $Lang::tr{'filesystem full'}: /var/log 
<b>$Lang::tr{'free'}=${freepercent}%</b> !</li>\n";
+}
 
 # Patches warning
 my $patchmessage = &General::ispatchavailable();

Modified: ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0
===================================================================
--- ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0      2012-02-27 12:15:21 UTC 
(rev 6425)
+++ ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0      2012-02-27 12:18:49 UTC 
(rev 6426)
@@ -2,6 +2,7 @@
 /home/httpd/cgi-bin/ddns.cgi
 /home/httpd/cgi-bin/dhcp.cgi
 /home/httpd/cgi-bin/hosts.cgi
+/home/httpd/cgi-bin/index.cgi
 /home/httpd/cgi-bin/logfirewall.cgi
 /home/httpd/cgi-bin/logproxy.cgi
 /home/httpd/cgi-bin/logsystem.cgi

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to