_configs = Zend_Registry::get('config'); $this->_variabiliService = new App_Service_VariabiliSito(); } /** * Notifica l'errore critico solo se il parametro memorizzato nelle variabili del sito รจ settato a zero * Serve a notificarlo una volta sola fin quando non riattivo la notifica * * @param $nomeVariabileErrore * @param $message * @param $exception * @param null $params * @param bool $inviaEmail * @throws Zend_Exception */ public function notificaErroreCritico($nomeVariabileErrore, $message, $exception, $params = null, $inviaEmail = true){ $variabileCheckNotififyError = $this->_variabiliService->get($nomeVariabileErrore); if(!$variabileCheckNotififyError){ // Zend_Registry::get('log')->info(print_r($exception, true)); if($inviaEmail){ $this->inviaEmailDiErrore($message, $exception, $params); } $this->_variabiliService->set('I_CheckNotify_LoadMtTasks_Error', 1); } } public function inviaEmailDiErrore($shortdesc, Exception $e = null, $params = null, $email = null) { $mail = new Zend_Mail('UTF-8'); if(!$email) $email = $this->_configs->get('test_email'); $subject = '--- SERVER AS Fatturab2b.net --- NOTIFICA ERRORE ---'; $message = '
ERROR MESSAGE: ' . $shortdesc; if ($e != null) { $message .= '

STACK TRACE ERRORE:
'; foreach ($e->getTrace() as $key => $value) { $message .= "
[ " . $key . "] = " . $value; if (is_array($value)) { $message .= '
['; foreach ($value as $key2 => $value2) { $message .= "[ " . $key2 . "] = " . $value2 . "
"; } $message .= ']
'; } } $message .= '
EXCEPTION STAMP:
'; $message .= "
";
            $message .= print_r($e,true);
            $message .= "
"; } if($params){ $message .= '

PARAMETRI:
'; $message .= "
";
            $message .= print_r($params,true);
            $message .= "
"; $message .= '
'; } $message .= '

Errore inviato dal server il ' . date('d/m/Y H:i:s'); $mail->setFrom($this->_configs->get('email_mittente'), $this->_configs->get('email_mittente_nome')) ->setSubject($subject) ->addTo($email, '') ->setBodyHtml($message) ->send(); } }