mirror of
https://codeberg.org/scip/note.git
synced 2025-12-17 12:41:10 +01:00
FIXED: most config variables not related to drivers had
invalid sentence in note, so the new ones of the new config
were ignored.
FIXED: added version to NOTEDB::text.
FIXED: fixed handling of NOTEDB::crypt_supported, now encryption
works again.
ADDED: NOTEDB::text now supports internal caching too.
CHANGED: lock() sets the umask internally to 022, so that other
users are able to read the lockfile.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
package NOTEDB::text;
|
||||
|
||||
$NOTEDB::text::VERSION = "1.01";
|
||||
|
||||
use strict;
|
||||
#use Data::Dumper;
|
||||
use File::Spec;
|
||||
@@ -40,6 +42,9 @@ sub new {
|
||||
}
|
||||
|
||||
$self->{LOCKFILE} = $param{dbname} . "~LOCK";
|
||||
$self->{mtime} = $self->get_stat();
|
||||
$self->{unread} = 1;
|
||||
$self->{data} = {};
|
||||
|
||||
return $self;
|
||||
}
|
||||
@@ -52,9 +57,14 @@ sub DESTROY
|
||||
|
||||
sub version {
|
||||
my $this = shift;
|
||||
return $this->{version};
|
||||
return $NOTEDB::text::VERSION;
|
||||
}
|
||||
|
||||
sub get_stat {
|
||||
my ($this) = @_;
|
||||
my $mtime = (stat($this->{dbname}))[9];
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
|
||||
sub set_del_all {
|
||||
@@ -268,8 +278,12 @@ sub _store {
|
||||
sub _retrieve {
|
||||
my $this = shift;
|
||||
if (-s $this->{NOTEDB}) {
|
||||
my $data = lock_retrieve($this->{NOTEDB});
|
||||
return %{$data};
|
||||
if ($this->changed() || $this->{unread}) {
|
||||
my $data = lock_retrieve($this->{NOTEDB});
|
||||
$this->{unread} = 0;
|
||||
$this->{data} = $data;
|
||||
return %{$data};
|
||||
}
|
||||
}
|
||||
else {
|
||||
return ();
|
||||
|
||||
Reference in New Issue
Block a user