]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/Freshmeat.pl
- second round of changes from lear@OPN. thanks!
[infobot.git] / src / Modules / Freshmeat.pl
index 269eb3e019d29e1a05240aaaf12b6a1ea12c1acf..c33685f34adf723cd43afdf6c7ddaa1a63d1a4f6 100644 (file)
@@ -186,7 +186,7 @@ sub downloadIndex {
     # set the last refresh time. fixes multiple spawn bug.
     &::dbSet("freshmeat", 
        { "projectname_short"   => "_" },
-       { "latest_version"      => time()
+       { "latest_version"      => time(),
          "desc_short"          => "" }
     );
 
@@ -326,6 +326,9 @@ sub xml_end {
     $pkg{$text} = $string;
 
     if ($expat->depth == 0) {
+
+       # old code.
+       if (0) {
        for (my $j=0; $j<scalar @cols; $j++) {
            $data[$j] = $pkg{ $cols[$j] };
        }
@@ -333,6 +336,18 @@ sub xml_end {
 
        &::dbSetRow("freshmeat", [@data], "DELAY");
        undef @data;
+       }
+
+       # new code.
+       $i++;
+       my %data;
+       foreach(@cols) {
+           $data{$_} = $pkg{$_};
+       }
+       &::dbReplace("freshmeat", "projectname_short", %data);
+       undef %data;
+       # end of new code.
+
        undef %pkg;
 
        if ($i % 200 == 0 and $i != 0) {