mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 06:27:02 +03:00
Added "write_on_php_error_only" setting
This commit is contained in:
parent
9bf5847983
commit
9bde3fe5dd
7 changed files with 125 additions and 61 deletions
|
|
@ -4,11 +4,6 @@ namespace RainLoop;
|
|||
|
||||
class Service
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
static $__HIDE_ERROR_NOTICES = false;
|
||||
|
||||
/**
|
||||
* @var \MailSo\Base\Http
|
||||
*/
|
||||
|
|
@ -32,8 +27,6 @@ class Service
|
|||
$this->oHttp = \MailSo\Base\Http::SingletonInstance();
|
||||
$this->oActions = \RainLoop\Api::Actions();
|
||||
|
||||
\set_error_handler(array(&$this, 'LogPhpErrorHandler'));
|
||||
|
||||
$this->oServiceActions = new \RainLoop\ServiceActions($this->oHttp, $this->oActions);
|
||||
|
||||
if ($this->oActions->Config()->Get('debug', 'enable', false))
|
||||
|
|
@ -65,33 +58,6 @@ class Service
|
|||
return new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iErrNo
|
||||
* @param string $sErrStr
|
||||
* @param string $sErrFile
|
||||
* @param int $iErrLine
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function LogPhpErrorHandler($iErrNo, $sErrStr, $sErrFile, $iErrLine)
|
||||
{
|
||||
$iType = \MailSo\Log\Enumerations\Type::NOTICE;
|
||||
switch ($iErrNo)
|
||||
{
|
||||
case E_USER_ERROR:
|
||||
$iType = \MailSo\Log\Enumerations\Type::ERROR;
|
||||
break;
|
||||
case E_USER_WARNING:
|
||||
$iType = \MailSo\Log\Enumerations\Type::WARNING;
|
||||
break;
|
||||
}
|
||||
|
||||
$this->oActions->Logger()->Write($sErrFile.' [line:'.$iErrLine.', code:'.$iErrNo.']', $iType, 'PHP');
|
||||
$this->oActions->Logger()->Write('Error: '.$sErrStr, $iType, 'PHP');
|
||||
|
||||
return !!(\MailSo\Log\Enumerations\Type::NOTICE === $iType && \RainLoop\Service::$__HIDE_ERROR_NOTICES);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \RainLoop\Service
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue