Hintergrundjob zum Löschen abgelaufener Sessions
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 10 Jul 2014 07:51:33 +0000 (09:51 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 10 Jul 2014 07:51:33 +0000 (09:51 +0200)
SL/BackgroundJob/CleanAuthSessions.pm [new file with mode: 0644]
sql/Pg-upgrade2/background_jobs_clean_auth_sessions.pl [new file with mode: 0644]

diff --git a/SL/BackgroundJob/CleanAuthSessions.pm b/SL/BackgroundJob/CleanAuthSessions.pm
new file mode 100644 (file)
index 0000000..8510902
--- /dev/null
@@ -0,0 +1,47 @@
+package SL::BackgroundJob::CleanAuthSessions;
+
+use strict;
+
+use parent qw(SL::BackgroundJob::Base);
+
+sub create_job {
+  $_[0]->create_standard_job('30 6 * * *'); # daily at 6:30 am
+}
+
+sub run {
+  my ($self) = @_;
+
+  $::auth->expire_sessions;
+
+  return 1;
+}
+
+1;
+
+__END__
+
+=encoding utf8
+
+=head1 NAME
+
+SL::BackgroundJob::CleanAuthSessions - Background job for cleaning the
+session tables of expired entries
+
+=head1 SYNOPSIS
+
+This background job deletes all entries for expired sessions from the
+tables C<auth.session> and C<auth.session_content>. It will also
+delete all files associated with that session (see
+L<SL::SessionFile>).
+
+The job is supposed to run once a day.
+
+=head1 BUGS
+
+Nothing here yet.
+
+=head1 AUTHOR
+
+Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
+
+=cut
diff --git a/sql/Pg-upgrade2/background_jobs_clean_auth_sessions.pl b/sql/Pg-upgrade2/background_jobs_clean_auth_sessions.pl
new file mode 100644 (file)
index 0000000..cab9196
--- /dev/null
@@ -0,0 +1,21 @@
+# @tag: background_jobs_clean_auth_sessions
+# @description: Hintergrundjob zum Löschen abgelaufener Sessions
+# @depends: release_3_1_0
+package SL::DBUpgrade2::background_jobs_clean_auth_sessions;
+
+use strict;
+use utf8;
+
+use parent qw(SL::DBUpgrade2::Base);
+
+use SL::BackgroundJob::CleanAuthSessions;
+
+sub run {
+  my ($self) = @_;
+
+  SL::BackgroundJob::CleanAuthSessions->create_job;
+
+  return 1;
+}
+
+1;