Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\Data\Cache;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -25,7 +25,8 @@ class _Redis extends \IPS\Data\Cache
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @param array $configuration Configuration to use
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $configuration )
|
||||
{
|
||||
@@ -79,15 +80,15 @@ class _Redis extends \IPS\Data\Cache
|
||||
{
|
||||
throw new \DomainException( 'datastore_redis_servers_err' );
|
||||
}
|
||||
} ),
|
||||
}, NULL, NULL, 'redis_host' ),
|
||||
'port' => new \IPS\Helpers\Form\Number( 'server_port', isset( $configuration['port'] ) ? $configuration['port'] : NULL, FALSE, array( 'placeholder' => '6379' ), function( $val )
|
||||
{
|
||||
if ( \IPS\Request::i()->cache_method === 'Redis' AND $val AND ( $val < 0 OR $val > 65535 ) )
|
||||
{
|
||||
throw new \DomainException( 'datastore_redis_servers_err' );
|
||||
}
|
||||
} ),
|
||||
'password' => new \IPS\Helpers\Form\Password( 'server_password', isset( $configuration['password'] ) ? $configuration['password'] : '', FALSE ),
|
||||
}, NULL, NULL, 'redis_port' ),
|
||||
'password' => new \IPS\Helpers\Form\Password( 'server_password', isset( $configuration['password'] ) ? $configuration['password'] : '', FALSE, array(), NULL, NULL, NULL, 'redis_password' ),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -99,7 +100,6 @@ class _Redis extends \IPS\Data\Cache
|
||||
/**
|
||||
* Get random string used in the keys to identify this site compared to other sites
|
||||
*
|
||||
* @param string $key
|
||||
* @return string|FALSE Value from the _datastore; FALSE if key doesn't exist
|
||||
*/
|
||||
protected function _getRedisKey()
|
||||
@@ -148,7 +148,7 @@ class _Redis extends \IPS\Data\Cache
|
||||
*
|
||||
* @param string $key Key
|
||||
* @param string $value Value
|
||||
* @param \IPS\DateTime $expire Expreation time, or NULL for no expiration
|
||||
* @param \IPS\DateTime|NULL $expire Expreation time, or NULL for no expiration
|
||||
* @return bool
|
||||
*/
|
||||
protected function set( $key, $value, \IPS\DateTime $expire = NULL )
|
||||
@@ -200,7 +200,7 @@ class _Redis extends \IPS\Data\Cache
|
||||
{
|
||||
try
|
||||
{
|
||||
return (bool) \IPS\Redis::i()->delete( $this->_getRedisKey() . '_' . $key );
|
||||
return (bool) \IPS\Redis::i()->del( $this->_getRedisKey() . '_' . $key );
|
||||
}
|
||||
catch( \RedisException $e )
|
||||
{
|
||||
@@ -222,14 +222,4 @@ class _Redis extends \IPS\Data\Cache
|
||||
\IPS\Redis::i()->setex( 'redisKey', 604800, $this->_redisKey );
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a page hit
|
||||
*
|
||||
* @param \IPS\Http\Url|NULL $url URL to log (or null)
|
||||
* @return void
|
||||
*/
|
||||
public function logPageHit( $url=NULL )
|
||||
{
|
||||
return \IPS\Redis::i()->logPageHit( $url );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user