aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/deleteExpiredEntries.pl11
1 files changed, 6 insertions, 5 deletions
diff --git a/misc/deleteExpiredEntries.pl b/misc/deleteExpiredEntries.pl
index 80dd79b..29e26b0 100755
--- a/misc/deleteExpiredEntries.pl
+++ b/misc/deleteExpiredEntries.pl
@@ -32,21 +32,22 @@ my $config = { ldap_bind_dn => [ 'cn=DeletePendingEntries','ou=services','o=mail
, ldap_suffix => [ 'ou=virtual','o=mailHosting','dc=fripost,dc=dev' ]
};
-my $fp = Fripost::Schema::->auth( undef, 'deletependingentries', %$config );
+my $fp = Fripost::Schema::Auth->auth( undef, 'deletependingentries', %$config );
my $maxage = $ARGV[0] // 86400; # 24h by default
my $now = int(strftime "%s", gmtime);
my $maxdate = Net::LDAP::Util::escape_filter_value(
- strftime ("%Y%m%d%H%M%SZ", localtime($now - $maxage)) );
+ strftime ("%Y%m%d%H%M%SZ", localtime($now - $maxage))
+ );
my $entries = $fp->ldap->search (
base => Fripost::Schema::Util::canonical_dn(@{$fp->suffix}),
scope => 'subtree',
deref => 'never',
- filter => "(&(fripostPendingToken=*)
+ filter => "(&(objectClass=FripostPendingEntry)
(createTimestamp<=$maxdate))",
- attrs => [],
+ attrs => [ '1.1' ],
callback => \&delete_entry
);
die $entries->error."\n" if $entries->code;
@@ -55,7 +56,7 @@ $fp->done;
sub delete_entry {
my ($mesg, $obj) = @_;
if (defined $obj and $obj->isa('Net::LDAP::Entry')) {
-# print STDERR "Deleting DN ".$obj->dn."\n";
+ print STDERR "Deleting DN ".$obj->dn."\n";
$obj->delete;
my $mesg = $obj->update($fp->ldap);
die $mesg->error."\n" if $mesg->code;