}
my $conf_cache = Koha::Caches->get_instance('config');
- my $config_from_cache;
if ( $conf_cache->cache ) {
$self = $conf_cache->get_from_cache('koha_conf');
}
{
my $self = shift;
my $params = shift;
- my $sth;
unless ( $params->{new} ) {
return Koha::Database->schema->storage->dbh;
C4::Context->set_userenv($usernum, $userid, $usercnum,
$userfirstname, $usersurname,
$userbranch, $branchname, $userflags,
- $emailaddress, $shibboleth);
+ $emailaddress, $shibboleth
+ $desk_id, $desk_name);
Establish a hash of user environment variables.
#'
sub set_userenv {
shift @_;
- my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth)=
+ my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth, $desk_id, $desk_name)=
map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
@_;
my $var=$context->{"activeuser"} || '';
#possibly a law problem
"branch" => $userbranch,
"branchname" => $branchname,
+ "desk_id" => $desk_id,
+ "desk_name" => $desk_name,
"flags" => $userflags,
"emailaddress" => $emailaddress,
"shibboleth" => $shibboleth,
}
}
+=head3 https_enabled
+
+https_enabled should be called when checking if a HTTPS connection
+is used.
+
+Note that this depends on a HTTPS environmental variable being defined
+by the web server. This function may not return the expected result,
+if your web server or reverse proxies are not setting the correct
+X-Forwarded-Proto headers and HTTPS environmental variable.
+
+Note too that the HTTPS value can vary from web server to web server.
+We are relying on the convention of the value being "on" or "ON" here.
+
+=cut
+
+sub https_enabled {
+ my $https_enabled = 0;
+ my $env_https = $ENV{HTTPS};
+ if ($env_https){
+ if ($env_https =~ /^ON$/i){
+ $https_enabled = 1;
+ }
+ }
+ return $https_enabled;
+}
+
1;
+=head3 needs_install
+
+ if ( $context->needs_install ) { ... }
+
+This method returns a boolean representing the install status of the Koha instance.
+
+=cut
+
+sub needs_install {
+ my ($self) = @_;
+ return ($self->preference('Version')) ? 0 : 1;
+}
+
__END__
=head1 ENVIRONMENT