Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 6395 to 6419

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 17th November 2024 15:35 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.