]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Msgmap.pm
www_stream: linkify cloneurl entries if they're HTTP/HTTPS
[public-inbox.git] / lib / PublicInbox / Msgmap.pm
index f28579088e1ac78682915007873b0c8ef4766544..8fe17a9505f0db151fe8c7f8f67ff9170b54e0b9 100644 (file)
@@ -1,10 +1,15 @@
 # Copyright (C) 2015 all contributors <meta@public-inbox.org>
 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
-# bidirectional Message-ID <-> Article Number mapping
+
+# bidirectional Message-ID <-> Article Number mapping for the NNTP
+# and web interfaces.  This is required for implementing stable article
+# numbers for NNTP and allows prefix lookups for partial Message-IDs
+# in case URLs get truncated from copy-n-paste errors by users.
+#
+# This is maintained by ::SearchIdx
 package PublicInbox::Msgmap;
 use strict;
 use warnings;
-use fields qw(dbh mid_insert mid_for num_for num_minmax);
 use DBI;
 use DBD::SQLite;
 
@@ -20,11 +25,11 @@ sub new {
                AutoCommit => 1,
                RaiseError => 1,
                PrintError => 0,
+               ReadOnly => !$writable,
                sqlite_use_immediate_transaction => 1,
        });
        $dbh->do('PRAGMA case_sensitive_like = ON');
-       my $self = fields::new($class);
-       $self->{dbh} = $dbh;
+       my $self = bless { dbh => $dbh }, $class;
 
        if ($writable) {
                create_tables($dbh);