Skip to content

Commit 791c79b

Browse files
committed
Add all option to clean all sessions
1 parent 019efba commit 791c79b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

sbin/rt-clean-sessions.in

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ BEGIN { # BEGIN RT CMD BOILERPLATE
6868

6969
use Getopt::Long;
7070
my %opt;
71-
GetOptions( \%opt, "older=s", "debug", "help|h", "skip-user" );
71+
GetOptions( \%opt, "older=s", "debug", "help|h", "skip-user", "all" );
7272

7373

7474
if ( $opt{help} ) {
@@ -106,14 +106,16 @@ RT::InitLogging();
106106
require RT::Interface::Web::Session;
107107

108108
my $alogoff = int RT->Config->Get('AutoLogoff');
109-
if ( $opt{'older'} or $alogoff ) {
109+
if ( $opt{'older'} or $alogoff or $opt{'all'} ) {
110110
my $min;
111111
foreach ($alogoff*60, $opt{'older'}) {
112112
next unless $_;
113113
$min = $_ unless $min;
114114
$min = $_ if $_ < $min;
115115
}
116116

117+
$min = 0 if $opt{'all'};
118+
117119
RT::Interface::Web::Session->ClearOld( $min );
118120
}
119121

@@ -130,13 +132,14 @@ rt-clean-sessions - clean old and duplicate RT sessions
130132

131133
=head1 SYNOPSIS
132134

133-
rt-clean-sessions [--debug] [--older <NUM>[H|D|M|Y]]
135+
rt-clean-sessions [--debug] [--older <NUM>[H|D|M|Y]] [--skip-user] [--all]
134136

135137
rt-clean-sessions
136138
rt-clean-sessions --debug
137139
rt-clean-sessions --older 10D
138140
rt-clean-sessions --debug --older 1M
139141
rt-clean-sessions --older 10D --skip-user
142+
rt-clean-sessions --all
140143

141144
=head1 DESCRIPTION
142145

@@ -164,6 +167,10 @@ By default only one session per user left in the DB, so users that have
164167
sessions on multiple computers or in different browsers will be logged out.
165168
Use this option to avoid this.
166169

170+
=item all
171+
172+
Use this option to clean all sessions.
173+
167174
=item debug
168175

169176
Turn on debug output.

0 commit comments

Comments
 (0)