|
Lines 31-36
use C4::Context;
Link Here
|
| 31 |
use C4::Templates; # to get the template |
31 |
use C4::Templates; # to get the template |
| 32 |
use C4::Languages; |
32 |
use C4::Languages; |
| 33 |
use C4::Search::History; |
33 |
use C4::Search::History; |
|
|
34 |
use C4::Installer; |
| 34 |
use Koha; |
35 |
use Koha; |
| 35 |
use Koha::Logger; |
36 |
use Koha::Logger; |
| 36 |
use Koha::Caches; |
37 |
use Koha::Caches; |
|
Lines 51-56
use Net::CIDR;
Link Here
|
| 51 |
use C4::Log qw( logaction ); |
52 |
use C4::Log qw( logaction ); |
| 52 |
use Koha::CookieManager; |
53 |
use Koha::CookieManager; |
| 53 |
use Koha::Auth::Permissions; |
54 |
use Koha::Auth::Permissions; |
|
|
55 |
use Koha::Migrations; |
| 54 |
|
56 |
|
| 55 |
# use utf8; |
57 |
# use utf8; |
| 56 |
|
58 |
|
|
Lines 574-580
sub get_template_and_user {
Link Here
|
| 574 |
OPACPrivacy => C4::Context->preference("OPACPrivacy"), |
576 |
OPACPrivacy => C4::Context->preference("OPACPrivacy"), |
| 575 |
OPACFinesTab => C4::Context->preference("OPACFinesTab"), |
577 |
OPACFinesTab => C4::Context->preference("OPACFinesTab"), |
| 576 |
OpacTopissue => C4::Context->preference("OpacTopissue"), |
578 |
OpacTopissue => C4::Context->preference("OpacTopissue"), |
| 577 |
'Version' => C4::Context->preference('Version'), |
|
|
| 578 |
hidelostitems => C4::Context->preference("hidelostitems"), |
579 |
hidelostitems => C4::Context->preference("hidelostitems"), |
| 579 |
mylibraryfirst => ( C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv ) ? C4::Context->userenv->{'branch'} : '', |
580 |
mylibraryfirst => ( C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv ) ? C4::Context->userenv->{'branch'} : '', |
| 580 |
opacbookbag => "" . C4::Context->preference("opacbookbag"), |
581 |
opacbookbag => "" . C4::Context->preference("opacbookbag"), |
|
Lines 704-710
has authenticated.
Link Here
|
| 704 |
sub _version_check { |
705 |
sub _version_check { |
| 705 |
my $type = shift; |
706 |
my $type = shift; |
| 706 |
my $query = shift; |
707 |
my $query = shift; |
| 707 |
my $version; |
|
|
| 708 |
|
708 |
|
| 709 |
# If version syspref is unavailable, it means Koha is being installed, |
709 |
# If version syspref is unavailable, it means Koha is being installed, |
| 710 |
# and so we must redirect to OPAC maintenance page or to the WebInstaller |
710 |
# and so we must redirect to OPAC maintenance page or to the WebInstaller |
|
Lines 714-720
sub _version_check {
Link Here
|
| 714 |
print $query->redirect("/cgi-bin/koha/maintenance.pl"); |
714 |
print $query->redirect("/cgi-bin/koha/maintenance.pl"); |
| 715 |
safe_exit; |
715 |
safe_exit; |
| 716 |
} |
716 |
} |
| 717 |
unless ( $version = C4::Context->preference('Version') ) { # assignment, not comparison |
717 |
unless ( C4::Installer::TableExists('systempreferences') ) { |
| 718 |
if ( $type ne 'opac' ) { |
718 |
if ( $type ne 'opac' ) { |
| 719 |
warn "Install required, redirecting to Installer"; |
719 |
warn "Install required, redirecting to Installer"; |
| 720 |
print $query->redirect("/cgi-bin/koha/installer/install.pl"); |
720 |
print $query->redirect("/cgi-bin/koha/installer/install.pl"); |
|
Lines 725-741
sub _version_check {
Link Here
|
| 725 |
safe_exit; |
725 |
safe_exit; |
| 726 |
} |
726 |
} |
| 727 |
|
727 |
|
| 728 |
# check that database and koha version are the same |
728 |
if (Koha::Migrations->pending_migrations > 0) { |
| 729 |
# there is no DB version, it's a fresh install, |
729 |
my $warning = "Database update needed, redirecting to %s"; |
| 730 |
# go to web installer |
|
|
| 731 |
# there is a DB version, compare it to the code version |
| 732 |
my $kohaversion = Koha::version(); |
| 733 |
|
| 734 |
# remove the 3 last . to have a Perl number |
| 735 |
$kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; |
| 736 |
Koha::Logger->get->debug("kohaversion : $kohaversion"); |
| 737 |
if ( $version < $kohaversion ) { |
| 738 |
my $warning = "Database update needed, redirecting to %s. Database is $version and Koha is $kohaversion"; |
| 739 |
if ( $type ne 'opac' ) { |
730 |
if ( $type ne 'opac' ) { |
| 740 |
warn sprintf( $warning, 'Installer' ); |
731 |
warn sprintf( $warning, 'Installer' ); |
| 741 |
print $query->redirect("/cgi-bin/koha/installer/install.pl?step=1&op=updatestructure"); |
732 |
print $query->redirect("/cgi-bin/koha/installer/install.pl?step=1&op=updatestructure"); |
|
Lines 1519-1533
sub check_api_auth {
Link Here
|
| 1519 |
my $flagsrequired = shift; |
1510 |
my $flagsrequired = shift; |
| 1520 |
my $timeout = _timeout_syspref(); |
1511 |
my $timeout = _timeout_syspref(); |
| 1521 |
|
1512 |
|
| 1522 |
unless ( C4::Context->preference('Version') ) { |
1513 |
if ( Koha::Migrations->pending_migrations > 0 ) { |
| 1523 |
|
|
|
| 1524 |
# database has not been installed yet |
| 1525 |
return ( "maintenance", undef, undef ); |
| 1526 |
} |
| 1527 |
my $kohaversion = Koha::version(); |
| 1528 |
$kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; |
| 1529 |
if ( C4::Context->preference('Version') < $kohaversion ) { |
| 1530 |
|
| 1531 |
# database in need of version update; assume that |
1514 |
# database in need of version update; assume that |
| 1532 |
# no API should be called while databsae is in |
1515 |
# no API should be called while databsae is in |
| 1533 |
# this condition. |
1516 |
# this condition. |
|
Lines 1728-1744
sub check_cookie_auth {
Link Here
|
| 1728 |
my $skip_version_check = $params->{skip_version_check}; # Only for checkauth |
1711 |
my $skip_version_check = $params->{skip_version_check}; # Only for checkauth |
| 1729 |
|
1712 |
|
| 1730 |
unless ( $skip_version_check ) { |
1713 |
unless ( $skip_version_check ) { |
| 1731 |
unless ( C4::Context->preference('Version') ) { |
1714 |
if ( Koha::Migrations->pending_migrations > 0 ) { |
| 1732 |
|
|
|
| 1733 |
# database has not been installed yet |
| 1734 |
return ( "maintenance", undef ); |
| 1735 |
} |
| 1736 |
my $kohaversion = Koha::version(); |
| 1737 |
$kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; |
| 1738 |
if ( C4::Context->preference('Version') < $kohaversion ) { |
| 1739 |
|
| 1740 |
# database in need of version update; assume that |
1715 |
# database in need of version update; assume that |
| 1741 |
# no API should be called while databsae is in |
1716 |
# no API should be called while database is in |
| 1742 |
# this condition. |
1717 |
# this condition. |
| 1743 |
return ( "maintenance", undef ); |
1718 |
return ( "maintenance", undef ); |
| 1744 |
} |
1719 |
} |