Skip to content
Snippets Groups Projects
Commit aee963ae authored by Peter Rotich's avatar Peter Rotich
Browse files

Detect old versions before 1.7 which do not support DB based session handler. Add logDBError

parent 8005eb2e
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,14 @@ class osTicket { ...@@ -35,7 +35,14 @@ class osTicket {
function osTicket($cfgId) { function osTicket($cfgId) {
$this->config = Config::lookup($cfgId); $this->config = Config::lookup($cfgId);
$this->session = osTicketSession::start(SESSION_TTL); // start_session
//DB based session storage was added starting with v1.7
// which does NOT have DB Version
if($this->config && !$this->getConfig()->getDBversion())
$this->session = osTicketSession::start(SESSION_TTL); // start DB based session
else
session_start();
} }
function isSystemOnline() { function isSystemOnline() {
...@@ -163,6 +170,14 @@ class osTicket { ...@@ -163,6 +170,14 @@ class osTicket {
return $this->log(LOG_ERR, $title, $error, $alert); return $this->log(LOG_ERR, $title, $error, $alert);
} }
function logDBError($title, $error, $alert=true) {
if($alert && !$this->getConfig()->alertONSQLError())
$alert =false;
return $this->log(LOG_ERR, $title, $error, $alert);
}
function log($priority, $title, $message, $alert=false) { function log($priority, $title, $message, $alert=false) {
//We are providing only 3 levels of logs. Windows style. //We are providing only 3 levels of logs. Windows style.
...@@ -188,8 +203,8 @@ class osTicket { ...@@ -188,8 +203,8 @@ class osTicket {
if($alert) if($alert)
$this->alertAdmin($title, $message); $this->alertAdmin($title, $message);
//Logging everything during upgrade.
if($this->getConfig()->getLogLevel()<$level) if($this->getConfig()->getLogLevel()<$level && !$this->isUpgradePending())
return false; return false;
//Save log based on system log level settings. //Save log based on system log level settings.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment