Tweak to cope with different DB file names master
authorSteve McIntyre <steve@einval.com>
Mon, 21 Jun 2021 08:25:18 +0000 (09:25 +0100)
committerSteve McIntyre <steve@einval.com>
Mon, 21 Jun 2021 08:25:18 +0000 (09:25 +0100)
find_file.cgi

index 52ec1c5..e540dc2 100755 (executable)
@@ -289,13 +289,26 @@ read_config();
 read_files("en");
 chdir($conf{'dbdir'}) || log_error(500, "Failed to cd to $conf{'dbdir'}: $!\n");
 opendir(my $dh, ".") || log_error(500, "Failed to open $conf{'dbdir'}: $!\n");
+
+
 while (defined($_ = readdir($dh))) {
-    if (m/(.*)\.db$/) {
-        my $mtime = file_mtime("$1.db");
-        if ($mtime > $last_update) {
-            $last_update = $mtime;
-        }
-        push(@AREAS, "$1");
+    if ($conf{'dbtype'} eq "hashdb") {
+       if (m/(.*)\.db$/) {
+           my $mtime = file_mtime("$1.db");
+           if ($mtime > $last_update) {
+               $last_update = $mtime;
+           }
+           push(@AREAS, "$1");
+       }
+    }
+    else {
+       if (m/(.*)\.db.sqlite$/) {
+           my $mtime = file_mtime("$1.db.sqlite");
+           if ($mtime > $last_update) {
+               $last_update = $mtime;
+           }
+           push(@AREAS, "$1");
+       }
     }
 }
 closedir($dh);