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

+22 -11
View File
@@ -12,16 +12,27 @@
namespace IPS\cms\tasks;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\cms\Databases;
use IPS\cms\Pages\Page;
use IPS\cms\Records;
use IPS\Db;
use IPS\Task;
use IPS\Task\Exception;
use OutOfRangeException;
use function defined;
use function in_array;
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;
}
/**
* updaterecords Task
*/
class _updaterecords extends \IPS\Task
class updaterecords extends Task
{
/**
* Execute
@@ -32,16 +43,16 @@ class _updaterecords 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
{
foreach( \IPS\cms\Databases::databases() as $database )
foreach( Databases::databases() as $database )
{
$recordClass = 'IPS\cms\Records' . $database->id;
/* @var $recordClass Records */
$fixedFields = $database->fixed_field_perms;
if ( ! \in_array( 'record_expiry_date', array_keys( $fixedFields ) ) )
if ( ! in_array( 'record_expiry_date', array_keys( $fixedFields ) ) )
{
continue;
}
@@ -49,9 +60,9 @@ class _updaterecords extends \IPS\Task
/* Check the database is placed on a valid page */
try
{
\IPS\cms\Pages\Page::loadByDatabaseId( $database->id );
Page::loadByDatabaseId( $database->id );
}
catch( \OutOfRangeException $ex )
catch( OutOfRangeException $ex )
{
continue;
}
@@ -60,7 +71,7 @@ class _updaterecords extends \IPS\Task
if ( ! empty( $permissions['visible'] ) )
{
foreach( \IPS\Db::i()->select( '*', $recordClass::$databaseTable, array( 'record_expiry_date > 0 and record_expiry_date <= ? and record_approved=1', time() ),'primary_id_field ASC', 250 ) as $row )
foreach( Db::i()->select( '*', $recordClass::$databaseTable, array( 'record_expiry_date > 0 and record_expiry_date <= ? and record_approved=1', time() ),'primary_id_field ASC', 250 ) as $row )
{
$record = $recordClass::constructFromData( $row );
$record->hide( FALSE );