Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -873,6 +873,11 @@ class _Promote extends \IPS\Patterns\ActiveRecord
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cache internal stream data
|
||||
*/
|
||||
protected static $internalStream = array();
|
||||
|
||||
/**
|
||||
* Promote stream of internally promoted items
|
||||
*
|
||||
@@ -883,6 +888,13 @@ class _Promote extends \IPS\Patterns\ActiveRecord
|
||||
*/
|
||||
public static function internalStream( $limit=10, $sortField='promote_sent', $sortDirection='desc')
|
||||
{
|
||||
$_key = md5( $limit . $sortField . $sortDirection );
|
||||
|
||||
if( array_key_exists( $_key, static::$internalStream ) )
|
||||
{
|
||||
return static::$internalStream[ $_key ];
|
||||
}
|
||||
|
||||
$items = array();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_social_promote', array( 'promote_sent > 0 and promote_internal=1 and promote_hide=0' ), $sortField . ' ' . $sortDirection, $limit ) as $row )
|
||||
@@ -890,6 +902,7 @@ class _Promote extends \IPS\Patterns\ActiveRecord
|
||||
$items[ $row['promote_id'] ] = static::constructFromData( $row );
|
||||
}
|
||||
|
||||
static::$internalStream[ $_key ] = $items;
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user