Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -5,28 +5,35 @@
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 13 Sep 2024
|
||||
* @since 02 Oct 2024
|
||||
*/
|
||||
|
||||
namespace IPS\core\tasks;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Exception;
|
||||
use IPS\Task;
|
||||
use IPS\Task\Exception as TaskException;
|
||||
use IPS\Data\Store;
|
||||
use IPS\Node\Model;
|
||||
use IPS\Redis;
|
||||
use OutOfRangeException;
|
||||
use RedisException;
|
||||
use function array_key_exists;
|
||||
use function is_array;
|
||||
use function defined;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* nodeRecounts Task
|
||||
*/
|
||||
class _nodeRecounts extends \IPS\Task
|
||||
class nodeRecounts extends Task
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
@@ -37,28 +44,28 @@ class _nodeRecounts 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 TaskException
|
||||
*/
|
||||
public function execute(): mixed
|
||||
public function execute() : mixed
|
||||
{
|
||||
$allKeys = [];
|
||||
try
|
||||
{
|
||||
if( ! Redis::isEnabled() )
|
||||
{
|
||||
throw new \BadMethodCallException;
|
||||
throw new BadMethodCallException;
|
||||
}
|
||||
|
||||
$allKeys = Redis::i()->hGetAll('nodeSyncTimes');
|
||||
}
|
||||
catch( \BadMethodCallException | \RedisException )
|
||||
catch( BadMethodCallException | RedisException )
|
||||
{
|
||||
try
|
||||
{
|
||||
$key = 'nodeSyncTimes';
|
||||
$allKeys = Store::i()->$key;
|
||||
}
|
||||
catch( \OutOfRangeException ){}
|
||||
catch( OutOfRangeException ){}
|
||||
}
|
||||
|
||||
if ( ! is_array( $allKeys ) or ! count( $allKeys ))
|
||||
@@ -85,7 +92,7 @@ class _nodeRecounts extends \IPS\Task
|
||||
/* Recount items, comments, reviews and the last comment data */
|
||||
$node->runScheduledRebuild();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -106,7 +113,7 @@ class _nodeRecounts extends \IPS\Task
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cleanup()
|
||||
public function cleanup() : void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user