Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
+34
-7
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Abstract Storage Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 07 May 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -35,13 +35,13 @@ abstract class _Store extends AbstractData
|
||||
*/
|
||||
public static function i()
|
||||
{
|
||||
if( self::$instance === NULL )
|
||||
if( static::$instance === NULL )
|
||||
{
|
||||
$classname = 'IPS\Data\Store\\' . \IPS\STORE_METHOD;
|
||||
self::$instance = new $classname( json_decode( \IPS\STORE_CONFIG, TRUE ) );
|
||||
static::$instance = new $classname( json_decode( \IPS\STORE_CONFIG, TRUE ) );
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
return static::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +70,33 @@ abstract class _Store extends AbstractData
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the datastore engine to make sure it's working
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function test()
|
||||
{
|
||||
/* Set a test key */
|
||||
$key = 'test_' . md5( uniqid() );
|
||||
$this->$key = '1';
|
||||
|
||||
/* Now clear our internal cache to ensure the value isn't returned from there */
|
||||
unset( $this->_data[ $key ], $this->_exists[ $key ], static::$cache[ $key ] );
|
||||
|
||||
/* And then try to retrieve it */
|
||||
if( isset( $this->$key ) )
|
||||
{
|
||||
$value = $this->$key;
|
||||
|
||||
unset( $this->$key );
|
||||
|
||||
return ( $value == 1 ) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic Method: Get
|
||||
@@ -93,7 +120,7 @@ abstract class _Store extends AbstractData
|
||||
$value = \IPS\Data\Cache::i()->$key;
|
||||
|
||||
/* But only use it if the hash matches */
|
||||
if ( $cacheKeys[ $key ] === md5( json_encode( $value ) ) )
|
||||
if( \IPS\Login::compareHashes( $cacheKeys[ $key ], md5( json_encode( $value ) ) ) )
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
@@ -177,7 +204,7 @@ abstract class _Store extends AbstractData
|
||||
|
||||
/* But only use it if the hash matches */
|
||||
$cacheKeys = ( isset( $this->cacheKeys ) and is_array( $this->cacheKeys ) ) ? $this->cacheKeys : array();
|
||||
if ( isset( $cacheKeys[ $key ] ) and $cacheKeys[ $key ] === md5( json_encode( $value ) ) )
|
||||
if ( isset( $cacheKeys[ $key ] ) and \IPS\Login::compareHashes( $cacheKeys[ $key ], md5( json_encode( $value ) ) ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user