Collections functions
General functions
Render functions
Theme permission functions
Resource functions

cleanup_anonymous_collections()

Description

Remove all old anonymous collections

Parameters

ColumnTypeDefaultDescription
$limit int 100 Maximum number of collections to delete - if run from browser this is kept low to avoid delays

Return

void

Location

include/collections_functions.php lines 6225 to 6249

Definition

 
function cleanup_anonymous_collections(int $limit 100)
    {
    global 
$anonymous_login;

    
$sql_limit "";
    
$params = [];
    if(
$limit != 0)
        {
        
$sql_limit 'LIMIT ?';
        
$params = ['i'$limit];
        }

    if(!
is_array($anonymous_login))
        {
        
$anonymous_login = array($anonymous_login);
        }
    foreach (
$anonymous_login as $anonymous_user)
        {
        
$user get_user_by_username($anonymous_user);
        if(
is_int_loose($user))
            {
            
ps_query("DELETE FROM collection WHERE user = ? AND created < (curdate() - interval '2' DAY) ORDER BY created ASC " $sql_limitarray_merge(['i'$user], $params));
            }
        }
    }

This article was last updated 30th September 2022 16:05 Europe/London time based on the source file dated 22nd September 2022 11:00 Europe/London time.