mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-11 23:54:15 +08:00
MailSo optimizations: Logging, Fetch Callback
Contacts: remove transaction support
This commit is contained in:
parent
2f074433a2
commit
d07e3b0247
11 changed files with 245 additions and 317 deletions
|
@ -1681,6 +1681,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
{
|
||||
$oImapResponse = null;
|
||||
$sEndTag = (null === $sEndTag) ? $this->getCurrentTag() : $sEndTag;
|
||||
|
||||
while (true)
|
||||
{
|
||||
$oImapResponse = Response::NewInstance();
|
||||
|
@ -2258,8 +2259,16 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
$this->writeLog('Callback for '.$sParent.' / '.$sLiteralAtomUpperCase.
|
||||
' - try to read '.$iLiteralLen.' bytes.', \MailSo\Log\Enumerations\Type::NOTE);
|
||||
|
||||
try
|
||||
{
|
||||
\call_user_func($this->aFetchCallbacks[$sFetchKey],
|
||||
$sParent, $sLiteralAtomUpperCase, $rImapLiteralStream);
|
||||
}
|
||||
catch (\Exception $oException)
|
||||
{
|
||||
$this->writeLog('Callback Exception', \MailSo\Log\Enumerations\Type::NOTICE);
|
||||
$this->writeLogException($oException);
|
||||
}
|
||||
|
||||
$iNotReadLiteralLen = 0;
|
||||
while (!\feof($rImapLiteralStream))
|
||||
|
|
|
@ -204,7 +204,17 @@ abstract class Driver
|
|||
\MailSo\Log\Enumerations\Type::ERROR
|
||||
)))
|
||||
{
|
||||
$this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), '--- FlushCache: WriteOnErrorOnly', \MailSo\Log\Enumerations\Type::INFO, 'LOGS');
|
||||
$sFlush = '--- FlushLogCache: WriteOnErrorOnly';
|
||||
if (isset($this->aCache[0]) && empty($this->aCache[0]))
|
||||
{
|
||||
$this->aCache[0] = $sFlush;
|
||||
array_unshift($this->aCache, '');
|
||||
}
|
||||
else
|
||||
{
|
||||
array_unshift($this->aCache, $sFlush);
|
||||
}
|
||||
|
||||
$this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), $sDesc, $iType, $sName);
|
||||
|
||||
$this->bFlushCache = true;
|
||||
|
@ -213,8 +223,16 @@ abstract class Driver
|
|||
}
|
||||
else if (0 < $this->iWriteOnTimeoutOnly && \time() - APP_START_TIME > $this->iWriteOnTimeoutOnly)
|
||||
{
|
||||
$this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), '--- FlushCache: WriteOnTimeoutOnly['.
|
||||
(\time() - APP_START_TIME).'/'.$this->iWriteOnTimeoutOnly.']', \MailSo\Log\Enumerations\Type::NOTE, 'LOGS');
|
||||
$sFlush = '--- FlushLogCache: WriteOnTimeoutOnly ['.(\time() - APP_START_TIME).'sec]';
|
||||
if (isset($this->aCache[0]) && empty($this->aCache[0]))
|
||||
{
|
||||
$this->aCache[0] = $sFlush;
|
||||
array_unshift($this->aCache, '');
|
||||
}
|
||||
else
|
||||
{
|
||||
array_unshift($this->aCache, $sFlush);
|
||||
}
|
||||
|
||||
$this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), $sDesc, $iType, $sName);
|
||||
|
||||
|
|
|
@ -48,14 +48,6 @@ abstract class PdoAbstract
|
|||
return array('', '', '', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function isTransactionSupported()
|
||||
{
|
||||
return \in_array($this->sDbType, array('mysql'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PDO
|
||||
*
|
||||
|
@ -364,11 +356,6 @@ abstract class PdoAbstract
|
|||
$oPdo = $this->getPDO();
|
||||
if ($oPdo)
|
||||
{
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$oPdo->beginTransaction();
|
||||
}
|
||||
|
||||
$sQuery = 'DELETE FROM rainloop_system WHERE sys_name = ? AND value_int <= ?;';
|
||||
$this->writeLog($sQuery);
|
||||
|
||||
|
@ -385,18 +372,6 @@ abstract class PdoAbstract
|
|||
$bResult = !!$oStmt->execute(array($sName.'_version', $iVersion));
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
if ($bResult)
|
||||
{
|
||||
$oPdo->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$oPdo->rollBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $bResult;
|
||||
|
@ -466,11 +441,6 @@ rl_email text NOT NULL DEFAULT \'\'
|
|||
{
|
||||
try
|
||||
{
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$oPdo->beginTransaction();
|
||||
}
|
||||
|
||||
foreach ($aQ as $sQuery)
|
||||
{
|
||||
if ($bResult)
|
||||
|
@ -487,27 +457,10 @@ rl_email text NOT NULL DEFAULT \'\'
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
if ($bResult)
|
||||
{
|
||||
$oPdo->rollBack();
|
||||
}
|
||||
else
|
||||
{
|
||||
$oPdo->commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (\Exception $oException)
|
||||
{
|
||||
$this->writeLog($oException);
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$oPdo->rollBack();
|
||||
}
|
||||
|
||||
throw $oException;
|
||||
}
|
||||
}
|
||||
|
@ -568,11 +521,6 @@ rl_email text NOT NULL DEFAULT \'\'
|
|||
{
|
||||
try
|
||||
{
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$oPdo->beginTransaction();
|
||||
}
|
||||
|
||||
foreach ($aQuery as $sQuery)
|
||||
{
|
||||
$this->writeLog($sQuery);
|
||||
|
@ -585,27 +533,10 @@ rl_email text NOT NULL DEFAULT \'\'
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
if ($bResult)
|
||||
{
|
||||
$oPdo->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$oPdo->rollBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (\Exception $oException)
|
||||
{
|
||||
$this->writeLog($oException);
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$oPdo->rollBack();
|
||||
}
|
||||
|
||||
throw $oException;
|
||||
}
|
||||
|
||||
|
|
|
@ -442,11 +442,6 @@ class PdoAddressBook
|
|||
|
||||
try
|
||||
{
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$this->beginTransaction();
|
||||
}
|
||||
|
||||
$aFreq = array();
|
||||
if ($bUpdate)
|
||||
{
|
||||
|
@ -582,19 +577,9 @@ class PdoAddressBook
|
|||
}
|
||||
catch (\Exception $oException)
|
||||
{
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$this->rollBack();
|
||||
}
|
||||
|
||||
throw $oException;
|
||||
}
|
||||
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$this->commit();
|
||||
}
|
||||
|
||||
return 0 < $iIdContact;
|
||||
}
|
||||
|
||||
|
@ -619,11 +604,6 @@ class PdoAddressBook
|
|||
$mResult = false;
|
||||
try
|
||||
{
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$this->beginTransaction();
|
||||
}
|
||||
|
||||
$sSql = 'INSERT INTO rainloop_ab_tags '.
|
||||
'(id_user, tag_name) VALUES (:id_user, :tag_name)';
|
||||
|
||||
|
@ -642,19 +622,9 @@ class PdoAddressBook
|
|||
}
|
||||
catch (\Exception $oException)
|
||||
{
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$this->rollBack();
|
||||
}
|
||||
|
||||
throw $oException;
|
||||
}
|
||||
|
||||
if ($this->isTransactionSupported())
|
||||
{
|
||||
$this->commit();
|
||||
}
|
||||
|
||||
return $mResult;
|
||||
}
|
||||
|
||||
|
|
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
10
rainloop/v/0.0.0/static/js/app.min.js
vendored
10
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue