[Rt-commit] r4665 - in rt/branches/3.7-EXPERIMENTAL: .
lib/RT/Interface/Web
alexmv at bestpractical.com
alexmv at bestpractical.com
Thu Mar 2 18:21:02 EST 2006
Author: alexmv
Date: Thu Mar 2 18:21:01 2006
New Revision: 4665
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web/Session.pm
rt/branches/3.7-EXPERIMENTAL/sbin/rt-clean-sessions.in
Log:
r9448 at zoq-fot-pik: chmrr | 2006-03-02 18:20:49 -0500
* Session fixes
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web/Session.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web/Session.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web/Session.pm Thu Mar 2 18:21:01 2006
@@ -1,4 +1,6 @@
package RT::Interface::Web::Session;
+use warnings;
+use strict;
=head1 NAME
@@ -27,8 +29,11 @@
=cut
sub Class {
- no warnings 'once';
- my $class = RT->Config->Get('WebSessionClass') || $backends{RT->Config->Get('DatabaseType')} || 'Apache::Session::File';
+ my $self = shift;
+
+ my $class = RT->Config->Get('WebSessionClass')
+ || $self->Backends->{RT->Config->Get('DatabaseType')}
+ || 'Apache::Session::File';
eval "require $class";
die $@ if $@;
return $class;
@@ -72,19 +77,17 @@
=cut
-sub Ids
-{
+sub Ids {
my $self = shift || __PACKAGE__;
my $attributes = $self->Attributes;
if( $attributes->{Directory} ) {
- return _IdsDir( $attributes->{Directory} );
+ return $self->_IdsDir( $attributes->{Directory} );
} else {
- return _IdsDB( $RT::Handle->dbh );
+ return $self->_IdsDB( $RT::Handle->dbh );
}
}
-sub _IdsDir
-{
+sub _IdsDir {
my ($self, $dir) = @_;
require File::Find;
my %file;
@@ -98,8 +101,7 @@
return [ sort { $file{$a} <=> $file{$b} } keys %file ];
}
-sub _IdsDB
-{
+sub _IdsDB {
my ($self, $dbh) = @_;
my $ids = $dbh->selectcol_arrayref("SELECT id FROM sessions ORDER BY LastUpdated DESC");
die "couldn't get ids: ". $dbh->errstr if $dbh->errstr;
@@ -122,9 +124,7 @@
}
}
-sub _ClearOldDB
-{
-
+sub _ClearOldDB {
my ($self, $dbh, $older_than) = @_;
my $rows;
unless( int $older_than ) {
@@ -134,7 +134,7 @@
require POSIX;
my $date = POSIX::strftime("%Y-%m-%d %H:%M", localtime( time - int $older_than ) );
- my $sth = $dbh->prepare("DELETE FROM sessions WHERE LastUpdate < ?");
+ my $sth = $dbh->prepare("DELETE FROM sessions WHERE LastUpdated < ?");
die "couldn't prepare query: ". $dbh->errstr unless $sth;
$rows = $sth->execute( $date );
die "couldn't execute query: ". $dbh->errstr unless defined $rows;
@@ -144,8 +144,7 @@
return;
}
-sub _ClearOldDir
-{
+sub _ClearOldDir {
my ($self, $dir, $older_than) = @_;
require File::Spec if int $older_than;
Modified: rt/branches/3.7-EXPERIMENTAL/sbin/rt-clean-sessions.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/sbin/rt-clean-sessions.in (original)
+++ rt/branches/3.7-EXPERIMENTAL/sbin/rt-clean-sessions.in Thu Mar 2 18:21:01 2006
@@ -12,7 +12,7 @@
if ( $opt{help} ) {
require Pod::Usage;
import Pod::Usage;
- pod2usage("RT Session cleanup tool\n");
+ pod2usage({ -message => "RT Session cleanup tool\n", verbose => 1 });
exit 1;
}
@@ -59,11 +59,13 @@
exit(0);
+__END__
+
=head1 NAME
rt-clean-sessions - clean old and duplicate RT sessions
-=head1 USAGE
+=head1 SYNOPSIS
rt-clean-sessions [--debug] [--older <NUM>[H|D|M|Y]]
@@ -95,4 +97,3 @@
Turn on debug output.
=cut
-
More information about the Rt-commit
mailing list