/**
     * @param int $contentObjectId
     * @return boolean[]
     */
    public static function getClusterVisibilities($contentObjectId)
    {
        $clusters = ClusterTool::globCluster();
        $visibilities = array();

        foreach( $clusters as $cluster )
        {
            $visibilities[$cluster] = !ObjectVisibilityManager::isClusterLimited( $contentObjectId, $cluster );
        }

        return $visibilities;
    }
    /**
     * @param array $row
     */
    public static function updateNodeVisibility($row)
    {
        /* @type $node eZContentObjectTreeNode */
        $comment      = "";
        $db           = eZDB::instance();
        $pendingBased = !isset($row['manual']);
        $nodeId       = (int)$row['param'];
        $delete       = true;
        $nodeFetch    = eZContentObjectTreeNode::fetch( $nodeId );

        if ( !($nodeFetch instanceof eZContentObjectTreeNode) )
            $comment = "Not found in eZ Publish";
        else
        {
            $node = $nodeFetch->findMainNode($nodeFetch->attribute('contentobject_id'), true);

            if ($node)
            {
                if ($node->object()->ClassIdentifier == 'article')
                {
                    $toHideResults = self::nodeHasForbiddenWords($node, $row);

                    foreach ($toHideResults as $cluster => $toHideResult)
                    {
                        if ($toHideResult['toHide'])
                        {
                            ObjectVisibilityManager::updateClusterLimitation(
                                $node->attribute('contentobject_id'),
                                $cluster,
                                true
                            );
                        }
                        else
                        {
                            $parentIsInvisible = false;

                            if ($node->attribute('depth') > 4)
                            {
                                $parentNode        = $node->fetchParent();
                                $parentIsInvisible = ObjectVisibilityManager::isClusterLimited(
                                    $parentNode->attribute('contentobject_id'),
                                    $cluster
                                );
                            }

                            if ($parentIsInvisible)
                            {
                                ObjectVisibilityManager::updateClusterLimitation(
                                    $node->attribute('contentobject_id'),
                                    $cluster,
                                    false
                                );
                            }
                            else
                            {
                                ObjectVisibilityManager::removeClusterLimitation(
                                    $node->attribute('contentobject_id'),
                                    $cluster
                                );
                            }
                        }

                        if (!$toHideResult['toDelete'])
                        {
                            $delete = false;
                        }

                        $comment .= sprintf(";Cluster : %s - Message : %s", $cluster, $toHideResult['comment']);
                    }
                }
            }
            else
            {   // node does not exist in ez - we delete the pending row
                $comment = "Not found in eZ Publish";
            }
        }

        if( $delete && $pendingBased )
            $db->query( sprintf( "DELETE FROM ezpending_actions WHERE id = %d", $row['id'] ) );

        eZLog::write( "RowId : {$row['id']}; Node : $nodeId $comment", 'updatevisibility.log' );

        unset( $node );
        eZContentObject::clearCache();
    }