Gestion du mode cli lors de requete SOAP

This commit is contained in:
Michael RICOIS 2015-06-17 15:55:24 +00:00
parent d171491909
commit d86685b235

View File

@ -3386,37 +3386,41 @@ class WsScores
*/
protected function soaperror($method, $fault, $requete, $reponse)
{
$message = '';
$message.= 'Erreur SOAP - Code : '.$fault->faultcode.' - Message : '.$fault->faultstring;
$message.= ' - Utilisateur : '.$this->login;
$message.= "\n\n";
if ( php_sapi_name() == 'cli' ) {
$message.= "Method : ".$method.", File :".$fault->getFile().", Ligne : ".$fault->getLine();
$message.= "\n\n";
$message.= "Detail :\n".$fault->getTraceAsString();
$message.= "\n\n";
if ( $controller = Zend_Controller_Front::getInstance() ) {
$message.= "Request Parameters :\n ".print_r($controller->getRequest()->getParams(), true);
$message.= "\n\n";
}
$message.= "Referer : ".$_SERVER['HTTP_REFERER']."\n\n";
$message.= "Requete :\n ".$requete."\n";
$message.= "Reponse :\n ".$reponse."\n";
if (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'staging') {
$c = Zend_Registry::get('config');
$mail = new Scores_Mail_Method();
$mail->setSubject('[ERREUR SOAP] - '.$c->profil->server->name.' -'.date('Ymd'));
$mail->setBodyTextC($message);
$mail->setFromKey('supportdev');
$mail->addToKey('supportdev');
$mail->execute();
} else {
Zend_Registry::get('firebug')->info('Erreur SOAP - Code : '.$fault->faultcode.' - Message : '.$fault->faultstring);
$message = '';
$message.= 'Erreur SOAP - Code : '.$fault->faultcode.' - Message : '.$fault->faultstring;
$message.= ' - Utilisateur : '.$this->login;
$message.= "\n\n";
$message.= "Method : ".$method.", File :".$fault->getFile().", Ligne : ".$fault->getLine();
$message.= "\n\n";
$message.= "Detail :\n".$fault->getTraceAsString();
$message.= "\n\n";
if ( $controller = Zend_Controller_Front::getInstance() ) {
$message.= "Request Parameters :\n ".print_r($controller->getRequest()->getParams(), true);
$message.= "\n\n";
}
$message.= "Referer : ".$_SERVER['HTTP_REFERER']."\n\n";
$message.= "Requete :\n ".$requete."\n";
$message.= "Reponse :\n ".$reponse."\n";
if (APPLICATION_ENV == 'development' ) {
Zend_Registry::get('firebug')->info('Erreur SOAP - Code : '.$fault->faultcode.' - Message : '.$fault->faultstring);
} else {
$c = Zend_Registry::get('config');
$mail = new Scores_Mail_Method();
$mail->setSubject('[ERREUR SOAP] - '.$c->profil->server->name.' -'.date('Ymd'));
$mail->setBodyTextC($message);
$mail->setFromKey('supportdev');
$mail->addToKey('supportdev');
$mail->execute();
}
}
}
}