Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
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();