mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-03 15:42:29 +01:00
swiftmailer
This commit is contained in:
@@ -20,28 +20,28 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_threshold;
|
||||
private $threshold;
|
||||
|
||||
/**
|
||||
* The number of seconds to sleep for during a restart.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_sleep;
|
||||
private $sleep;
|
||||
|
||||
/**
|
||||
* The internal counter.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_counter = 0;
|
||||
private $counter = 0;
|
||||
|
||||
/**
|
||||
* The Sleeper instance for sleeping.
|
||||
*
|
||||
* @var Swift_Plugins_Sleeper
|
||||
*/
|
||||
private $_sleeper;
|
||||
private $sleeper;
|
||||
|
||||
/**
|
||||
* Create a new AntiFloodPlugin with $threshold and $sleep time.
|
||||
@@ -54,7 +54,7 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
{
|
||||
$this->setThreshold($threshold);
|
||||
$this->setSleepTime($sleep);
|
||||
$this->_sleeper = $sleeper;
|
||||
$this->sleeper = $sleeper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
*/
|
||||
public function setThreshold($threshold)
|
||||
{
|
||||
$this->_threshold = $threshold;
|
||||
$this->threshold = $threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
*/
|
||||
public function getThreshold()
|
||||
{
|
||||
return $this->_threshold;
|
||||
return $this->threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
*/
|
||||
public function setSleepTime($sleep)
|
||||
{
|
||||
$this->_sleep = $sleep;
|
||||
$this->sleep = $sleep;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +94,7 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
*/
|
||||
public function getSleepTime()
|
||||
{
|
||||
return $this->_sleep;
|
||||
return $this->sleep;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,15 +113,15 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
*/
|
||||
public function sendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
++$this->_counter;
|
||||
if ($this->_counter >= $this->_threshold) {
|
||||
++$this->counter;
|
||||
if ($this->counter >= $this->threshold) {
|
||||
$transport = $evt->getTransport();
|
||||
$transport->stop();
|
||||
if ($this->_sleep) {
|
||||
$this->sleep($this->_sleep);
|
||||
if ($this->sleep) {
|
||||
$this->sleep($this->sleep);
|
||||
}
|
||||
$transport->start();
|
||||
$this->_counter = 0;
|
||||
$this->counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,8 +132,8 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
*/
|
||||
public function sleep($seconds)
|
||||
{
|
||||
if (isset($this->_sleeper)) {
|
||||
$this->_sleeper->sleep($seconds);
|
||||
if (isset($this->sleeper)) {
|
||||
$this->sleeper->sleep($seconds);
|
||||
} else {
|
||||
sleep($seconds);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user