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_resource_nodes_multi()

Description

Delete all node relationships matching the passed resource IDs and node IDs.

Parameters

ColumnTypeDefaultDescription
$resources array array An array of resource IDs
$nodes mixed array An integer or array of single/multiple nodes

Return

void

Location

include/node_functions.php lines 1594 to 1617

Definition

 
function delete_resource_nodes_multi($resources=array(),$nodes=array())
    {
    global 
$lang;
    if(!
is_array($nodes))
        {
$nodes=array($nodes);}

    
$resource_chunks array_chunk($resourcesSYSTEM_DATABASE_IDS_CHUNK_SIZE);
    
$node_chunks array_chunk($nodesSYSTEM_DATABASE_IDS_CHUNK_SIZE);
    
$done=0;
    foreach (
$resource_chunks as $resource_chunk)
        {
        if (
PHP_SAPI !== "cli") {
            
set_processing_message(str_replace(["[done]","[total]"],[$done,count($resources)],$lang["processing_updating_resources"]));
        }
        
$done+=count($resource_chunk);

        foreach (
$node_chunks as $node_chunk)
            {
            
$sql "DELETE FROM resource_node WHERE resource in (" ps_param_insert(count($resource_chunk)) . ") AND node in (" ps_param_insert(count($node_chunk)) . ")";
            
$params array_merge(ps_param_fill($resource_chunk"i"), ps_param_fill($node_chunk"i"));
            
ps_query($sql$params);
            }
        }
    }

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.