Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 6349 to 6373

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 19th March 2024 08:35 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.