Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -38,6 +38,11 @@ class _forumStatistics extends \IPS\Widget\StaticCache
|
||||
*/
|
||||
public $plugin = '';
|
||||
|
||||
/**
|
||||
* @brief Cache Expiration - 24h
|
||||
*/
|
||||
public $cacheExpiration = 86400;
|
||||
|
||||
/**
|
||||
* Render a widget
|
||||
*
|
||||
@@ -46,12 +51,29 @@ class _forumStatistics extends \IPS\Widget\StaticCache
|
||||
public function render()
|
||||
{
|
||||
$stats = array();
|
||||
|
||||
$stats['total_posts'] = \IPS\Db::i()->select( "COUNT(*)", 'forums_posts', array( 'queued = ?', 0 ) )->first();
|
||||
|
||||
$approxRows = \IPS\Db::i()->query( "SHOW TABLE STATUS LIKE '" . \IPS\Db::i()->prefix . "forums_posts';" )->fetch_assoc();
|
||||
|
||||
if( (int) $approxRows['Rows'] > 1000000 )
|
||||
{
|
||||
$stats['total_posts'] = (int) $approxRows['Rows'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$stats['total_posts'] = \IPS\Db::i()->select( "COUNT(*)", 'forums_posts', array( 'queued = ?', 0 ) )->first();
|
||||
}
|
||||
|
||||
if ( \IPS\Settings::i()->archive_on )
|
||||
{
|
||||
$stats['total_posts'] += \IPS\forums\Topic\ArchivedPost::db()->select( 'COUNT(*)', 'forums_archive_posts', array( 'archive_queued = ?', 0 ) )->first();
|
||||
$approxRows = \IPS\forums\Topic\ArchivedPost::db()->query( "SHOW TABLE STATUS LIKE '" . \IPS\forums\Topic\ArchivedPost::db()->prefix . "forums_archive_posts';" )->fetch_assoc();
|
||||
if( (int) $approxRows['Rows'] > 1000000 )
|
||||
{
|
||||
$stats['total_posts'] += (int) $approxRows['Rows'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$stats['total_posts'] += \IPS\forums\Topic\ArchivedPost::db()->select( 'COUNT(*)', 'forums_archive_posts', array( 'archive_queued = ?', 0 ) )->first();
|
||||
}
|
||||
}
|
||||
|
||||
$stats['total_topics'] = \IPS\Db::i()->select( "COUNT(*)", 'forums_topics', array( 'approved = ?', 1 ) )->first();
|
||||
|
||||
@@ -82,10 +82,20 @@ class _postFeed extends \IPS\Content\WidgetComment
|
||||
*/
|
||||
protected function buildWhere()
|
||||
{
|
||||
$class = static::$class;
|
||||
$itemClass = $class::$itemClass;
|
||||
$containerClass = $itemClass::$containerNodeClass;
|
||||
$where = parent::buildWhere();
|
||||
if ( !isset( $this->configuration['widget_feed_use_perms'] ) or $this->configuration['widget_feed_use_perms'] )
|
||||
{
|
||||
$where['container'][] = array( 'forums_forums.password IS NULL AND forums_forums.can_view_others=1' );
|
||||
if ( $containerClass::hasPasswordForums() )
|
||||
{
|
||||
$where['container'][] = array( 'forums_forums.password IS NULL AND forums_forums.can_view_others=1' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where['container'][] = array( 'forums_forums.can_view_others=1' );
|
||||
}
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
@@ -76,10 +76,24 @@ class _topicFeed extends \IPS\Content\Widget
|
||||
*/
|
||||
protected function buildWhere()
|
||||
{
|
||||
$class = static::$class;
|
||||
$containerClass = $class::$containerNodeClass;
|
||||
$where = parent::buildWhere();
|
||||
if ( !isset( $this->configuration['widget_feed_use_perms'] ) or $this->configuration['widget_feed_use_perms'] )
|
||||
{
|
||||
$where['container'][] = array( 'forums_forums.password IS NULL AND forums_forums.can_view_others=1' );
|
||||
if ( $containerClass::hasPasswordForums() )
|
||||
{
|
||||
$where['container'][] = array( 'forums_forums.password IS NULL AND forums_forums.can_view_others=1' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where['container'][] = array( 'forums_forums.can_view_others=1' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $this->configuration['widget_feed_status_solved'] ) and $this->configuration['widget_feed_status_solved'] == 'unsolved' and empty( $this->configuration['widget_feed_container'] ) )
|
||||
{
|
||||
$where['container'][] = array( '( (' . \IPS\Db::i()->bitwiseWhere( \IPS\forums\Forum::$bitOptions['forums_bitoptions'], 'bw_enable_answers' ) . ') OR ( ' . \IPS\Db::i()->bitwiseWhere( \IPS\forums\Forum::$bitOptions['forums_bitoptions'], 'bw_enable_answers_moderator' ) . ' ) )' );
|
||||
}
|
||||
|
||||
return $where;
|
||||
|
||||
Reference in new issue
Block a user