Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -63,7 +63,7 @@ class _viewupdates extends \IPS\Task
|
||||
catch ( \UnderflowException $e ) { }
|
||||
|
||||
/* Now try redis */
|
||||
if ( \IPS\REDIS_ENABLED and \IPS\CACHE_METHOD == 'Redis' and \IPS\CACHE_CONFIG )
|
||||
if ( \IPS\REDIS_ENABLED and \IPS\CACHE_METHOD == 'Redis' and ( \IPS\CACHE_CONFIG or \IPS\REDIS_CONFIG ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -86,6 +86,27 @@ class _viewupdates extends \IPS\Task
|
||||
}
|
||||
catch( \Exception $e ) { }
|
||||
}
|
||||
|
||||
/* Now try advert impressions */
|
||||
try
|
||||
{
|
||||
$redis = \IPS\Redis::i()->zRevRangeByScore( 'advert_impressions', '+inf', '-inf', array('withscores' => TRUE, 'limit' => array( 0, 20 ) ) );
|
||||
$updates = [];
|
||||
|
||||
foreach( $redis as $id => $count )
|
||||
{
|
||||
$hasCount = TRUE;
|
||||
$updates[ $count ][] = $id;
|
||||
|
||||
\IPS\Redis::i()->zRem( 'advert_impressions', $id );
|
||||
}
|
||||
|
||||
foreach( $updates as $incrementBy => $ids )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_advertisements', "ad_impressions=ad_impressions+" . $incrementBy, [ \IPS\Db::i()->in( 'ad_id', $ids ) ] );
|
||||
}
|
||||
}
|
||||
catch( \Exception $e ) { }
|
||||
|
||||
/* Go for another go? */
|
||||
if ( $hasCount === TRUE )
|
||||
|
||||
Reference in new issue
Block a user