aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@fripost.org>2013-01-25 02:49:26 +0100
committerGuilhem Moulin <guilhem.moulin@fripost.org>2013-01-25 03:59:00 +0100
commit99b3ecbaf20b4e47ee6a403fd30268939e6e1244 (patch)
treee4f66d319dffabaade462115c3e8995cce6a726f /misc
parent93713bfe4b48e2335826f1886fa7e684787ece01 (diff)
Updated and redocumented Fripost::Schema::Domain.
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;