koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/C4 Context.pm,1.15,1.16


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/C4 Context.pm,1.15,1.16
Date: Fri, 03 Dec 2004 08:50:42 -0800

Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29405/C4

Modified Files:
        Context.pm 
Log Message:
fixes from A. Tarallo, for mod_perl compliance

Index: Context.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Context.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** Context.pm  13 Aug 2004 09:13:14 -0000      1.15
--- Context.pm  3 Dec 2004 16:50:40 -0000       1.16
***************
*** 20,23 ****
--- 20,25 ----
  # 2004-08-11 A. Tarallo: Added the function db_escheme2dbi, tested my 
bugfixes,
  # further  details about them in the code.
+ # 2004-11-23 A. Tarallo, E. Silva: Bugfixes for running in a mod_perl 
environment.
+ # Clean up of previous bugfixes, better documentation of what was done. 
  
  package C4::Context;
***************
*** 106,116 ****
  #
  # Revision History:
! # 2004-08-10 A. Tarallo: Added code that checks if a variable was already
  # assigned and prints a message, otherwise create a new entry in the hash to
  # be returned. 
  # Also added code that complaints if finds a line that isn't a variable 
  # assignmet and skips the line.
! # Added a quick hack that makes the trasnlation between the db_schema
! # and the DBI driver for that eschema.
  #
  sub read_config_file
--- 108,118 ----
  #
  # Revision History:
! # 2004-08-10 A. Tarallo: Added code that checks if a variable is already
  # assigned and prints a message, otherwise create a new entry in the hash to
  # be returned. 
  # Also added code that complaints if finds a line that isn't a variable 
  # assignmet and skips the line.
! # Added a quick hack that makes the translation between the db_schema
! # and the DBI driver for that schema.
  #
  sub read_config_file
***************
*** 152,157 ****
                                $value = $2;
                        }
!                       $var = $1;
!                         $retval->{$var} = $value;
                }
        }
--- 154,158 ----
                                $value = $2;
                        }
!                         $retval->{$1} = $value;
                }
        }
***************
*** 169,175 ****
  
        for ($name) {
!               if (/MySQL|mysql/) { return("mysql"); }
                if (/Postgres|Pg|PostgresSQL/) { return("Pg"); }
!               if (/Oracle|oracle|ORACLE/) { return("Oracle"); }
        }
        return undef;           # Just in case
--- 170,177 ----
  
        for ($name) {
! # FIXME - Should have other databases. 
!               if (/mysql/i) { return("mysql"); }
                if (/Postgres|Pg|PostgresSQL/) { return("Pg"); }
!               if (/oracle/i) { return("Oracle"); }
        }
        return undef;           # Just in case
***************
*** 213,217 ****
        # check that the specified config file exists and is not empty
        undef $conf_fname unless 
!               (defined $conf_fname && -e $conf_fname && -s $conf_fname);
        # Figure out a good config file to load if none was specified.
        if (!defined($conf_fname))
--- 215,219 ----
        # check that the specified config file exists and is not empty
        undef $conf_fname unless 
!           (defined $conf_fname && -e $conf_fname && -s $conf_fname);
        # Figure out a good config file to load if none was specified.
        if (!defined($conf_fname))
***************
*** 219,224 ****
                # If the $KOHA_CONF environment variable is set, use
                # that. Otherwise, use the built-in default.
!               $conf_fname = $ENV{"KOHA_CONF"} ||
!                               CONFIG_FNAME;
        }
        $self->{"config_file"} = $conf_fname;
--- 221,225 ----
                # If the $KOHA_CONF environment variable is set, use
                # that. Otherwise, use the built-in default.
!               $conf_fname = $ENV{"KOHA_CONF"} || CONFIG_FNAME;
        }
        $self->{"config_file"} = $conf_fname;
***************
*** 400,406 ****
  {
        my $db_driver = $context->{"config"}{"db_scheme"} || "mysql";
-               # FIXME - It should be possible to use "MySQL" instead
-               # of "mysql", "PostgreSQL" instead of "Pg", and so
-               # forth.
        my $db_name   = $context->{"config"}{"database"};
        my $db_host   = $context->{"config"}{"hostname"};
--- 401,404 ----
***************
*** 429,437 ****
  {
        my $self = shift;
  
!       # If there's already a database handle, return it.
!       return $context->{"dbh"} if defined($context->{"dbh"});
  
!       # No database handle yet. Create one.
        $context->{"dbh"} = &_new_dbh();
  
--- 427,440 ----
  {
        my $self = shift;
+       my $sth;
  
!       if (defined($context->{"dbh"})) {
!           $sth=$context->{"dbh"}->prepare("select 1");
!           return $context->{"dbh"} if (defined($sth->execute));
!       }
! 
!       warn "Database died";
  
!       # No database handle or it died . Create one.
        $context->{"dbh"} = &_new_dbh();
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]