| File | opac/opac-main.pl | Statements Executed | 13 | Total Time | 0.000382 seconds |
| Calls | Inclusive Time | Subroutine | |
|---|---|---|---|
| 0 | 0 | main:: | BEGIN |
| Line | Stmts. | Exclusive Time | Avg. | Code |
|---|---|---|---|---|
| 1 | 1 | 0.00018 | 0.00018 | #!/usr/bin/perl |
| 2 | ||||
| 3 | # This file is part of Koha. | |||
| 4 | # | |||
| 5 | # Koha is free software; you can redistribute it and/or modify it under the | |||
| 6 | # terms of the GNU General Public License as published by the Free Software | |||
| 7 | # Foundation; either version 2 of the License, or (at your option) any later | |||
| 8 | # version. | |||
| 9 | # | |||
| 10 | # Koha is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| 11 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| 12 | # A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| 13 | # | |||
| 14 | # You should have received a copy of the GNU General Public License along with | |||
| 15 | # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, | |||
| 16 | # Suite 330, Boston, MA 02111-1307 USA | |||
| 17 | ||||
| 18 | ||||
| 19 | use strict; | |||
| 20 | ||||
| 21 | ||||
| 22 | use CGI; | |||
| 23 | 1 | 0.00004 | 0.00004 | my $input = new CGI; # spent 0.00586s making 1 calls to CGI::new |
| 24 | ||||
| 25 | 1 | 1e-06 | 1e-06 | my $memd; |
| 26 | ||||
| 27 | use C4::Auth; | |||
| 28 | use C4::Output; | |||
| 29 | use C4::VirtualShelves; | |||
| 30 | use C4::Branch; | |||
| 31 | use C4::Members; | |||
| 32 | use C4::NewsChannels; | |||
| 33 | use C4::Acquisition; | |||
| 34 | ||||
| 35 | 1 | 0.00001 | 0.00001 | my $usecache=C4::Context->preference('usecache'); # spent 0.00046s making 1 calls to C4::Context::preference |
| 36 | ||||
| 37 | 1 | 0.00002 | 0.00002 | my ( $template, $borrowernumber, $cookie ) = get_template_and_user( # spent 0.05004s making 1 calls to C4::Auth::get_template_and_user |
| 38 | { | |||
| 39 | template_name => "opac-main.tmpl", | |||
| 40 | type => "opac", | |||
| 41 | query => $input, | |||
| 42 | authnotrequired => 1, | |||
| 43 | flagsrequired => { borrow => 1 }, | |||
| 44 | } | |||
| 45 | ); | |||
| 46 | ||||
| 47 | 1 | 1e-06 | 1e-06 | if ($usecache){ |
| 48 | 1 | 2e-06 | 2e-06 | require Cache::Memcached; |
| 49 | 1 | 0.00001 | 0.00001 | Cache::Memcached->import(); # spent 4e-06s making 1 calls to 1 |
| 50 | 1 | 0.00001 | 0.00001 | $memd = new Cache::Memcached( # spent 0.00014s making 1 calls to Cache::Memcached::new |
| 51 | 'servers'=>['127.0.0.1:11211'], | |||
| 52 | ); | |||
| 53 | 1 | 0.00001 | 0.00001 | my $page = $memd->get("koha:opacmain:$borrowernumber"); # spent 0.00060s making 1 calls to Cache::Memcached::get |
| 54 | 1 | 1e-06 | 1e-06 | if ($page){ |
| 55 | 1 | 0.00001 | 0.00001 | output_html_with_http_headers $input, $cookie, $page; # spent 0.00349s making 1 calls to C4::Output::output_html_with_http_headers |
| 56 | 1 | 0.00007 | 0.00007 | exit; |
| 57 | } | |||
| 58 | } | |||
| 59 | ||||
| 60 | ||||
| 61 | my $dbh = C4::Context->dbh; | |||
| 62 | my $borrower = GetMember( $borrowernumber, 'borrowernumber' ); | |||
| 63 | $template->param( | |||
| 64 | textmessaging => $borrower->{textmessaging}, | |||
| 65 | ); | |||
| 66 | ||||
| 67 | # display news | |||
| 68 | # use cookie setting for language, bug default to syspref if it's not set | |||
| 69 | my $news_lang = $input->cookie('KohaOpacLanguage') || 'en'; | |||
| 70 | my $all_koha_news = &GetNewsToDisplay($news_lang); | |||
| 71 | my $koha_news_count = scalar @$all_koha_news; | |||
| 72 | ||||
| 73 | $template->param( | |||
| 74 | koha_news => $all_koha_news, | |||
| 75 | koha_news_count => $koha_news_count | |||
| 76 | ); | |||
| 77 | ||||
| 78 | $template->param( | |||
| 79 | 'Disable_Dictionary' => C4::Context->preference("Disable_Dictionary") ) | |||
| 80 | if ( C4::Context->preference("Disable_Dictionary") ); | |||
| 81 | ||||
| 82 | if ($usecache){ | |||
| 83 | my $page = $template->output(); | |||
| 84 | $memd->set("koha:opacmain:$borrowernumber", $page, 300); | |||
| 85 | } | |||
| 86 | C4::Output::output_html_with_http_headers $input, $cookie, $template->output; | |||
| 87 |