Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 5160 to 5178

Definition

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

    
$sql_limit $limit == "" "LIMIT " $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))
            {
            
sql_query("DELETE FROM collection WHERE user ='" $user "' AND created < (curdate() - interval '2' DAY) ORDER BY created ASC " $sql_limit);
            }
        }
    }

This article was last updated 20th January 2021 18:35 Europe/London time based on the source file dated 19th January 2021 16:15 Europe/London time.