本文整理匯總了PHP中MailSo\Base\Utils::ResetTimeLimit方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::ResetTimeLimit方法的具體用法?PHP Utils::ResetTimeLimit怎麽用?PHP Utils::ResetTimeLimit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MailSo\Base\Utils
的用法示例。
在下文中一共展示了Utils::ResetTimeLimit方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: MultipleStreamWriter
/**
* @param resource $rRead
* @param array $aWrite
* @param int $iBufferLen = 8192
* @param bool $bResetTimeLimit = true
* @param bool $bFixCrLf = false
* @param bool $bRewindOnComplete = false
*
* @return int|bool
*/
public static function MultipleStreamWriter($rRead, $aWrite, $iBufferLen = 8192, $bResetTimeLimit = true, $bFixCrLf = false, $bRewindOnComplete = false)
{
$mResult = false;
if ($rRead && \is_array($aWrite) && 0 < \count($aWrite)) {
$mResult = 0;
while (!\feof($rRead)) {
$sBuffer = \fread($rRead, $iBufferLen);
if (false === $sBuffer) {
$mResult = false;
break;
}
if (0 === $iBufferLen || '' === $sBuffer) {
break;
}
if ($bFixCrLf) {
$sBuffer = \str_replace("\n", "\r\n", \str_replace("\r", '', $sBuffer));
}
$mResult += \strlen($sBuffer);
foreach ($aWrite as $rWriteStream) {
$mWriteResult = \fwrite($rWriteStream, $sBuffer);
if (false === $mWriteResult) {
$mResult = false;
break 2;
}
}
if ($bResetTimeLimit) {
\MailSo\Base\Utils::ResetTimeLimit();
}
}
}
if ($mResult && $bRewindOnComplete) {
foreach ($aWrite as $rWriteStream) {
if (\is_resource($rWriteStream)) {
@\rewind($rWriteStream);
}
}
}
return $mResult;
}
示例2: partialResponseLiteralCallbackCallable
/**
* @param string $sParent
* @param string $sLiteralAtomUpperCase
* @param resource $rImapStream
* @param int $iLiteralLen
*
* @return bool
*/
private function partialResponseLiteralCallbackCallable($sParent, $sLiteralAtomUpperCase, $rImapStream, $iLiteralLen)
{
$sLiteralAtomUpperCasePeek = '';
if (0 === \strpos($sLiteralAtomUpperCase, 'BODY')) {
$sLiteralAtomUpperCasePeek = \str_replace('BODY', 'BODY.PEEK', $sLiteralAtomUpperCase);
}
$sFetchKey = '';
if (\is_array($this->aFetchCallbacks)) {
if (0 < \strlen($sLiteralAtomUpperCasePeek) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCasePeek])) {
$sFetchKey = $sLiteralAtomUpperCasePeek;
} else {
if (0 < \strlen($sLiteralAtomUpperCase) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCase])) {
$sFetchKey = $sLiteralAtomUpperCase;
}
}
}
$bResult = false;
if (0 < \strlen($sFetchKey) && '' !== $this->aFetchCallbacks[$sFetchKey] && \is_callable($this->aFetchCallbacks[$sFetchKey])) {
$rImapLiteralStream = \MailSo\Base\StreamWrappers\Literal::CreateStream($rImapStream, $iLiteralLen);
$bResult = true;
$this->writeLog('Start Callback for ' . $sParent . ' / ' . $sLiteralAtomUpperCase . ' - try to read ' . $iLiteralLen . ' bytes.', \MailSo\Log\Enumerations\Type::NOTE);
$this->bRunningCallback = true;
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);
}
if (\is_resource($rImapLiteralStream)) {
$iNotReadLiteralLen = 0;
$bFeof = \feof($rImapLiteralStream);
$this->writeLog('End Callback for ' . $sParent . ' / ' . $sLiteralAtomUpperCase . ' - feof = ' . ($bFeof ? 'good' : 'BAD'), $bFeof ? \MailSo\Log\Enumerations\Type::NOTE : \MailSo\Log\Enumerations\Type::WARNING);
if (!$bFeof) {
while (!@\feof($rImapLiteralStream)) {
$sBuf = @\fread($rImapLiteralStream, 1024 * 1024);
if (false === $sBuf || 0 === \strlen($sBuf) || null === $sBuf) {
break;
}
\MailSo\Base\Utils::ResetTimeLimit();
$iNotReadLiteralLen += \strlen($sBuf);
}
if (\is_resource($rImapLiteralStream) && !@\feof($rImapLiteralStream)) {
@\stream_get_contents($rImapLiteralStream);
}
}
if (\is_resource($rImapLiteralStream)) {
@\fclose($rImapLiteralStream);
}
if ($iNotReadLiteralLen > 0) {
$this->writeLog('Not read literal size is ' . $iNotReadLiteralLen . ' bytes.', \MailSo\Log\Enumerations\Type::WARNING);
}
} else {
$this->writeLog('Literal stream is not resource after callback.', \MailSo\Log\Enumerations\Type::WARNING);
}
\MailSo\Base\Loader::IncStatistic('NetRead', $iLiteralLen);
$this->bRunningCallback = false;
}
return $bResult;
}
示例3: DataWithStream
/**
* @param resource $rDataStream
*
* @return \MailSo\Smtp\SmtpClient
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
*/
public function DataWithStream($rDataStream)
{
if (!\is_resource($rDataStream)) {
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
}
if (!$this->bRcpt) {
$this->writeLogException(new Exceptions\RuntimeException('No recipient forward path has been supplied'), \MailSo\Log\Enumerations\Type::ERROR, true);
}
$this->sendRequestWithCheck('DATA', 354);
$this->writeLog('Message data.', \MailSo\Log\Enumerations\Type::NOTE);
$this->bRunningCallback = true;
while (!\feof($rDataStream)) {
$sBuffer = \fgets($rDataStream);
if (false !== $sBuffer) {
if (0 === \strpos($sBuffer, '.')) {
$sBuffer = '.' . $sBuffer;
}
$this->sendRaw(\rtrim($sBuffer, "\r\n"), false);
\MailSo\Base\Utils::ResetTimeLimit();
continue;
} else {
if (!\feof($rDataStream)) {
$this->writeLogException(new Exceptions\RuntimeException('Cannot read input resource'), \MailSo\Log\Enumerations\Type::ERROR, true);
}
}
break;
}
$this->sendRequestWithCheck('.', 250);
$this->bRunningCallback = false;
$this->bData = true;
return $this;
}
示例4: davClientRequest
private function davClientRequest($oClient, $sCmd, $sUrl, $mData = null)
{
\MailSo\Base\Utils::ResetTimeLimit();
$this->oLogger->Write($sCmd . ' ' . $sUrl . ('PUT' === $sCmd && null !== $mData ? ' (' . \strlen($mData) . ')' : ''), \MailSo\Log\Enumerations\Type::INFO, 'DAV');
if ('PUT' === $sCmd) {
$this->oLogger->Write($mData, \MailSo\Log\Enumerations\Type::INFO, 'DAV');
}
$oResponse = false;
try {
$oResponse = 'PUT' === $sCmd && null !== $mData ? $oClient->request($sCmd, $sUrl, $mData) : $oClient->request($sCmd, $sUrl);
if ('GET' === $sCmd && false) {
$this->oLogger->WriteDump($oResponse, \MailSo\Log\Enumerations\Type::INFO, 'DAV');
}
} catch (\Exception $oException) {
$this->oLogger->WriteException($oException);
}
return $oResponse;
}
示例5: ImportVcfFile
/**
* @param string $sEmail
* @param string $sVcfData
*
* @return int
*/
public function ImportVcfFile($sEmail, $sVcfData)
{
$iCount = 0;
if ($this->IsActive() && \is_string($sVcfData)) {
$sVcfData = \trim($sVcfData);
if ("" === \substr($sVcfData, 0, 3)) {
$sVcfData = \substr($sVcfData, 3);
}
$oVCardSplitter = null;
try {
$oVCardSplitter = new \Sabre\VObject\Splitter\VCard($sVcfData);
} catch (\Exception $oExc) {
$this->Logger()->WriteException($oExc);
}
if ($oVCardSplitter) {
$oContact = new \RainLoop\Providers\AddressBook\Classes\Contact();
$oVCard = null;
while ($oVCard = $oVCardSplitter->getNext()) {
if ($oVCard instanceof \Sabre\VObject\Component\VCard) {
\MailSo\Base\Utils::ResetTimeLimit();
if (empty($oVCard->UID)) {
$oVCard->UID = \Sabre\DAV\UUIDUtil::getUUID();
}
$oContact->PopulateByVCard($oVCard->serialize());
if (0 < \count($oContact->Properties)) {
if ($this->ContactSave($sEmail, $oContact)) {
$iCount++;
}
}
$oContact->Clear();
}
}
}
}
return $iCount;
}
示例6: davClientRequest
private function davClientRequest($oClient, $sCmd, $sUrl, $mData = null)
{
\MailSo\Base\Utils::ResetTimeLimit();
$this->oLogger->Write($sCmd . ' ' . $sUrl . (('PUT' === $sCmd || 'POST' === $sCmd) && null !== $mData ? ' (' . \strlen($mData) . ')' : ''), \MailSo\Log\Enumerations\Type::INFO, 'DAV');
// if ('PUT' === $sCmd || 'POST' === $sCmd)
// {
// $this->oLogger->Write($mData, \MailSo\Log\Enumerations\Type::INFO, 'DAV');
// }
$oResponse = false;
try {
if (('PUT' === $sCmd || 'POST' === $sCmd) && null !== $mData) {
$oResponse = $oClient->request($sCmd, $sUrl, $mData, array('Content-Type' => 'text/vcard; charset=utf-8'));
} else {
$oResponse = $oClient->request($sCmd, $sUrl);
}
// if ('GET' === $sCmd)
// {
// $this->oLogger->WriteDump($oResponse, \MailSo\Log\Enumerations\Type::INFO, 'DAV');
// }
} catch (\Exception $oException) {
$this->oLogger->WriteException($oException);
}
return $oResponse;
}
示例7: partialResponseLiteralCallbackCallable
/**
* @param string $sParent
* @param string $sLiteralAtomUpperCase
* @param resource $rImapStream
* @param int $iLiteralLen
*
* @return bool
*/
private function partialResponseLiteralCallbackCallable($sParent, $sLiteralAtomUpperCase, $rImapStream, $iLiteralLen)
{
$sLiteralAtomUpperCasePeek = '';
if (0 === strpos($sLiteralAtomUpperCase, 'BODY')) {
$sLiteralAtomUpperCasePeek = str_replace('BODY', 'BODY.PEEK', $sLiteralAtomUpperCase);
}
$sFetchKey = '';
if (is_array($this->aFetchCallbacks)) {
if (0 < strlen($sLiteralAtomUpperCasePeek) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCasePeek])) {
$sFetchKey = $sLiteralAtomUpperCasePeek;
} else {
if (0 < strlen($sLiteralAtomUpperCase) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCase])) {
$sFetchKey = $sLiteralAtomUpperCase;
}
}
}
$bResult = false;
if (0 < \strlen($sFetchKey) && '' !== $this->aFetchCallbacks[$sFetchKey] && \is_callable($this->aFetchCallbacks[$sFetchKey])) {
$rImapLiteralStream = \MailSo\Base\StreamWrappers\Literal::CreateStream($rImapStream, $iLiteralLen);
$bResult = true;
$this->writeLog('Callback for ' . $sParent . ' / ' . $sLiteralAtomUpperCase . ' - try to read ' . $iLiteralLen . ' bytes.', \MailSo\Log\Enumerations\Type::NOTE);
\call_user_func($this->aFetchCallbacks[$sFetchKey], $sParent, $sLiteralAtomUpperCase, $rImapLiteralStream);
$iTimer = 0;
$iNotReadLiteralLen = 0;
while (!\feof($rImapLiteralStream)) {
$sBuf = \fread($rImapLiteralStream, 8192);
if (false !== $sBuf) {
\MailSo\Base\Utils::ResetTimeLimit($iTimer);
$iNotReadLiteralLen += \strlen($sBuf);
continue;
}
break;
}
if ($iNotReadLiteralLen > 0) {
$this->writeLog('Not read literal size ' . $iNotReadLiteralLen . ' bytes.', \MailSo\Log\Enumerations\Type::WARNING);
}
\MailSo\Base\Loader::IncStatistic('NetRead', $iLiteralLen);
if (\is_resource($rImapLiteralStream)) {
\fclose($rImapLiteralStream);
}
}
return $bResult;
}