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

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 2559 to 2578

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 4th December 2024 08:35 Europe/London time based on the source file dated 28th November 2024 12:10 Europe/London time.