Version 4.7.23

This commit is contained in:
Neo committed 2025-12-19 16:21:27 -08:00
1 parent 7124a02564
commit 25ddeb65d6
1791 files changed
+76990 -44452

No files matched your search

+31 -15
View File
@@ -10,6 +10,9 @@
namespace IPS\core\tasks;
use IPS\Application;
use function implode;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
@@ -31,7 +34,13 @@ class _cleanup extends \IPS\Task
public function execute()
{
/* Delete old failed guest logins for accounts that do not exist */
unset( \IPS\Data\Store::i()->failedLogins );
if( $maxCutoff = (int) \IPS\Settings::i()->bruteforce_global_period )
{
\IPS\Db::i()->delete( 'core_login_failures', [
'login_date<? AND login_ip_address IS NOT NULL AND login_email IS NOT NULL',
( new \IPS\DateTime )->sub( new \DateInterval( 'PT' . $maxCutoff . 'M' ) )->sub( new \DateInterval( 'PT24H' ) )->getTimestamp()
] );
}
/* Delete old password / security answer reset requests */
\IPS\Db::i()->delete( 'core_validating', array( '( lost_pass=1 OR forgot_security=1 ) AND email_sent < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P1D' ) )->getTimestamp() ) );
@@ -146,20 +155,38 @@ class _cleanup extends \IPS\Task
{
\IPS\Db::i()->delete( 'core_statistics', array( "type IN('emails_sent','email_views','email_clicks') AND time < ?", \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->prune_log_emailstats . 'D' ) )->getTimestamp() ) );
}
/* ...and guest details stored with reports */
if( (int) \IPS\Settings::i()->report_guest_details_store_days > 0 )
{
\IPS\Db::i()->update( 'core_rc_reports', [ 'guest_name' => null, 'guest_email' => null ], array( 'date_reported < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->report_guest_details_store_days . 'D' ) )->getTimestamp() ) );
}
/* ...and geoip cache */
\IPS\Db::i()->delete( 'core_geoip_cache', array( 'date < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P7D' ) )->getTimestamp() ) );
/* ...and API logs */
$successfulCodes = [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 226 ];
if( \IPS\Settings::i()->api_log_prune )
{
\IPS\Db::i()->delete( 'core_api_logs', array( 'date < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->api_log_prune . 'D' ) )->getTimestamp() ) );
\IPS\Db::i()->delete( 'core_api_logs', array( 'date < ? and response_code IN(' . implode( ',', $successfulCodes ) . ')', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->api_log_prune . 'D' ) )->getTimestamp() ) );
}
/* ...and member history */
if( \IPS\Settings::i()->api_log_prune_failures )
{
\IPS\Db::i()->delete( 'core_api_logs', array( 'date < ? and response_code NOT IN(' . implode( ',', $successfulCodes ) . ')', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->api_log_prune_failures . 'D' ) )->getTimestamp() ) );
}
/* ...and non-nexus member history */
if( \IPS\Settings::i()->prune_member_history AND !\in_array( 'core_member_history', $currentlyPruning ) )
{
\IPS\Db::i()->delete( 'core_member_history', array( 'log_date < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->prune_member_history . 'D' ) )->getTimestamp() ) );
\IPS\Db::i()->delete( 'core_member_history', array( 'log_date < ? and log_app != ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->prune_member_history . 'D' ) )->getTimestamp(), 'nexus' ) );
}
/* ...and Nexus member history */
if( Application::appIsEnabled('nexus') and \IPS\Settings::i()->nexus_prune_history AND !\in_array( 'core_member_history', $currentlyPruning ) )
{
\IPS\Db::i()->delete( 'core_member_history', array( 'log_date < ? and log_app = ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->nexus_prune_history . 'D' ) )->getTimestamp(), 'nexus' ) );
}
/* ...and promote response logs */
@@ -200,15 +227,6 @@ class _cleanup extends \IPS\Task
}
}
/* Delete old follows */
if ( \IPS\Settings::i()->prune_follows AND !\in_array( 'core_follow', $currentlyPruning ) )
{
\IPS\Db::i()->delete( 'core_follow', array( 'follow_app!=? AND follow_area!=? AND follow_member_id IN(?)', 'core', 'member', \IPS\Db::i()->select( 'member_id', 'core_members', array( 'last_activity < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->prune_follows . 'D' ) )->getTimestamp() ) ) ) );
/* And clear the cache so it can rebuild */
\IPS\Db::i()->delete( 'core_follow_count_cache' );
}
/* Delete old item markers */
if ( \IPS\Settings::i()->prune_item_markers AND !\in_array( 'core_item_markers', $currentlyPruning ) )
{
@@ -227,8 +245,6 @@ class _cleanup extends \IPS\Task
\IPS\Db::i()->delete( 'core_members_known_devices', array( 'last_seen < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->prune_known_devices . 'D' ) )->getTimestamp() ) );
}
\IPS\Db::i()->delete( 'core_item_member_map', array( 'map_latest_date < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P9M' ) )->getTimestamp() ) );
/* Delete moved links */
if ( \IPS\Settings::i()->topic_redirect_prune )
{