Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

+23 -9
View File
@@ -11,9 +11,21 @@
namespace IPS\Content;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use Exception;
use IPS\Db;
use IPS\Events\Event;
use IPS\Redis;
use function defined;
use function get_called_class;
use const IPS\CACHE_CONFIG;
use const IPS\CACHE_METHOD;
use const IPS\REDIS_CONFIG;
use const IPS\REDIS_ENABLED;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
@@ -27,28 +39,30 @@ trait ViewUpdates
*
* @return void
*/
public function updateViews()
public function updateViews(): void
{
$idColumn = static::$databaseColumnId;
$class = \get_called_class();
$class = get_called_class();
$countUpdated = false;
if ( \IPS\REDIS_ENABLED and \IPS\CACHE_METHOD == 'Redis' and ( \IPS\CACHE_CONFIG or \IPS\REDIS_CONFIG ) )
if ( Redis::isEnabled() )
{
try
{
\IPS\Redis::i()->zIncrBy( 'topic_views', 1, $class .'__' . $this->$idColumn );
Redis::i()->zIncrBy( 'topic_views', 1, $class .'__' . $this->$idColumn );
$countUpdated = true;
}
catch( \Exception $e ) {}
catch( Exception $e ) {}
}
if ( ! $countUpdated )
{
\IPS\Db::i()->insert( 'core_view_updates', array(
Db::i()->insert( 'core_view_updates', array(
'classname' => $class,
'id' => $this->$idColumn
) );
}
Event::fire( 'onItemView', $this );
}
}