SOURCES: imp-quota_hook.patch - quota info for single fs may be multiline

baggins baggins at pld-linux.org
Thu Oct 16 12:28:28 CEST 2008


Author: baggins                      Date: Thu Oct 16 10:28:28 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- quota info for single fs may be multiline

---- Files affected:
SOURCES:
   imp-quota_hook.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/imp-quota_hook.patch
diff -u SOURCES/imp-quota_hook.patch:1.1 SOURCES/imp-quota_hook.patch:1.2
--- SOURCES/imp-quota_hook.patch:1.1	Tue Oct 14 20:10:40 2008
+++ SOURCES/imp-quota_hook.patch	Thu Oct 16 12:28:22 2008
@@ -16,19 +16,16 @@
  
          $session = ssh2_connect($host);
          if (!$session) {
-@@ -524,7 +524,13 @@
+@@ -524,7 +524,9 @@
          $stream = ssh2_exec($session, $command, false);
          stream_set_blocking($stream, true);
  
 -        $quota = preg_split('/\s+/', trim(stream_get_contents($stream)), 2);
-+	$patt = '/.*'.preg_quote($fs, '/').'.*/';
-+	foreach (preg_split('/\n/', stream_get_contents($stream)) as $line) {
-+		if (preg_match($patt, $line)) {
-+			$quota = preg_split('/\s+/', trim($line));
-+			break;
-+		}
-+	}
-         return array($quota[1] * 1024, $quota[2] * 1024);
+-        return array($quota[1] * 1024, $quota[2] * 1024);
++	$patt = '/.*'.preg_quote($fs, '/').'/';
++	$line = preg_replace('/\n/', ' ', stream_get_contents($stream));
++	$quota = preg_split('/\s+/', trim(preg_replace($patt, '',  $line)), 3);
++	return array($quota[0] * 1024, $quota[1] * 1024);
      }
  }
 diff -ur imp-h3-4.3/config/servers.php.dist imp-h3-4.3-quota_hook/config/servers.php.dist
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/imp-quota_hook.patch?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list