Add a get_all_rooms helper

And expire rooms before entering the admin page
master
Daniel Berteaud 11 years ago
parent 85cd946587
commit f2594248c7
  1. 19
      public/vroom.pl

@ -401,6 +401,20 @@ helper delete_room => sub {
return 1; return 1;
}; };
# Retrieve the list of rooms
helper get_all_rooms => sub {
my $self = shift;
my @rooms;
my $sth = eval {
$self->db->prepare("SELECT `name` FROM `rooms`;");
} || return undef;
$sth->execute() || return undef;
while (my $name = $sth->fetchrow_array){
push @rooms, $name;
}
return @rooms;
};
# Just update the activity timestamp # Just update the activity timestamp
# so we can detect unused rooms # so we can detect unused rooms
helper ping_room => sub { helper ping_room => sub {
@ -709,7 +723,10 @@ get '/about' => sub {
get '/help' => 'help'; get '/help' => 'help';
# Route for the admin page # Route for the admin page
get 'admin' => 'admin'; get '/admin' => sub {
my $self = shift;
$self->delete_rooms;
} => 'admin';
# Routes for feedback. One get to display the form # Routes for feedback. One get to display the form
# and one post to get data from it # and one post to get data from it

Loading…
Cancel
Save