Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -37,6 +37,11 @@ class _galleryStats extends \IPS\Widget\PermissionCache
|
||||
* @brief Plugin
|
||||
*/
|
||||
public $plugin = '';
|
||||
|
||||
/**
|
||||
* @brief Cache Expiration - 24h
|
||||
*/
|
||||
public $cacheExpiration = 86400;
|
||||
|
||||
/**
|
||||
* Initialize widget
|
||||
@@ -57,15 +62,28 @@ class _galleryStats extends \IPS\Widget\PermissionCache
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$stats = \IPS\Db::i()->select( 'COUNT(*) AS totalImages, SUM(image_comments) AS totalComments', 'gallery_images', array( "image_approved=?", 1 ) )->first();
|
||||
$stats['totalAlbums'] = \IPS\Db::i()->select( 'COUNT(*)', 'gallery_albums' )->first();
|
||||
|
||||
$stats = [];
|
||||
|
||||
$approxRows = \IPS\gallery\Image::databaseTableCount( TRUE );
|
||||
|
||||
if ( $approxRows > 1000000 )
|
||||
{
|
||||
$stats['totalImages'] = $approxRows;
|
||||
$stats['totalComments'] = (int) \IPS\Db::i()->query( "SHOW TABLE STATUS LIKE '" . \IPS\Db::i()->prefix . "gallery_comments';" )->fetch_assoc()['Rows'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$stats = \IPS\Db::i()->select( 'COUNT(*) AS totalImages, SUM(image_comments) AS totalComments', 'gallery_images', [ "image_approved=?", 1 ] )->first();
|
||||
}
|
||||
|
||||
$stats['totalAlbums'] = \IPS\gallery\Album\Item::databaseTableCount( TRUE );
|
||||
|
||||
$latestImage = NULL;
|
||||
foreach ( \IPS\gallery\Image::getItemsWithPermission( array(), NULL, 1, 'read', \IPS\Content\Hideable::FILTER_PUBLIC_ONLY ) as $latestImage )
|
||||
foreach ( \IPS\gallery\Image::getItemsWithPermission( [], NULL, 1, 'read', \IPS\Content\Hideable::FILTER_PUBLIC_ONLY ) as $latestImage )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return $this->output( $stats, $latestImage );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user