steffen: server/perl-kolab/Kolab-LDAP LDAP.pm.in,1.2,1.3
cvs at intevation.de
cvs at intevation.de
Mon Apr 10 00:49:45 CEST 2006
Author: steffen
Update of /kolabrepository/server/perl-kolab/Kolab-LDAP
In directory doto:/tmp/cvs-serv5187/Kolab-LDAP
Modified Files:
LDAP.pm.in
Log Message:
Fix for Issue1194 (kolabd quota performance) plus a timing fix for the actual LDAP replication client in kolabd
Index: LDAP.pm.in
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab-LDAP/LDAP.pm.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- LDAP.pm.in 28 Feb 2006 14:39:07 -0000 1.2
+++ LDAP.pm.in 9 Apr 2006 22:49:43 -0000 1.3
@@ -33,7 +33,7 @@
use Kolab::Util;
use Kolab::Cyrus;
use Kolab::DirServ;
-use vars qw(%uid_db %gyard_db %newuid_db %gyard_ts_db);
+use vars qw(%uid_db %gyard_db %newuid_db %gyard_ts_db %quota_db);
require Exporter;
@@ -84,6 +84,13 @@
Kolab::log('L', 'Unable to open graveyard timestamp cache DB', KOLAB_ERROR);
exit(1);
}
+
+ Kolab::log('L', 'Opening mailbox quota cache DB');
+
+ if (!dbmopen(%quota_db, "@kolab_statedir@/mailbox-quotacache.db", 0666)) {
+ Kolab::log('L', 'Unable to open mailbox quota cache DB', KOLAB_ERROR);
+ exit(1);
+ }
}
sub shutdown
@@ -92,6 +99,7 @@
dbmclose(%uid_db);
dbmclose(%gyard_db);
+ dbmclose(%quota_db);
}
sub create
@@ -346,7 +354,15 @@
my $quota = $object->get_value($Kolab::config{$p . '_field_quota'});
defined($quota) or ($quota = 0);
- Kolab::Cyrus::setQuota($cyrus, $uid, $quota*1024, ($p eq 'sf' ? 1 : 0));
+ my $oldquota = $quota_db{$guid} || 0;
+ if( $quota != $oldquota ) {
+ Kolab::Cyrus::setQuota($cyrus, $uid, $quota*1024, ($p eq 'sf' ? 1 : 0));
+ if( $quota == 0 ) {
+ delete $quota_db{$guid};
+ } else {
+ $quota_db{$guid} = $quota;
+ }
+ }
}
sub createMasterLDAP {
@@ -484,6 +500,7 @@
# system("rm -rf \"$fbdir\"" );
# }
delete $uid_db{$guid};
+ delete $quota_db{$guid};
return 1;
}
@@ -513,6 +530,7 @@
$u =~ /user[\/\.]([^\/]*)\/?.*/;
$objects{$1} = 1 if ($1);
}
+ undef @mailboxes;
my $guid;
foreach $guid (keys %newuid_db) {
@@ -581,13 +599,12 @@
'*',
$Kolab::config{$p . '_field_guid'},
$Kolab::config{$p . '_field_modified'},
- $Kolab::config{$p . '_field_quota'},
$Kolab::config{$p . '_field_deleted'},
],
);
if ( UNIVERSAL::isa( $ldapmesg, 'Net::LDAP::Search') && $ldapmesg->code() <= 0) {
- foreach $ldapobject ($ldapmesg->entries) {
+ while( $ldapobject = $ldapmesg->pop_entry ) {
deleteObject($ldap, $cyrus, $ldapobject, 1, $p);
}
} else {
@@ -610,7 +627,7 @@
);
if ( UNIVERSAL::isa( $ldapmesg, 'Net::LDAP::Search') && $ldapmesg->code() <= 0) {
- foreach $ldapobject ($ldapmesg->entries) {
+ while( $ldapobject = $ldapmesg->pop_entry ) {
createObject($ldap, $cyrus, $ldapobject, 1, $p, $doacls);
}
} else {
More information about the commits
mailing list