[Dehs-devel] r93 - trunk

atomo64-guest at alioth.debian.org atomo64-guest at alioth.debian.org
Fri Jan 4 22:52:31 UTC 2008


Author: atomo64-guest
Date: 2008-01-04 22:52:31 +0000 (Fri, 04 Jan 2008)
New Revision: 93

Modified:
   trunk/dehs_pg.php
Log:
Fixed the popcon data parser so pop_inst really gets the pop inst value and not pop vote


Modified: trunk/dehs_pg.php
===================================================================
--- trunk/dehs_pg.php	2008-01-04 21:57:27 UTC (rev 92)
+++ trunk/dehs_pg.php	2008-01-04 22:52:31 UTC (rev 93)
@@ -408,7 +408,8 @@
     global $dirs,$dbconn;
     $db = pg_pconnect($dbconn)  or  die_status(pg_last_error($db));
     $filename=$dirs[popcon_dir] . "/all-popcon-results.txt.gz";
-    $regexp="/Package:\s($initial\S*)\s+(\d+)\s+(\d+)/iS";
+    /*                   package name   vote     old    recent  nofiles*/
+    $regexp="/Package:\s($initial\S*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/iS";
     $zp = gzopen($filename, "r") or die_status("Could not open $filename");
     $tin=time();
     if(filesize($filename)>20) {
@@ -416,8 +417,9 @@
         while (!gzeof($zp)) {
             $line = gzgets ($zp,4096) ;
             if (preg_match($regexp,$line,$matches)) {
+                $pop_inst = $matches[2] + $matches[3] + $matches[4] + $matches[5];
                 #print "\rName => $matches[1] Install => $matches[2] Vote => $matches[3]";
-                @pg_exec($db, "UPDATE binpkgs SET pop_inst='$matches[2]',pop_vote='$matches[3]' WHERE bin_name='$matches[1]'");
+                @pg_exec($db, "UPDATE binpkgs SET pop_inst='$pop_inst',pop_vote='$matches[2]' WHERE bin_name='$matches[1]'");
                 /*$processed++;
                 $elapsed_time=time()-$tin;
                 if (($elapsed_time % 20)==0 AND $updtime!=$elapsed_time) {




More information about the Dehs-devel mailing list