]> Frank Brehm's Git Trees - books.git/commitdiff
Expired Sessions löschen dazu
authorFrank Brehm <frank@brehm-online.com>
Thu, 18 Dec 2008 13:54:54 +0000 (13:54 +0000)
committerFrank Brehm <frank@brehm-online.com>
Thu, 18 Dec 2008 13:54:54 +0000 (13:54 +0000)
lib/FrBr/Books.pm
lib/FrBr/Books/Controller/Cron.pm [new file with mode: 0644]
lib/FrBr/Books/Model/Schema.pm
scheduler.yml [new file with mode: 0644]

index cf2633682e3f8b1fafc27caf0f429e4c46bdc0c2..bc518e466817547eedf2ed223551b8ce0cce0731 100644 (file)
@@ -25,6 +25,8 @@ use Catalyst qw/
     +FrBr::Books::Plugin::ConfigLoader
     +FrBr::Books::Plugin::WebPath
 
+    Scheduler
+
     Static::Simple
 
     StackTrace
diff --git a/lib/FrBr/Books/Controller/Cron.pm b/lib/FrBr/Books/Controller/Cron.pm
new file mode 100644 (file)
index 0000000..bcd2de2
--- /dev/null
@@ -0,0 +1,110 @@
+package FrBr::Books::Controller::Cron;
+
+# $Id$
+# $URL$
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+use FrBr::Common;
+use FrBr::Books::Util::Category;
+
+=head1 NAME
+
+FrBr::Books::Controller::Cron - Catalyst Controller fuer cron-gesteuerte Ereignisse
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+#-------------------------------------------------------
+
+=head2 auto
+
+=cut
+
+sub auto : Private {
+
+    my ( $self, $c ) = @_;
+    my $K = ( caller(0) )[3] . "(): ";
+
+    $c->log->debug( $K . "aufgerufen." ) if $c->stash->{'debug_level'} > 2;
+
+    1;
+
+} ## end sub auto :
+
+#-------------------------------------------------------
+
+=head2 index 
+
+=cut
+
+sub index : Private {
+    my ( $self, $c ) = @_;
+    my $K = ( caller(0) )[3] . "(): ";
+}
+
+#-------------------------------------------------------
+
+=head2 default
+
+=cut
+
+sub default : Private {
+
+    my ( $self, $c ) = @_;
+    my $K = ( caller(0) )[3] . "(): ";
+
+    $c->stash->{'template'}   = 'not_implemented.tt2';
+
+    push @{ $c->stash->{'menu_path'} }, {
+        'path' => $c->web_path("/default"),
+        'name' => "Nicht Implementiert",
+        'show' => undef,
+    };
+
+} ## end sub default :
+
+#-------------------------------------------------------
+
+sub remove_sessions : Local {
+
+    my ( $self, $c ) = @_;
+    my $K = ( caller(0) )[3] . "(): ";
+
+    $c->log->debug( $K . "aufgerufen." ) if $c->stash->{'debug_level'} > 2;
+
+    $c->delete_expired_sessions;
+    $c->log->debug( $K . "beendet." ) if $c->stash->{'debug_level'} >= 2;
+
+    $c->stash->{'message'}  = "Abgelaufene Sitzungen wurden entfernt";
+    $c->stash->{'template'} = 'welcome.tt2';
+
+    return 1;
+
+}
+
+#-------------------------------------------------------
+
+=head1 AUTHOR
+
+Frank Brehm
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
+__END__
+
+# vim: noai : ts=4 fenc=utf-8 filetype=perl expandtab : 
index 16bed791e19ea52da69150d666e1cc16585b93dc..4de727989524f8b92f92b60d5b6aebe15e932667 100644 (file)
@@ -19,6 +19,19 @@ __PACKAGE__->config(
     ],
 );
 
+sub setup {
+
+    my $c = shift;
+    my $K = ( caller(0) )[3] . "(): ";
+    $c->log->debug( $K . "aufgerufen." ) if $c->stash->{'debug_level'} > 2;
+    warn $K . "aufgerufen.\n";
+
+    $c->NEXT::setup(@_);
+
+    return $c;
+}
+
+
 =head1 NAME
 
 FrBr::Books::Model::Schema - Catalyst DBIC Schema Model
diff --git a/scheduler.yml b/scheduler.yml
new file mode 100644 (file)
index 0000000..8d5cc70
--- /dev/null
@@ -0,0 +1,3 @@
+---
+- at: '0,15,30,45 * * * *'
+  event: /cron/remove_sessions