apply StyleCI recommendation
This commit is contained in:
parent
a203e6322b
commit
7b2f0ff302
|
@ -460,7 +460,7 @@ class Database extends AbstractData
|
||||||
public function getValue($namespace, $key = '')
|
public function getValue($namespace, $key = '')
|
||||||
{
|
{
|
||||||
$configKey = strtoupper($namespace);
|
$configKey = strtoupper($namespace);
|
||||||
$value = $this->_getConfig($configKey);
|
$value = $this->_getConfig($configKey);
|
||||||
if ($value === '') {
|
if ($value === '') {
|
||||||
// initialize the row, so that setValue can rely on UPDATE queries
|
// initialize the row, so that setValue can rely on UPDATE queries
|
||||||
self::_exec(
|
self::_exec(
|
||||||
|
@ -640,7 +640,7 @@ class Database extends AbstractData
|
||||||
'SELECT value FROM ' . self::_sanitizeIdentifier('config') .
|
'SELECT value FROM ' . self::_sanitizeIdentifier('config') .
|
||||||
' WHERE id = ?', array($key), true
|
' WHERE id = ?', array($key), true
|
||||||
);
|
);
|
||||||
return $row ? $row['value']: '';
|
return $row ? $row['value'] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -171,8 +171,8 @@ class TrafficLimiter extends AbstractPersistence
|
||||||
|
|
||||||
// this hash is used as an array key, hence a shorter algo is used
|
// this hash is used as an array key, hence a shorter algo is used
|
||||||
$hash = self::getHash('sha256');
|
$hash = self::getHash('sha256');
|
||||||
$now = time();
|
$now = time();
|
||||||
$tl = (int) self::$_store->getValue('traffic_limiter', $hash);
|
$tl = (int) self::$_store->getValue('traffic_limiter', $hash);
|
||||||
self::$_store->purgeValues('traffic_limiter', $now - self::$_limit);
|
self::$_store->purgeValues('traffic_limiter', $now - self::$_limit);
|
||||||
if ($tl > 0 && ($tl + self::$_limit >= $now)) {
|
if ($tl > 0 && ($tl + self::$_limit >= $now)) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
|
@ -12,7 +12,7 @@ class TrafficLimiterTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/* Setup Routine */
|
/* Setup Routine */
|
||||||
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'trafficlimit';
|
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'trafficlimit';
|
||||||
$store = Filesystem::getInstance(array('dir' => $this->_path));
|
$store = Filesystem::getInstance(array('dir' => $this->_path));
|
||||||
ServerSalt::setStore($store);
|
ServerSalt::setStore($store);
|
||||||
TrafficLimiter::setStore($store);
|
TrafficLimiter::setStore($store);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue