From: dms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Date: Fri, 20 Apr 2001 13:27:04 +0000 (+0000)
Subject: we didn't set modified_time for deleted factoids - fixed
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ab98b9fe24d5cdb8845cb938dca660fefa7d7bd2;p=infobot.git

we didn't set modified_time for deleted factoids - fixed
also... if final delete factoid list is >50... don't do it!


git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@455 c11ca15a-4712-0410-83d8-924469b57eb5
---

diff --git a/blootbot/src/IRC/Schedulers.pl b/blootbot/src/IRC/Schedulers.pl
index 7519ef0..5851b64 100644
--- a/blootbot/src/IRC/Schedulers.pl
+++ b/blootbot/src/IRC/Schedulers.pl
@@ -1035,8 +1035,18 @@ sub factoidCheck {
 
     foreach (@list) {
 	my $age = &getFactInfo($_, "modified_time");	
+
 	if (!defined $age or $age !~ /^\d+$/) {
-	    &WARN("age == NULL or not numeric.");
+	    if (scalar @list > 50) {
+		if (!$cache{warnDel}) {
+		    &WARN("list is over 50 (".scalar(@list)."... giving it a miss.");
+		    $cache{warnDel} = 1;
+		    last;
+		}
+	    }
+
+	    &WARN("old cruft (no time): $_");
+	    &delFactoid($_);
 	    next;
 	}
 
diff --git a/blootbot/src/Process.pl b/blootbot/src/Process.pl
index 495c00b..dedad4e 100644
--- a/blootbot/src/Process.pl
+++ b/blootbot/src/Process.pl
@@ -411,10 +411,10 @@ sub FactoidStuff {
 		my $check = &getFactoid("$faqtoid #DEL#");
 		if (!$check) {
 		    if ($faqtoid !~ /#DEL#/) {
-			&setFactInfo($faqtoid, "factoid_key", $faqtoid." #DEL#");
-
-			&setFactInfo($faqtoid, "modified_by", $who);
-			&setFactInfo($faqtoid, "modified_time", time());
+			my $new = $faqtoid." #DEL#";
+			&setFactInfo($faqtoid, "factoid_key", $new);
+			&setFactInfo($new, "modified_by", $who);
+			&setFactInfo($new, "modified_time", time());
 		    } else {
 			&status("not backing up $faqtoid.");
 		    }