diff --git a/include/class.osticket.php b/include/class.osticket.php index fbbbb7dbf94263cb98e7eef0deba13b0e8200af6..66938cc7c4cfba0db80439e1de5e9c010923116e 100644 --- a/include/class.osticket.php +++ b/include/class.osticket.php @@ -38,7 +38,7 @@ class osTicket { //DB based session storage was added starting with v1.7 // 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 else session_start(); @@ -137,6 +137,10 @@ class osTicket { if(!($to=$this->getConfig()->getAdminEmail())) $to=ADMIN_EMAIL; + + //append URL to the message + $message.="\n\n".THISPAGE; + //Try getting the alert email. $email=null; if(!($email=$this->getConfig()->getAlertEmail())) diff --git a/include/class.setup.php b/include/class.setup.php index a49f87f138f65c2e3f80213e5d6b0f6f27cae6d1..e566f2bf019ae55e913c0b1d460cb9389be1c0ac 100644 --- a/include/class.setup.php +++ b/include/class.setup.php @@ -58,6 +58,7 @@ Class SetupWizard { @mysql_query('SET SESSION SQL_MODE =""'); 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; $error = "[$sql] ".mysql_error(); if($abort) diff --git a/include/class.upgrader.php b/include/class.upgrader.php index 73c6476020ef5d5f7f1d257289d818d30ce8c26b..4487e53b26844c8094b72406c5f739cb67702bf3 100644 --- a/include/class.upgrader.php +++ b/include/class.upgrader.php @@ -49,16 +49,29 @@ class Upgrader extends SetupWizard { $this->migrater = new DatabaseMigrater($this->signature, SCHEMA_SIGNATURE, $this->sqldir); } - function getStops() { - return array('7be60a84' => 'migrateAttachments2DB'); - } - function onError($error) { - global $ost; + global $ost, $thisstaff; $ost->logError('Upgrader Error', $error); $this->setError($error); $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() {