Lines 15-50
Link Here
|
15 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
15 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
16 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
16 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
17 |
|
17 |
|
18 |
use strict; |
18 |
use Modern::Perl; |
19 |
use warnings; |
|
|
20 |
|
21 |
# FIXME - Generates a warning from C4/Context.pm (uninitilized value). |
22 |
|
19 |
|
23 |
use CGI; |
20 |
use CGI; |
24 |
use C4::Auth; |
21 |
use C4::Auth; |
25 |
use C4::Output; |
22 |
use C4::Output; |
|
|
23 |
use C4::Templates qw/gettemplate/; |
26 |
|
24 |
|
27 |
my $input = new CGI; |
25 |
my $query = new CGI; |
28 |
|
26 |
my $template = C4::Templates::gettemplate( 'maintenance.tt', 'opac', $query, 0 ); |
29 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
|
|
30 |
{ |
31 |
template_name => "maintenance.tt", |
32 |
type => "opac", |
33 |
query => $input, |
34 |
authnotrequired => 1, |
35 |
flagsrequired => { borrow => 1 }, |
36 |
} |
37 |
); |
38 |
|
27 |
|
39 |
my $koha_db_version = C4::Context->preference('Version'); |
28 |
my $koha_db_version = C4::Context->preference('Version'); |
40 |
my $kohaversion = C4::Context::KOHAVERSION; |
29 |
my $kohaversion = C4::Context::KOHAVERSION; |
41 |
$kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; |
30 |
# Strip dots from version |
42 |
|
31 |
$kohaversion =~ s/\.//g if defined $kohaversion; |
43 |
#warn "db: $koha_db_version, koha: $kohaversion"; |
32 |
$koha_db_version =~ s/\.//g if defined $koha_db_version; |
44 |
|
33 |
|
45 |
if ( $kohaversion > $koha_db_version or C4::Context->preference('OpacMaintenance') ) { |
34 |
if ( !defined $koha_db_version || # DB not populated |
46 |
output_html_with_http_headers $input, '', $template->output; |
35 |
$kohaversion > $koha_db_version || # Update needed |
|
|
36 |
C4::Context->preference('OpacMaintenance') ) { # Maintenance mode enabled |
37 |
output_html_with_http_headers $query, '', $template->output; |
47 |
} |
38 |
} |
48 |
else { |
39 |
else { |
49 |
print $input->redirect("/cgi-bin/koha/opac-main.pl"); |
40 |
print $query->redirect("/cgi-bin/koha/opac-main.pl"); |
50 |
} |
41 |
} |
51 |
- |
42 |
|
|
|
43 |
1; |