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

* Email upgrade errors to staff upgrading the system.

* Append page url to error alerts - useful in determining which page triggered the error.
parent edbf4672
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ class osTicket { ...@@ -38,7 +38,7 @@ class osTicket {
//DB based session storage was added starting with v1.7 //DB based session storage was added starting with v1.7
// which does NOT have DB Version // which does NOT have DB Version
if($this->config && !$this->getConfig()->getDBversion()) if($this->config && !$this->getConfig()->getDBVersion())
$this->session = osTicketSession::start(SESSION_TTL); // start DB based session $this->session = osTicketSession::start(SESSION_TTL); // start DB based session
else else
session_start(); session_start();
...@@ -137,6 +137,10 @@ class osTicket { ...@@ -137,6 +137,10 @@ class osTicket {
if(!($to=$this->getConfig()->getAdminEmail())) if(!($to=$this->getConfig()->getAdminEmail()))
$to=ADMIN_EMAIL; $to=ADMIN_EMAIL;
//append URL to the message
$message.="\n\n".THISPAGE;
//Try getting the alert email. //Try getting the alert email.
$email=null; $email=null;
if(!($email=$this->getConfig()->getAlertEmail())) if(!($email=$this->getConfig()->getAlertEmail()))
......
...@@ -58,6 +58,7 @@ Class SetupWizard { ...@@ -58,6 +58,7 @@ Class SetupWizard {
@mysql_query('SET SESSION SQL_MODE =""'); @mysql_query('SET SESSION SQL_MODE =""');
foreach($statements as $k=>$sql) { foreach($statements as $k=>$sql) {
//Note that we're not using db_query - because we want to control how errors are reported.
if(mysql_query($sql)) continue; if(mysql_query($sql)) continue;
$error = "[$sql] ".mysql_error(); $error = "[$sql] ".mysql_error();
if($abort) if($abort)
......
...@@ -49,16 +49,29 @@ class Upgrader extends SetupWizard { ...@@ -49,16 +49,29 @@ class Upgrader extends SetupWizard {
$this->migrater = new DatabaseMigrater($this->signature, SCHEMA_SIGNATURE, $this->sqldir); $this->migrater = new DatabaseMigrater($this->signature, SCHEMA_SIGNATURE, $this->sqldir);
} }
function getStops() {
return array('7be60a84' => 'migrateAttachments2DB');
}
function onError($error) { function onError($error) {
global $ost; global $ost, $thisstaff;
$ost->logError('Upgrader Error', $error); $ost->logError('Upgrader Error', $error);
$this->setError($error); $this->setError($error);
$this->setState('aborted'); $this->setState('aborted');
//Alert staff upgrading the system - if the email is not same as admin's
// admin gets alerted on error log (above)
if(!$thisstaff || !strcasecmp($thisstaff->getEmail(), $ost->getConfig()->getAdminEmail()))
return;
$email=null;
if(!($email=$ost->getConfig()->getAlertEmail()))
$email=$ost->getConfig()->getDefaultEmail(); //will take the default email.
$subject = 'Upgrader Error';
if($email) {
$email->send($thistaff->getEmail(), $subject, $error);
} else {//no luck - try the system mail.
Email::sendmail($thistaff->getEmail(), $subject, $error, sprintf('"osTicket Alerts"<%s>', $thistaff->getEmail()));
}
} }
function isUpgradable() { function isUpgradable() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment