diff --git a/scripts/zmupdate.pl.z b/scripts/zmupdate.pl.z index 01158b741..ced6021b4 100755 --- a/scripts/zmupdate.pl.z +++ b/scripts/zmupdate.pl.z @@ -43,22 +43,28 @@ BEGIN { no strict 'refs'; - open( CONFIG, "<".ZM_CONFIG ) or die( "Can't open config file: $!" ); - foreach my $str ( ) + if ( open( CONFIG, "<".ZM_CONFIG ) ) { - next if ( $str =~ /^\s*$/ ); - next if ( $str =~ /^\s*#/ ); - my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/; - $name =~ tr/a-z/A-Z/; - if (( $name eq 'ZM_DB_SERVER' ) || - ( $name eq 'ZM_DB_NAME' ) || - ( $name eq 'ZM_DB_USER' ) || - ( $name eq 'ZM_DB_PASS' )) + foreach my $str ( ) { - *{$name} = sub { $value }; + next if ( $str =~ /^\s*$/ ); + next if ( $str =~ /^\s*#/ ); + my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/; + $name =~ tr/a-z/A-Z/; + if (( $name eq 'ZM_DB_SERVER' ) || + ( $name eq 'ZM_DB_NAME' ) || + ( $name eq 'ZM_DB_USER' ) || + ( $name eq 'ZM_DB_PASS' )) + { + *{$name} = sub { $value }; + } } + close( CONFIG ); + } + else + { + warn( "Can't open config file: $!" ); } - close( CONFIG ); use DBI; my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS ); @@ -71,6 +77,11 @@ BEGIN } $sth->finish(); $dbh->disconnect(); + if ( !ZM_DB_USER ) + { + *ZM_DB_USER = sub { ZM_DB_USERA }; + *ZM_DB_PASS = sub { ZM_DB_PASSA }; + } } use constant UPDATE_LOG_FILE => ZM_PATH_LOGS.'/zmupdate.log';