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
@@ -11,16 +11,23 @@
|
||||
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\Task;
|
||||
use IPS\Task\Exception;
|
||||
use function defined;
|
||||
use const IPS\STORE_METHOD;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* clearcache Task
|
||||
*/
|
||||
class _clearcache extends \IPS\Task
|
||||
class clearcache extends Task
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
@@ -31,18 +38,17 @@ class _clearcache 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
|
||||
{
|
||||
/* Note: We previously disabled the task if the caching method was disabled however this lead to people re-enabling through a constants edit which would not re-enabled the task */
|
||||
\IPS\Db::i()->delete( 'core_cache', array( 'cache_expire<?', time() ) );
|
||||
\IPS\Output\Cache::i()->deleteExpired();
|
||||
Db::i()->delete( 'core_cache', array( 'cache_expire<?', time() ) );
|
||||
|
||||
/* If we are using Redis, ensure that core_store is empty. We may have switched over to Redis from MySQL and if we switch back, we do not want stale data being used */
|
||||
if ( \IPS\STORE_METHOD !== 'Database' AND \IPS\Db::i()->select( 'count(*)', 'core_store' )->first() )
|
||||
if ( STORE_METHOD !== 'Database' AND Db::i()->select( 'count(*)', 'core_store' )->first() )
|
||||
{
|
||||
\IPS\Db::i()->delete( 'core_store' );
|
||||
Db::i()->delete( 'core_store' );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in new issue
Block a user