10 sub userinfo_retrieve () { #{{{
11 my $userinfo=eval{ Storable::lock_retrieve("$config{wikistatedir}/userdb") };
15 sub userinfo_store ($) { #{{{
18 my $oldmask=umask(077);
19 my $ret=Storable::lock_store($userinfo, "$config{wikistatedir}/userdb");
24 sub userinfo_get ($$) { #{{{
28 my $userinfo=userinfo_retrieve();
29 if (! defined $userinfo ||
30 ! exists $userinfo->{$user} || ! ref $userinfo->{$user} ||
31 ! exists $userinfo->{$user}->{$field}) {
34 return $userinfo->{$user}->{$field};
37 sub userinfo_set ($$$) { #{{{
42 my $userinfo=userinfo_retrieve();
43 if (! defined $userinfo ||
44 ! exists $userinfo->{$user} || ! ref $userinfo->{$user}) {
48 $userinfo->{$user}->{$field}=$value;
49 return userinfo_store($userinfo);
52 sub userinfo_setall ($$) { #{{{
56 my $userinfo=userinfo_retrieve();
57 if (! defined $userinfo) {
60 $userinfo->{$user}=$info;
61 return userinfo_store($userinfo);
64 sub is_admin ($) { #{{{
67 return grep { $_ eq $user_name } @{$config{adminuser}};
70 sub commit_notify_list ($@) { #{{{
74 foreach my $file (@_) {
75 push @pages, grep { $pagesources{$_} eq $file } keys %pagesources;
79 my $userinfo=userinfo_retrieve();
80 foreach my $user (keys %{$userinfo}) {
81 next if $user eq $committer;
82 if (exists $userinfo->{$user}->{subscriptions} &&
83 length $userinfo->{$user}->{subscriptions} &&
84 exists $userinfo->{$user}->{email} &&
85 length $userinfo->{$user}->{email} &&
86 grep { pagespec_match($_, $userinfo->{$user}->{subscriptions}) } @pages) {
87 push @ret, $userinfo->{$user}->{email};