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::Caches; |
36 |
use Koha::Caches; |
36 |
use Koha::AuthUtils qw(get_script_name hash_password); |
37 |
use Koha::AuthUtils qw(get_script_name hash_password); |
Lines 48-53
use Encode qw( encode is_utf8);
Link Here
|
48 |
use C4::Auth_with_shibboleth; |
49 |
use C4::Auth_with_shibboleth; |
49 |
use Net::CIDR; |
50 |
use Net::CIDR; |
50 |
use C4::Log qw/logaction/; |
51 |
use C4::Log qw/logaction/; |
|
|
52 |
use Koha::Migrations; |
51 |
|
53 |
|
52 |
# use utf8; |
54 |
# use utf8; |
53 |
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap $cas $caslogout); |
55 |
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap $cas $caslogout); |
Lines 597-603
sub get_template_and_user {
Link Here
|
597 |
OPACFinesTab => C4::Context->preference("OPACFinesTab"), |
599 |
OPACFinesTab => C4::Context->preference("OPACFinesTab"), |
598 |
OpacTopissue => C4::Context->preference("OpacTopissue"), |
600 |
OpacTopissue => C4::Context->preference("OpacTopissue"), |
599 |
RequestOnOpac => C4::Context->preference("RequestOnOpac"), |
601 |
RequestOnOpac => C4::Context->preference("RequestOnOpac"), |
600 |
'Version' => C4::Context->preference('Version'), |
|
|
601 |
hidelostitems => C4::Context->preference("hidelostitems"), |
602 |
hidelostitems => C4::Context->preference("hidelostitems"), |
602 |
mylibraryfirst => ( C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv ) ? C4::Context->userenv->{'branch'} : '', |
603 |
mylibraryfirst => ( C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv ) ? C4::Context->userenv->{'branch'} : '', |
603 |
opacbookbag => "" . C4::Context->preference("opacbookbag"), |
604 |
opacbookbag => "" . C4::Context->preference("opacbookbag"), |
Lines 733-739
has authenticated.
Link Here
|
733 |
sub _version_check { |
734 |
sub _version_check { |
734 |
my $type = shift; |
735 |
my $type = shift; |
735 |
my $query = shift; |
736 |
my $query = shift; |
736 |
my $version; |
|
|
737 |
|
737 |
|
738 |
# If version syspref is unavailable, it means Koha is being installed, |
738 |
# If version syspref is unavailable, it means Koha is being installed, |
739 |
# and so we must redirect to OPAC maintenance page or to the WebInstaller |
739 |
# and so we must redirect to OPAC maintenance page or to the WebInstaller |
Lines 743-749
sub _version_check {
Link Here
|
743 |
print $query->redirect("/cgi-bin/koha/maintenance.pl"); |
743 |
print $query->redirect("/cgi-bin/koha/maintenance.pl"); |
744 |
safe_exit; |
744 |
safe_exit; |
745 |
} |
745 |
} |
746 |
unless ( $version = C4::Context->preference('Version') ) { # assignment, not comparison |
746 |
unless ( C4::Installer::TableExists('systempreferences') ) { |
747 |
if ( $type ne 'opac' ) { |
747 |
if ( $type ne 'opac' ) { |
748 |
warn "Install required, redirecting to Installer"; |
748 |
warn "Install required, redirecting to Installer"; |
749 |
print $query->redirect("/cgi-bin/koha/installer/install.pl"); |
749 |
print $query->redirect("/cgi-bin/koha/installer/install.pl"); |
Lines 758-770
sub _version_check {
Link Here
|
758 |
# there is no DB version, it's a fresh install, |
758 |
# there is no DB version, it's a fresh install, |
759 |
# go to web installer |
759 |
# go to web installer |
760 |
# there is a DB version, compare it to the code version |
760 |
# there is a DB version, compare it to the code version |
761 |
my $kohaversion = Koha::version(); |
761 |
if (Koha::Migrations->pending_migrations > 0) { |
762 |
|
762 |
my $warning = "Database update needed, redirecting to %s"; |
763 |
# remove the 3 last . to have a Perl number |
|
|
764 |
$kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; |
765 |
$debug and print STDERR "kohaversion : $kohaversion\n"; |
766 |
if ( $version < $kohaversion ) { |
767 |
my $warning = "Database update needed, redirecting to %s. Database is $version and Koha is $kohaversion"; |
768 |
if ( $type ne 'opac' ) { |
763 |
if ( $type ne 'opac' ) { |
769 |
warn sprintf( $warning, 'Installer' ); |
764 |
warn sprintf( $warning, 'Installer' ); |
770 |
print $query->redirect("/cgi-bin/koha/installer/install.pl?step=1&op=updatestructure"); |
765 |
print $query->redirect("/cgi-bin/koha/installer/install.pl?step=1&op=updatestructure"); |
Lines 1489-1503
sub check_api_auth {
Link Here
|
1489 |
my $dbh = C4::Context->dbh; |
1484 |
my $dbh = C4::Context->dbh; |
1490 |
my $timeout = _timeout_syspref(); |
1485 |
my $timeout = _timeout_syspref(); |
1491 |
|
1486 |
|
1492 |
unless ( C4::Context->preference('Version') ) { |
1487 |
if ( Koha::Migrations->pending_migrations > 0 ) { |
1493 |
|
|
|
1494 |
# database has not been installed yet |
1495 |
return ( "maintenance", undef, undef ); |
1496 |
} |
1497 |
my $kohaversion = Koha::version(); |
1498 |
$kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; |
1499 |
if ( C4::Context->preference('Version') < $kohaversion ) { |
1500 |
|
1501 |
# database in need of version update; assume that |
1488 |
# database in need of version update; assume that |
1502 |
# no API should be called while databsae is in |
1489 |
# no API should be called while databsae is in |
1503 |
# this condition. |
1490 |
# this condition. |
Lines 1744-1758
sub check_cookie_auth {
Link Here
|
1744 |
my $dbh = C4::Context->dbh; |
1731 |
my $dbh = C4::Context->dbh; |
1745 |
my $timeout = _timeout_syspref(); |
1732 |
my $timeout = _timeout_syspref(); |
1746 |
|
1733 |
|
1747 |
unless ( C4::Context->preference('Version') ) { |
1734 |
if ( Koha::Migrations->pending_migrations > 0 ) { |
1748 |
|
|
|
1749 |
# database has not been installed yet |
1750 |
return ( "maintenance", undef ); |
1751 |
} |
1752 |
my $kohaversion = Koha::version(); |
1753 |
$kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; |
1754 |
if ( C4::Context->preference('Version') < $kohaversion ) { |
1755 |
|
1756 |
# database in need of version update; assume that |
1735 |
# database in need of version update; assume that |
1757 |
# no API should be called while databsae is in |
1736 |
# no API should be called while databsae is in |
1758 |
# this condition. |
1737 |
# this condition. |