Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

delete_unused_non_fixed_list_nodes()

Description

Delete unused non-fixed list field nodes with a 1:1 resource association

Parameters

ColumnTypeDefaultDescription
$resource_type_field integer Resource type field (metadata field) ID

Location

include/node_functions.php lines 2541 to 2560

Definition

 
function delete_unused_non_fixed_list_nodes(int $resource_type_field)
    {
    if(
$resource_type_field <= 0)
        {
        return;
        }

    
// Delete nodes that no longer have a resource association
    
ps_query(
           
'DELETE n
              FROM node AS n
        INNER JOIN resource_type_field AS rtf ON n.resource_type_field = rtf.ref
         LEFT JOIN resource_node AS rn ON rn.node = n.ref
             WHERE n.resource_type_field = ?
               AND rtf.`type`IN (' 
ps_param_insert(count(NON_FIXED_LIST_SINGULAR_RESOURCE_VALUE_FIELD_TYPES)) . ')
               AND rn.node IS NULL'
,
        
array_merge(['i'$resource_type_field], ps_param_fill(NON_FIXED_LIST_SINGULAR_RESOURCE_VALUE_FIELD_TYPES'i'))
    );
    
remove_invalid_node_keyword_mappings();
    }

This article was last updated 19th March 2024 10:35 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.