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
@@ -12,16 +12,24 @@
namespace IPS\nexus\tasks;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Db;
use IPS\File;
use IPS\Session\Store;
use IPS\Task;
use IPS\Task\Exception;
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;
}
/**
* cartCleanup Task
*/
class _cartCleanup extends \IPS\Task
class cartCleanup extends Task
{
/**
* Execute
@@ -31,21 +39,21 @@ class _cartCleanup extends \IPS\Task
* If an error occurs which means the task could not finish running, throw an \IPS\Task\Exception - do not log an error as a normal log.
* Tasks should execute within the time of a normal HTTP request.
*
* @return mixed Message to log or NULL
* @throws \IPS\Task\Exception
* @return string|null Message to log or NULL
* @throws Exception
*/
public function execute()
public function execute() : string|null
{
$ids = array();
/* Fetch active session IDs */
foreach ( \IPS\Db::i()->select( 'nexus_cart_uploads.id', 'nexus_cart_uploads', array( 'time<? AND ' . \IPS\Db::i()->in( 'session_id', \IPS\Session\Store::i()->getSessionids(), true ), ( time() - 86400 ) ) ) as $id )
foreach ( Db::i()->select( 'nexus_cart_uploads.id', 'nexus_cart_uploads', array( 'time<? AND ' . Db::i()->in( 'session_id', Store::i()->getSessionids(), true ), ( time() - 86400 ) ) ) as $id )
{
\IPS\File::unclaimAttachments( 'nexus_Purchases', $id, NULL, 'cart' );
File::unclaimAttachments( 'nexus_Purchases', $id, NULL, 'cart' );
$ids[] = $id;
}
\IPS\Db::i()->delete( 'nexus_cart_uploads', \IPS\Db::i()->in( 'id', $ids ) );
Db::i()->delete( 'nexus_cart_uploads', Db::i()->in( 'id', $ids ) );
return NULL;
}
@@ -59,7 +67,7 @@ class _cartCleanup extends \IPS\Task
*
* @return void
*/
public function cleanup()
public function cleanup() : void
{
}