Merge branch 'master' of github.com:ZoneMinder/ZoneMinder

This commit is contained in:
Isaac Connor 2018-12-13 16:20:20 -05:00
commit dd033cb069
1 changed files with 10 additions and 14 deletions

View File

@ -321,11 +321,10 @@ sub reinitialise {
$this->databaseLevel(NOLOG);
$this->databaseLevel($databaseLevel) if $databaseLevel > NOLOG;
my $screenLevel = $this->termLevel();
$this->{hasTerm} = -t STDERR;
my $termLevel = $this->termLevel();
$this->termLevel(NOLOG);
$this->termLevel($screenLevel) if $screenLevel > NOLOG;
$this->{sth} = undef;
$this->termLevel($termLevel) if $termLevel > NOLOG;
}
# Prevents undefined logging levels
@ -439,17 +438,14 @@ sub databaseLevel {
my $databaseLevel = shift;
if ( defined($databaseLevel) ) {
$databaseLevel = $this->limit($databaseLevel);
if ( $this->{databaseLevel} != $databaseLevel ) {
if ( ( $databaseLevel > NOLOG ) and ( $this->{databaseLevel} <= NOLOG ) ) {
if ( ! ( $ZoneMinder::Database::dbh or ZoneMinder::Database::zmDbConnect() ) ) {
Warning("Failed connecting to db. Not using database logging.");
$this->{databaseLevel} = NOLOG;
return NOLOG;
}
if ( $databaseLevel > NOLOG ) {
$this->{dbh} = ZoneMinder::Database::zmDbConnect();
} else {
undef($this->{dbh});
}
$this->{sth} = undef;
$this->{databaseLevel} = $databaseLevel;
}
}
return $this->{databaseLevel};
}