Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

+29 -8
View File
@@ -26,7 +26,7 @@ class _Database extends \IPS\Session\Store
* Load the session from the storage engine
*
* @param string $sessionId Session ID
* @return array
* @return array|NULL
*/
public function loadSession( $sessionId )
{
@@ -197,13 +197,34 @@ class _Database extends \IPS\Session\Store
$memberSubWhere[] = 's.member_id IS NOT NULL';
/* Ok, this looks odd, but the ONLY_FULL_GROUP_BY bites us here, so selecting max(id) allows us to return a session ID even though we're grouping on member_id */
$where = array(
array(
"( core_sessions.id IN(?) OR core_sessions.id IN(?) )",
\IPS\Db::i()->select( 'MAX(id)', array( 'core_sessions', 's' ), $memberSubWhere, NULL, NULL, 'member_id' ),
\IPS\Db::i()->select( 'MAX(id)', array( 'core_sessions', 's' ), $guestSubWhere, NULL, NULL, 'ip_address' )
)
);
if ( $flags AND ! ( $flags & static::ONLINE_GUESTS ) )
{
$where = array(
array(
"core_sessions.id IN(?)",
\IPS\Db::i()->select( 'MAX(id)', array( 'core_sessions', 's' ), $memberSubWhere, NULL, NULL, 'member_id' ),
)
);
}
elseif ( $flags AND ! ( $flags & static::ONLINE_MEMBERS ) )
{
$where = array(
array(
"core_sessions.id IN(?)",
\IPS\Db::i()->select( 'MAX(id)', array( 'core_sessions', 's' ), $guestSubWhere, NULL, NULL, 'ip_address' )
)
);
}
else
{
$where = array(
array(
"( core_sessions.id IN(?) OR core_sessions.id IN(?) )",
\IPS\Db::i()->select( 'MAX(id)', array( 'core_sessions', 's' ), $memberSubWhere, NULL, NULL, 'member_id' ),
\IPS\Db::i()->select( 'MAX(id)', array( 'core_sessions', 's' ), $guestSubWhere, NULL, NULL, 'ip_address' )
)
);
}
/* Limiting to a user group? */
if ( $memberGroup )
+26 -7
View File
@@ -31,13 +31,17 @@ class _Redis extends \IPS\Session\Store
* Load the session from the storage engine
*
* @param string $sessionId Session ID
* @return array
* @return array|NULL
*/
public function loadSession( $sessionId )
{
if ( $result = \IPS\Redis::i()->hGetAll( static::_key( 'session_id_' . md5( $sessionId . \IPS\Settings::i()->sql_pass ) ) ) )
{
return \IPS\Redis::i()->decode( $result['data'] );
{
try
{
return \IPS\Redis::i()->decode( $result['data'] );
}
catch( \RedisException $e ){}
}
return NULL;
@@ -136,7 +140,11 @@ class _Redis extends \IPS\Session\Store
{
$session = \IPS\Redis::i()->hMGet( $redisKey, array( 'data' ) );
$sessionMap[ $index ] = \IPS\Redis::i()->decode( $session['data'] );
try
{
$sessionMap[ $index ] = \IPS\Redis::i()->decode( $session['data'] );
}
catch( \RedisException $e ){}
}
foreach( $sessionMap as $session )
@@ -196,8 +204,12 @@ class _Redis extends \IPS\Session\Store
if ( $id == $memberId )
{
if ( $result = \IPS\Redis::i()->hGetAll( static::_key( $sessionKey ) ) )
{
return \IPS\Redis::i()->decode( $result['data'] );
{
try
{
return \IPS\Redis::i()->decode( $result['data'] );
}
catch( \RedisException $e ){}
}
}
}
@@ -368,7 +380,14 @@ class _Redis extends \IPS\Session\Store
{
if ( $field === 'data' )
{
$data = \IPS\Redis::i()->decode( $results[ $i++ ] );
try
{
$data = \IPS\Redis::i()->decode( $results[ $i++ ] );
}
catch( \RedisException $e )
{
$data = NULL;
}
}
/* login_type must be cast as an integer or else anonymous state can be lost when adjustSessions() runs */
elseif( $field === 'login_type' )