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();
|
||||
|
||||
Reference in new issue
Block a user