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

get_nodes_use_count()

Description

Get a count of how many resources are using the specified nodes

Parameters

ColumnTypeDefaultDescription
$nodes array Array of node refs

Return

array Array of node ref as keys and number of resources using them as the values

Location

include/node_functions.php lines 2600 to 2614

Definition

 
function get_nodes_use_count(array $nodes)
    {
    
$nodes array_filter($nodes'is_int_loose');
    if(empty(
$nodes))
        {
        return [];
        }

    
$nodes_use_count ps_query(
        
'SELECT node, COUNT(node) AS `use_count` FROM resource_node WHERE node IN (' ps_param_insert(count($nodes)) . ') GROUP BY node',
        
ps_param_fill($nodes'i')
    );

    return 
array_column($nodes_use_count'use_count''node');
    }

This article was last updated 17th November 2024 15:05 Europe/London time based on the source file dated 28th October 2024 11:15 Europe/London time.