Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+31 -49
View File
@@ -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
*/
@@ -51,7 +51,14 @@ abstract class _Cache extends AbstractData
if ( $classname::supported() )
{
static::$instance = new $classname( json_decode( \IPS\CACHE_CONFIG, TRUE ) );
try
{
static::$instance = new $classname( json_decode( \IPS\CACHE_CONFIG, TRUE ) );
}
catch( \IPS\Data\Cache\Exception $e )
{
static::$instance = new \IPS\Data\Cache\None( array() );
}
}
else
{
@@ -73,20 +80,17 @@ abstract class _Cache extends AbstractData
*/
public function storeWithExpire( $key, $value, \IPS\DateTime $expire, $fallback=FALSE )
{
if ( \IPS\CACHE_METHOD === 'None' )
$value = array( 'value' => $value, 'expires' => $expire->getTimestamp() );
if ( \IPS\CACHING_LOG )
{
if ( $fallback )
{
\IPS\Db::i()->replace( 'core_cache', array(
'cache_key' => $key,
'cache_value' => json_encode( $value ),
'cache_expire' => $expire->getTimestamp()
) );
}
$this->log[] = array( 'set', $key, version_compare( PHP_VERSION, '5.4.0' ) >= 0 ? json_encode( $value, JSON_PRETTY_PRINT ) : json_encode( $value ), var_export( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ), TRUE ) );
}
else
if ( $this->set( $key, json_encode( $value ), $expire ) )
{
$this->$key = array( 'value' => $value, 'expires' => $expire->getTimestamp() );
$this->_data[ $key ] = $value;
$this->_exists[ $key ] = $key;
}
}
@@ -100,44 +104,18 @@ abstract class _Cache extends AbstractData
*/
public function getWithExpire( $key, $fallback=FALSE )
{
if ( \IPS\CACHE_METHOD === 'None' )
if ( !isset( $this->$key ) )
{
if ( $fallback )
{
try
{
return json_decode( \IPS\Db::i()->select( 'cache_value', 'core_cache', array( 'cache_key=? AND cache_expire>?', $key, time() ) )->first(), TRUE );
}
catch ( \UnderflowException $e )
{
throw new \OutOfRangeException;
}
}
else
{
throw new \OutOfRangeException;
}
throw new \OutOfRangeException;
}
else
$data = $this->$key;
if( count( $data ) and isset( $data['value'] ) and isset( $data['expires'] ) )
{
if ( !isset( $this->$key ) )
/* Is it expired? */
if( $data['expires'] AND time() < $data['expires'] )
{
throw new \OutOfRangeException;
}
$data = $this->$key;
if( count( $data ) and isset( $data['value'] ) and isset( $data['expires'] ) )
{
/* Is it expired? */
if( $data['expires'] AND time() < $data['expires'] )
{
return $data['value'];
}
else
{
unset( $this->$key );
throw new \OutOfRangeException;
}
return $data['value'];
}
else
{
@@ -145,6 +123,11 @@ abstract class _Cache extends AbstractData
throw new \OutOfRangeException;
}
}
else
{
unset( $this->$key );
throw new \OutOfRangeException;
}
}
/**
@@ -160,5 +143,4 @@ abstract class _Cache extends AbstractData
does not allow us to actually clear them */
\IPS\Data\Store::i()->cacheKeys = array();
}
}