]> git.donarmstrong.com Git - infobot.git/commitdiff
- now backup news file just in case.
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 7 Apr 2001 12:07:38 +0000 (12:07 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 7 Apr 2001 12:07:38 +0000 (12:07 +0000)
- Other changes we've not documented or small enough not to mention

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

src/IRC/Schedulers.pl
src/modules.pl

index 1bdba62e9e450fb9353b53b2aa2cda606966a034..0f28ddc14cc7416b071de01ceefe7cf23c9adbd9 100644 (file)
@@ -722,23 +722,10 @@ sub miscCheck {
     }
     closedir DEBIAN;
 
-    # user/chan file check.
-    foreach ("chan","users") {
-       my $f           = $bot_misc_dir."/blootbot.$_";
-       my $backup      = 0;
-
-       if ( -e "$f~" ) {
-           $backup++ if ( -s $f > -s "$f~");
-           $backup++ if ( (stat $f)[9] - (stat "$f~")[9] > 60*60*24*7);
-       } else {
-           $backup++;
-       }
-       next unless ($backup);
-
-       ### TODO: do internal copying.
-       &status("Backup: $f to $f~");
-       CORE::system("/bin/cp $f $f~");
-    }
+    # make backup of important files.
+    &mkBackup( $bot_misc_dir."/blootbot.chan", 60*60*24*1);
+    &mkBackup( $bot_misc_dir."/blootbot.users", 60*60*24*1);
+    &mkBackup( $bot_base_dir."/blootbot-news.txt", 60*60*24*1);
 
     # flush cache{lobotomy}
     foreach (keys %{ $cache{lobotomy} }) {
@@ -1080,4 +1067,21 @@ sub getChanConfDefault {
     return $default;
 }
 
+sub mkBackup {
+    my($file, $time) = @_;
+    my $backup = 0;
+
+    if ( -e "$file~" ) {
+       $backup++ if ( -s $file > -s "$file~");
+       $backup++ if ( (stat $file)[9] - (stat "$file~")[9] > $time);
+    } else {
+       $backup++;
+    }
+    return unless ($backup);
+
+    ### TODO: do internal copying.
+    &status("Backup: $file to $file~");
+    CORE::system("/bin/cp $file $file~");
+}
+
 1;
index ee86c3817fef38e694fb188978b37e1b0c275360..791bd9f5f946998f5ef35efebfeb330d76a64c6d 100644 (file)
@@ -193,9 +193,8 @@ sub loadMyModulesNow {
        }
 
        if (!&IsParam($_) and !&IsChanConf($_) and !&getChanConfList($_)) {
-           &DEBUG("_ => $_");
            if (exists $myModules{$_}) {
-               &status("myModule: $myModules{$_} (1) not loaded.");
+               &status("myModule: $myModules{$_} or $_ (1) not loaded.");
            } else {
                &DEBUG("myModule: $_ (2) not loaded.");
            }