View | Details | Raw Unified | Return to bug 16156
Collapse All | Expand All

(-)a/C4/Context.pm (-3 / +13 lines)
Lines 775-781 sub _new_Zconn { Link Here
775
sub _new_dbh
775
sub _new_dbh
776
{
776
{
777
777
778
    Koha::Database->schema({ new => 1 })->storage->dbh;
778
    $context->{dbh} = Koha::Database->schema({ new => 1 })->storage->dbh;
779
    return $context->{dbh};
779
}
780
}
780
781
781
=head2 dbh
782
=head2 dbh
Lines 801-810 sub dbh Link Here
801
    my $sth;
802
    my $sth;
802
803
803
    unless ( $params->{new} ) {
804
    unless ( $params->{new} ) {
804
        return Koha::Database->schema->storage->dbh;
805
        return $context->{dbh} if $context->{dbh};
806
        $context->{dbh} = Koha::Database->schema->storage->dbh;
807
        return $context->{dbh};
805
    }
808
    }
806
809
807
    return Koha::Database->schema({ new => 1 })->storage->dbh;
810
    $context->{dbh} = Koha::Database->schema({ new => 1 })->storage->dbh;
811
    return $context->{dbh};
808
}
812
}
809
813
810
=head2 new_dbh
814
=head2 new_dbh
Lines 1182-1187 sub interface { Link Here
1182
    return $context->{interface} // 'opac';
1186
    return $context->{interface} // 'opac';
1183
}
1187
}
1184
1188
1189
sub flush {
1190
    my ( $class ) = @_;
1191
    delete $context->{dbh}
1192
        if $context and $context->{dbh};
1193
}
1194
1185
1;
1195
1;
1186
__END__
1196
__END__
1187
1197
(-)a/debian/templates/plack.psgi (+2 lines)
Lines 26-31 use Plack::App::Directory; Link Here
26
use Plack::App::URLMap;
26
use Plack::App::URLMap;
27
27
28
# Pre-load libraries
28
# Pre-load libraries
29
use C4::Context;
29
use C4::Boolean;
30
use C4::Boolean;
30
use C4::Branch;
31
use C4::Branch;
31
use C4::Category;
32
use C4::Category;
Lines 45-50 use CGI qw(-utf8 ); # we will loose -utf8 under plack, otherwise Link Here
45
        my $q = $old_new->( @_ );
46
        my $q = $old_new->( @_ );
46
        $CGI::PARAM_UTF8 = 1;
47
        $CGI::PARAM_UTF8 = 1;
47
        Koha::Cache->flush_L1_cache();
48
        Koha::Cache->flush_L1_cache();
49
        C4::Context->flush();
48
        return $q;
50
        return $q;
49
    };
51
    };
50
}
52
}
(-)a/misc/plack/koha.psgi (-1 / +1 lines)
Lines 13-18 use CGI qw(-utf8 ); # we will lose -utf8 under plack Link Here
13
        my $q = $old_new->( @_ );
13
        my $q = $old_new->( @_ );
14
        $CGI::PARAM_UTF8 = 1;
14
        $CGI::PARAM_UTF8 = 1;
15
        Koha::Cache->flush_L1_cache();
15
        Koha::Cache->flush_L1_cache();
16
        C4::Context->flush();
16
        return $q;
17
        return $q;
17
    };
18
    };
18
}
19
}
19
- 

Return to bug 16156