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

+18 -10
View File
@@ -11,16 +11,24 @@
namespace IPS\core\tasks;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Db;
use IPS\Session\Store;
use IPS\Task;
use IPS\Task\Exception;
use UnderflowException;
use function defined;
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;
}
/**
* onlineusers Task
*/
class _onlineusers extends \IPS\Task
class onlineusers extends Task
{
/**
* Execute
@@ -31,9 +39,9 @@ class _onlineusers extends \IPS\Task
* Tasks should execute within the time of a normal HTTP request.
*
* @return mixed Message to log or NULL
* @throws \IPS\Task\Exception
* @throws Exception
*/
public function execute()
public function execute() : mixed
{
/* We want the rows to have the same timestamp exactly */
$time = time();
@@ -43,19 +51,19 @@ class _onlineusers extends \IPS\Task
try
{
$onlineGuests = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_GUESTS | \IPS\Session\Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE );
$onlineMembers = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_MEMBERS | \IPS\Session\Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE );
$onlineGuests = Store::i()->getOnlineUsers( Store::ONLINE_GUESTS | Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE );
$onlineMembers = Store::i()->getOnlineUsers( Store::ONLINE_MEMBERS | Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE );
}
catch( \UnderflowException $e) {}
catch( UnderflowException $e) {}
\IPS\Db::i()->insert( 'core_statistics', array(
Db::i()->insert( 'core_statistics', array(
'type' => 'online_users',
'time' => $time,
'value_4' => 'guests',
'value_1' => $onlineGuests
) );
\IPS\Db::i()->insert( 'core_statistics', array(
Db::i()->insert( 'core_statistics', array(
'type' => 'online_users',
'time' => $time,
'value_4' => 'members',