--- loncom/auth/switchserver.pm 2010/08/18 19:25:12 1.29 +++ loncom/auth/switchserver.pm 2011/08/02 14:17:13 1.31 @@ -1,7 +1,7 @@ # The LearningOnline Network # Switch Servers Handler # -# $Id: switchserver.pm,v 1.29 2010/08/18 19:25:12 raeburn Exp $ +# $Id: switchserver.pm,v 1.31 2011/08/02 14:17:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,8 +62,15 @@ sub do_redirect { 'only_body' => $only_body,}); my $end_page = &Apache::loncommon::end_page(); $r->print($start_page.$extra_text.$end_page); + unless ($env{'user.name'} eq 'public' && ($env{'user.domain'} eq 'public')) { + $r->register_cleanup(\&flush_course_logs); + } return OK; +} +sub flush_course_logs { + &Apache::lonnet::flushcourselogs(); + return OK; } sub handler { @@ -108,7 +115,7 @@ sub handler { if (&Apache::lonnet::homeserver($env{'user.name'},$env{'user.domain'}) eq $env{'form.otherserver'}) { $skip_canhost_check = 1; } - } elsif ($env{'form.role'} =~ m{^[ac]a\./($match_domain)/($match_username)/$}) { + } elsif ($env{'form.role'} =~ m{^[ac]a\./($match_domain)/($match_username)$}) { if (&Apache::lonnet::homeserver($2,$1) eq $env{'form.otherserver'}) { $skip_canhost_check = 1; } @@ -189,7 +196,6 @@ sub handler { '&username='.$env{'user.name'}. '&token='.$token; # --------------------------------------------------------------- Screen Output - &Apache::lonnet::flushcourselogs(); return &do_redirect($r, $url, 0); }