Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

+29 -15
View File
@@ -29,22 +29,36 @@ class _profilesync extends \IPS\Task
*/
public function execute()
{
$services = \IPS\core\ProfileSync\ProfileSyncAbstract::services();
if ( !empty( $services ) )
$totalToSync = \IPS\Db::i()->select( 'count(*)', 'core_members', array( "temp_ban=0 AND profilesync_lastsync > 0" ) )->first();
if( !$totalToSync )
{
$where = array( 'profilesync IS NOT NULL' );
/* Exclude banned users */
$where[] = array( 'temp_ban=?', 0 );
foreach ( \IPS\Db::i()->select( '*', 'core_members', $where, 'profilesync_lastsync ASC', 25 ) as $row )
{
foreach ( $services as $class )
{
$obj = new $class( \IPS\Member::constructFromData( $row ) );
$obj->sync();
}
}
return NULL;
}
else
{
/* The task runs once per hour and looks for all accounts that haven't been synced in 12+ hours, so we want to set a hard limit that
will allow all accounts to be processed in a 12 hour period if resources permit */
$accounts = ceil( $totalToSync / 12 );
}
$this->runUntilTimeout( function()
{
try
{
$member = \IPS\Db::i()->select( '*', 'core_members', array( "temp_ban=0 AND profilesync_lastsync > 0 AND profilesync_lastsync < ?", ( time() - ( 60 * 60 * 12 ) ) ), 'profilesync_lastsync ASC', 1 )->first();
}
catch ( \UnderflowException $e )
{
return FALSE;
}
$member = \IPS\Member::constructFromData( $member );
$member->profileSync();
return TRUE;
}, $accounts );
return NULL;
}
}