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

(-)a/C4/Context.pm (-12 / +4 lines)
Lines 364-370 sub new { Link Here
364
    warn "read_config_file($conf_fname) returned undef" if !defined($self->{"config"});
364
    warn "read_config_file($conf_fname) returned undef" if !defined($self->{"config"});
365
    return if !defined($self->{"config"});
365
    return if !defined($self->{"config"});
366
366
367
    $self->{"dbh"} = undef;        # Database handle
368
    $self->{"Zconn"} = undef;    # Zebra Connections
367
    $self->{"Zconn"} = undef;    # Zebra Connections
369
    $self->{"stopwords"} = undef; # stopwords list
368
    $self->{"stopwords"} = undef; # stopwords list
370
    $self->{"marcfromkohafield"} = undef; # the hash with relations between koha table fields and MARC field/subfield
369
    $self->{"marcfromkohafield"} = undef; # the hash with relations between koha table fields and MARC field/subfield
Lines 725-731 sub _new_Zconn { Link Here
725
sub _new_dbh
724
sub _new_dbh
726
{
725
{
727
726
728
    Koha::Database->schema->storage->dbh;
727
    Koha::Database->schema({ new => 1 })->storage->dbh;
729
}
728
}
730
729
731
=head2 dbh
730
=head2 dbh
Lines 751-767 sub dbh Link Here
751
    my $sth;
750
    my $sth;
752
751
753
    unless ( $params->{new} ) {
752
    unless ( $params->{new} ) {
754
        if ( defined($context->{db_driver}) && $context->{db_driver} eq 'mysql' && $context->{"dbh"} ) {
753
        return Koha::Database->schema->storage->dbh;
755
            return $context->{"dbh"};
756
        } elsif ( defined($context->{"dbh"}) && $context->{"dbh"}->ping() ) {
757
            return $context->{"dbh"};
758
        }
759
    }
754
    }
760
755
761
    # No database handle or it died . Create one.
756
    return Koha::Database->schema({ new => 1 })->storage->dbh;
762
    $context->{"dbh"} = &_new_dbh();
763
764
    return $context->{"dbh"};
765
}
757
}
766
758
767
=head2 new_dbh
759
=head2 new_dbh
Lines 782-788 sub new_dbh Link Here
782
{
774
{
783
    my $self = shift;
775
    my $self = shift;
784
776
785
    return &_new_dbh();
777
    return &dbh({ new => 1 });
786
}
778
}
787
779
788
=head2 set_dbh
780
=head2 set_dbh
(-)a/Koha/Database.pm (-5 / +3 lines)
Lines 115-127 possibly C<&set_schema>. Link Here
115
115
116
sub schema {
116
sub schema {
117
    my $self = shift;
117
    my $self = shift;
118
    my $sth;
118
    my $params = shift;
119
119
120
    if ( defined( $database->{schema} ) and $database->{schema}->storage->connected() ) {
120
    unless ( $params->{new} ) {
121
        return $database->{schema};
121
        return $database->{schema} if defined $database->{schema};
122
    }
122
    }
123
123
124
    # No database handle or it died . Create one.
125
    $database->{schema} = &_new_schema();
124
    $database->{schema} = &_new_schema();
126
    return $database->{schema};
125
    return $database->{schema};
127
}
126
}
128
- 

Return to bug 14778