Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -54,26 +54,19 @@ class _forumStatistics extends \IPS\Widget\StaticCache
|
||||
|
||||
$approxRows = \IPS\Db::i()->query( "SHOW TABLE STATUS LIKE '" . \IPS\Db::i()->prefix . "forums_posts';" )->fetch_assoc();
|
||||
|
||||
if( (int) $approxRows['Rows'] > 1000000 )
|
||||
if( (int) $approxRows['Rows'] >= 1000000 )
|
||||
{
|
||||
$stats['total_posts'] = (int) $approxRows['Rows'];
|
||||
$stats['total_posts'] = \IPS\Db::i()->select( 'SUM(posts)', 'forums_forums' )->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
$stats['total_posts'] = \IPS\Db::i()->select( "COUNT(*)", 'forums_posts', array( 'queued = ?', 0 ) )->first();
|
||||
}
|
||||
|
||||
if ( \IPS\Settings::i()->archive_on )
|
||||
|
||||
/* Only query if we're not using the cached forums count, the cached count includes these */
|
||||
if ( (int) $approxRows['Rows'] <= 1000000 AND \IPS\Settings::i()->archive_on )
|
||||
{
|
||||
$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_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();
|
||||
|
||||
@@ -65,7 +65,7 @@ class _postFeed extends \IPS\Content\WidgetComment
|
||||
'zeroVal' => 'all_public',
|
||||
'permissionCheck' => function ( $forum )
|
||||
{
|
||||
return $forum->can('view') and $forum->sub_can_post and !$forum->redirect_url and $forum->can_view_others;
|
||||
return $forum->sub_can_post and !$forum->redirect_url and $forum->can_view_others;
|
||||
},
|
||||
'multiple' => true,
|
||||
'forceOwner' => false,
|
||||
@@ -88,13 +88,16 @@ class _postFeed extends \IPS\Content\WidgetComment
|
||||
$where = parent::buildWhere();
|
||||
if ( !isset( $this->configuration['widget_feed_use_perms'] ) or $this->configuration['widget_feed_use_perms'] )
|
||||
{
|
||||
if ( $containerClass::hasPasswordForums() )
|
||||
if ( $customNodes = $containerClass::customPermissionNodes() )
|
||||
{
|
||||
$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 ( \count( $customNodes['password'] ) )
|
||||
{
|
||||
$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;
|
||||
|
||||
@@ -59,7 +59,7 @@ class _topicFeed extends \IPS\Content\Widget
|
||||
'zeroVal' => 'all_public',
|
||||
'permissionCheck' => function ( $forum )
|
||||
{
|
||||
return $forum->can('view') and $forum->sub_can_post and !$forum->redirect_url and $forum->can_view_others;
|
||||
return $forum->sub_can_post and !$forum->redirect_url and $forum->can_view_others;
|
||||
},
|
||||
'multiple' => true,
|
||||
'forceOwner' => false,
|
||||
@@ -81,13 +81,16 @@ class _topicFeed extends \IPS\Content\Widget
|
||||
$where = parent::buildWhere();
|
||||
if ( !isset( $this->configuration['widget_feed_use_perms'] ) or $this->configuration['widget_feed_use_perms'] )
|
||||
{
|
||||
if ( $containerClass::hasPasswordForums() )
|
||||
if ( $customNodes = $containerClass::customPermissionNodes() )
|
||||
{
|
||||
$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 ( \count( $customNodes['password'] ) )
|
||||
{
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user