Version 4.3.6

This commit is contained in:
Neo committed 2025-12-19 05:49:12 -08:00
1 parent fe1acf984a
commit 1a0c7fd3c2
609 files changed
+14707 -5726

No files matched your search

+1 -1
View File
@@ -192,7 +192,7 @@ class _cleanup extends \IPS\Task
}
/* Delete any incompleted accounts (for example, someone has clicked "Sign in with Twitter" and never provided a username or email */
foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', array( array( '(name=? OR email=?)', '', '' ), array( 'joined<? AND last_visit=0', \IPS\DateTime::create()->sub( new \DateInterval( 'PT1H' ) )->getTimestamp() ) ) ), 'IPS\Member' ) as $incompleteMember )
foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', array( array( '(name=? OR email=?)', '', '' ), array( '! (members_bitoptions2 & 16384 ) AND joined<? AND last_visit=0', \IPS\DateTime::create()->sub( new \DateInterval( 'PT1H' ) )->getTimestamp() ) ) ), 'IPS\Member' ) as $incompleteMember )
{
$incompleteMember->delete();
}
@@ -0,0 +1,59 @@
<?php
/**
* @brief clearelasticsearchtasks Task
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 30 Jul 2018
*/
namespace IPS\core\tasks;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* clearelasticsearchtasks Task
*/
class _clearelasticsearchtasks extends \IPS\Task
{
/**
* Execute
*
* If ran successfully, should return anything worth logging. Only log something
* worth mentioning (don't log "task ran successfully"). Return NULL (actual NULL, not '' or 0) to not log (which will be most cases).
* 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
*/
public function execute()
{
if( \IPS\Settings::i()->search_method != 'elastic' )
{
return NULL;
}
\IPS\Content\Search\Index::i()->clearTasks();
}
/**
* Cleanup
*
* If your task takes longer than 15 minutes to run, this method
* will be called before execute(). Use it to clean up anything which
* may not have been done
*
* @return void
*/
public function cleanup()
{
}
}
+6 -10
View File
@@ -37,15 +37,10 @@ class _deletecontent extends \IPS\Task
{
$this->runUntilTimeout( function()
{
$timeago = \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->dellog_retention_period . 'D' ) );
$count = \IPS\Db::i()->select( 'COUNT(*)', 'core_deletion_log', array( "dellog_deleted_date<?", $timeago->getTimestamp() ) )->first();
if ( !$count )
{
return FALSE;
}
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_deletion_log', array( "dellog_deleted_date<?", $timeago->getTimestamp() ) ), 'IPS\core\DeletionLog' ) AS $log )
$timeago = \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->dellog_retention_period . 'D' ) );
$count = 0;
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_deletion_log', array( "dellog_deleted_date<?", $timeago->getTimestamp() ), 'dellog_deleted_date ASC', array( 0, 20 ) ), 'IPS\core\DeletionLog' ) AS $log )
{
try
{
@@ -60,9 +55,10 @@ class _deletecontent extends \IPS\Task
catch( \OutOfRangeException $e ){}
$log->delete();
$count++;
}
return TRUE;
return $count ? TRUE : FALSE;
} );
return NULL;
+1 -2
View File
@@ -43,8 +43,7 @@ class _onlineusers extends \IPS\Task
try
{
/* @todo Right now, users excluded from the online user list would not be counted if using REDIS - Matt has said to leave it with him */
$onlineGuests = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_GUESTS | \IPS\Session\Store::ONLINE_COUNT_ONLY );
$onlineGuests = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_GUESTS | \IPS\Session\Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE );
$onlineMembers = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_MEMBERS | \IPS\Session\Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE );
}
catch( \UnderflowException $e) {}
@@ -0,0 +1,74 @@
<?php
/**
* @brief pruneipaddresses Task
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 15 May 2018
*/
namespace IPS\core\tasks;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* pruneipaddresses Task
*/
class _pruneipaddresses extends \IPS\Task
{
/**
* Execute
*
* If ran successfully, should return anything worth logging. Only log something
* worth mentioning (don't log "task ran successfully"). Return NULL (actual NULL, not '' or 0) to not log (which will be most cases).
* 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
*/
public function execute()
{
if ( \IPS\Settings::i()->ip_address_prune < 1 )
{
return NULL;
}
$types = array();
foreach ( \IPS\Content::routedClasses( FALSE, TRUE ) as $class )
{
try
{
$class::pruneIpAddresses( \IPS\Settings::i()->ip_address_prune );
}
catch( \Exception $ex ) { }
}
/* Personal Messages */
$time = time() - ( 86400 * \IPS\Settings::i()->ip_address_prune );
\IPS\Db::i()->update( 'core_message_posts', array( 'msg_ip_address' => '' ), array( 'msg_date <= ' . $time ) );
return NULL;
}
/**
* Cleanup
*
* If your task takes longer than 15 minutes to run, this method
* will be called before execute(). Use it to clean up anything which
* may not have been done
*
* @return void
*/
public function cleanup()
{
}
}
+7 -4
View File
@@ -59,13 +59,16 @@ class _updatecheck extends \IPS\Task
$response = $url->setQueryString( 'version', $version )->request()->get()->decodeJson();
$coreApp = \IPS\Application::load('core');
$currentDetails = json_decode( $coreApp->update_version, TRUE );
if ( $currentDetails['version'] != $response['version'] and \IPS\Settings::i()->upgrade_email )
{
\IPS\Email::buildFromTemplate( 'core', 'upgrade', array( $response['version'], $response['releasenotes'], $response['security'] ), \IPS\Email::TYPE_LIST )->send( explode( ',', \IPS\Settings::i()->upgrade_email ) );
}
$coreApp->update_version = json_encode( $response );
$coreApp->update_last_check = time();
$coreApp->save();
/* Send a notification email if the last available release just changed */
if ( $updates = $coreApp->availableUpgrade() and count( $updates ) and \IPS\Settings::i()->upgrade_email AND $currentDetails['version'] != $response['version'] )
{
\IPS\Email::buildFromTemplate( 'core', 'upgrade', array( $updates, $coreApp->availableUpgrade( TRUE )['version'] ), \IPS\Email::TYPE_LIST )->send( explode( ',', \IPS\Settings::i()->upgrade_email ) );
}
}
catch ( \Exception $e ) { }
+17 -1
View File
@@ -265,7 +265,23 @@ class _usagereporting extends \IPS\Task
}
}
}
/* Converters */
$report['converters'] = array();
if ( \IPS\Application::appIsEnabled('convert') )
{
foreach( \IPS\convert\App::apps() as $app )
{
/* Some legacy converters may not have the correct sw key */
if( !\in_array( $app->sw, \IPS\Application::$ipsApps ) OR !$app->finished )
{
continue;
}
$report['converters'][ $app->sw . '_' . $app->app_key ] = $app->start_date;
}
}
/* Return */
return $report;
}
+7 -1
View File
@@ -36,6 +36,8 @@ class _viewupdates extends \IPS\Task
public function execute()
{
$this->runUntilTimeout(function(){
$hasCount = FALSE;
try
{
$database = \IPS\Db::i()->select( 'classname, id, COUNT(*) AS count', 'core_view_updates', NULL, NULL, 20, array( 'classname', 'id' ), NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER );
@@ -44,6 +46,8 @@ class _viewupdates extends \IPS\Task
/* Database results first */
foreach( $database as $row )
{
$hasCount = TRUE;
try
{
$this->update( $row['classname'], $row['id'], $row['count'] );
@@ -67,6 +71,8 @@ class _viewupdates extends \IPS\Task
foreach( $redis as $data => $count )
{
$hasCount = TRUE;
list( $class, $id ) = explode( '__', $data );
try
@@ -82,7 +88,7 @@ class _viewupdates extends \IPS\Task
}
/* Go for another go? */
if ( count( $database ) or count( $redis ) )
if ( $hasCount === TRUE )
{
return TRUE;
}