kernel/content/ezcontentoperationcollection.php
static public function deleteObject( $deleteIDArray, $moveToTrash = false )
    {
        $ini = eZINI::instance();
        $aNodes = eZContentObjectTreeNode::fetch( $deleteIDArray );
        if( !is_array( $aNodes ) )
        {
            $aNodes = array( $aNodes );
        }

        $delayedIndexingValue = $ini->variable( 'SearchSettings', 'DelayedIndexing' );
        if ( $delayedIndexingValue === 'enabled' || $delayedIndexingValue === 'classbased' )
        {
            $pendingActionsToDelete = array();
            $classList = $ini->variable( 'SearchSettings', 'DelayedIndexingClassList' ); // Will be used below if DelayedIndexing is classbased
            $assignedNodesByObject = array();
            $nodesToDeleteByObject = array();

            foreach ( $aNodes as $node )
            {
                $object = $node->object();
                $objectID = $object->attribute( 'id' );
                $assignedNodes = $object->attribute( 'assigned_nodes' );
                // Only delete pending action if this is the last object's node that is requested for deletion
                // But $deleteIDArray can also contain all the object's node (mainly if this method is called programmatically)
                // So if this is not the last node, then store its id in a temp array
                // This temp array will then be compared to the whole object's assigned nodes array
                if ( count( $assignedNodes ) > 1 )
                {
                    // $assignedNodesByObject will be used as a referent to check if we want to delete all lasting nodes
                    if ( !isset( $assignedNodesByObject[$objectID] ) )
                    {
                        $assignedNodesByObject[$objectID] = array();

                        foreach ( $assignedNodes as $assignedNode )
                        {
                            $assignedNodesByObject[$objectID][] = $assignedNode->attribute( 'node_id' );
                        }
                    }

                    // Store the node assignment we want to delete
                    // Then compare the array to the referent node assignment array
                    $nodesToDeleteByObject[$objectID][] = $node->attribute( 'node_id' );
                    $diff = array_diff( $assignedNodesByObject[$objectID], $nodesToDeleteByObject[$objectID] );
                    if ( !empty( $diff ) ) // We still have more node assignments for object, pending action is not to be deleted considering this iteration
                    {
                        continue;
                    }
                }

                if ( $delayedIndexingValue !== 'classbased' ||
                     ( is_array( $classList ) && in_array( $object->attribute( 'class_identifier' ), $classList ) ) )
                {
                    $pendingActionsToDelete[] = $objectID;
                }
            }

            if ( !empty( $pendingActionsToDelete ) )
            {
                $filterConds = array( 'param' => array ( $pendingActionsToDelete ) );
                eZPendingActions::removeByAction( 'index_object', $filterConds );
            }
        }

        // Add assigned nodes to the clear cache list
        // This allows to clear assigned nodes separately (e.g. in reverse proxies)
        // as once content is removed, there is no more assigned nodes, and http cache clear is not possible any more.
        // See https://jira.ez.no/browse/EZP-22447
        foreach ( $aNodes as $node )
        {
            eZContentCacheManager::addAdditionalNodeIDPerObject( $node->attribute( 'contentobject_id' ), $node->attribute( 'node_id' ) );
        }
        eZContentObjectTreeNode::removeSubtrees( $deleteIDArray, $moveToTrash );
        return array( 'status' => true );
    }
static public function deleteObject( $deleteIDArray, $moveToTrash = false )
    {
        $ini = eZINI::instance();
        $aNodes = eZContentObjectTreeNode::fetch( $deleteIDArray );
        if( !is_array( $aNodes ) )
        {
            $aNodes = array( $aNodes );
        }

        $delayedIndexingValue = $ini->variable( 'SearchSettings', 'DelayedIndexing' );
        if ( $delayedIndexingValue === 'enabled' || $delayedIndexingValue === 'classbased' )
        {
            $pendingActionsToDelete = array();
            $classList = $ini->variable( 'SearchSettings', 'DelayedIndexingClassList' ); // Will be used below if DelayedIndexing is classbased
            $assignedNodesByObject = array();
            $nodesToDeleteByObject = array();

            foreach ( $aNodes as $node )
            {
                $object = $node->object();
                $objectID = $object->attribute( 'id' );
                $assignedNodes = $object->attribute( 'assigned_nodes' );
                // Only delete pending action if this is the last object's node that is requested for deletion
                // But $deleteIDArray can also contain all the object's node (mainly if this method is called programmatically)
                // So if this is not the last node, then store its id in a temp array
                // This temp array will then be compared to the whole object's assigned nodes array
                if ( count( $assignedNodes ) > 1 )
                {
                    // $assignedNodesByObject will be used as a referent to check if we want to delete all lasting nodes
                    if ( !isset( $assignedNodesByObject[$objectID] ) )
                    {
                        $assignedNodesByObject[$objectID] = array();

                        foreach ( $assignedNodes as $assignedNode )
                        {
                            $assignedNodesByObject[$objectID][] = $assignedNode->attribute( 'node_id' );
                        }
                    }

                    // Store the node assignment we want to delete
                    // Then compare the array to the referent node assignment array
                    $nodesToDeleteByObject[$objectID][] = $node->attribute( 'node_id' );
                    $diff = array_diff( $assignedNodesByObject[$objectID], $nodesToDeleteByObject[$objectID] );
                    if ( !empty( $diff ) ) // We still have more node assignments for object, pending action is not to be deleted considering this iteration
                    {
                        continue;
                    }
                }

                if ( $delayedIndexingValue !== 'classbased' ||
                     ( is_array( $classList ) && in_array( $object->attribute( 'class_identifier' ), $classList ) ) )
                {
                    $pendingActionsToDelete[] = $objectID;
                }
            }

            if ( !empty( $pendingActionsToDelete ) )
            {
                $filterConds = array( 'param' => array ( $pendingActionsToDelete ) );
                eZPendingActions::removeByAction( 'index_object', $filterConds );
            }
        }

        // Add assigned nodes to the clear cache list
        // This allows to clear assigned nodes separately (e.g. in reverse proxies)
        // as once content is removed, there is no more assigned nodes, and http cache clear is not possible any more.
        // See https://jira.ez.no/browse/EZP-22447
        foreach ( $aNodes as $node )
        {
            eZContentCacheManager::addAdditionalNodeIDPerObject( $node->attribute( 'contentobject_id' ), $node->attribute( 'node_id' ) );
        }
        eZContentObjectTreeNode::removeSubtrees( $deleteIDArray, $moveToTrash );
        return array( 'status' => true );
    }
static public function deleteObject ( $ deleteIDArray , $ moveToTrash = false ) { $ ini = eZINI :: instance ( ) ; $ aNodes = eZContentObjectTreeNode :: fetch ( $ deleteIDArray ) ; if ( ! is_array ( $ aNodes ) ) { $ aNodes = array ( $ aNodes ) ; } $ delayedIndexingValue = $ ini -> variable ( 'SearchSettings' , 'DelayedIndexing' ) ; if ( $ delayedIndexingValue === 'enabled' || $ delayedIndexingValue === 'classbased' ) { $ pendingActionsToDelete = array ( ) ; $ classList = $ ini -> variable ( 'SearchSettings' , 'DelayedIndexingClassList' ) ; // Will be used below if DelayedIndexing is classbased $ assignedNodesByObject = array ( ) ; $ nodesToDeleteByObject = array ( ) ; foreach ( $ aNodes as $ node ) { $ object = $ node -> object ( ) ; $ objectID = $ object -> attribute ( 'id' ) ; $ assignedNodes = $ object -> attribute ( 'assigned_nodes' ) ; // Only delete pending action if this is the last object's node that is requested for deletion // But $deleteIDArray can also contain all the object's node (mainly if this method is called programmatically) // So if this is not the last node, then store its id in a temp array // This temp array will then be compared to the whole object's assigned nodes array if ( count ( $ assignedNodes ) > 1 ) { // $assignedNodesByObject will be used as a referent to check if we want to delete all lasting nodes if ( ! isset ( $ assignedNodesByObject [ $ objectID ] ) ) { $ assignedNodesByObject [ $ objectID ] = array ( ) ; foreach ( $ assignedNodes as $ assignedNode ) { $ assignedNodesByObject [ $ objectID ] [ ] = $ assignedNode -> attribute ( 'node_id' ) ; } } // Store the node assignment we want to delete // Then compare the array to the referent node assignment array $ nodesToDeleteByObject [ $ objectID ] [ ] = $ node -> attribute ( 'node_id' ) ; $ diff = array_diff ( $ assignedNodesByObject [ $ objectID ] , $ nodesToDeleteByObject [ $ objectID ] ) ; if ( ! empty ( $ diff ) ) // We still have more node assignments for object, pending action is not to be deleted considering this iteration { continue ; } } if ( $ delayedIndexingValue !== 'classbased' || ( is_array ( $ classList ) && in_array ( $ object -> attribute ( 'class_identifier' ) , $ classList ) ) ) { $ pendingActionsToDelete [ ] = $ objectID ; } } if ( ! empty ( $ pendingActionsToDelete ) ) { $ filterConds = array ( 'param' => array ( $ pendingActionsToDelete ) ) ; eZPendingActions :: removeByAction ( 'index_object' , $ filterConds ) ; } } // Add assigned nodes to the clear cache list // This allows to clear assigned nodes separately (e.g. in reverse proxies) // as once content is removed, there is no more assigned nodes, and http cache clear is not possible any more. // See https://jira.ez.no/browse/EZP-22447 foreach ( $ aNodes as $ node ) { eZContentCacheManager :: addAdditionalNodeIDPerObject ( $ node -> attribute ( 'contentobject_id' ) , $ node -> attribute ( 'node_id' ) ) ; } eZContentObjectTreeNode :: removeSubtrees ( $ deleteIDArray , $ moveToTrash ) ; return array ( 'status' => true ) ; }
Deletes a content object, or a list of content objects

@param array $deleteIDArray
@param bool $moveToTrash

@return array An array with operation status, always true
Deletes a content object or a list of content objects