/**
     * @see eZContentObjectEditHandler::publish()
     * @param int $contentObjectID
     * @param eZContentObjectVersion $contentObjectVersion
     */
    function publish( $contentObjectID, $contentObjectVersion )
    {
        $contentObject = eZContentObject::fetch( $contentObjectID );

        if( $contentObject instanceof eZContentObject )
        {
            switch($contentObject->ClassIdentifier)
            {
                case 'article':
                {
                    ObjectVisibilityManager::updateGlobalLimitation($contentObject);

                    /* @type $mainNode eZContentObjectTreeNode */
                    /* @type $clustersToHide array */
                    $db                 = eZDB::instance();
                    $mainNode           = $contentObject->mainNode();
                    $clustersToHide     = eZINI::instance( 'merck.ini' )->variable( 'PublishSettings', 'clustersToHide' );
                    $publisherNodeId    = PublisherFolderTool::getPublisherNodeIdFromArticleNode($mainNode);
                    $publisherInfo      = PublisherFolderTool::getNodeIdToPathMapping($publisherNodeId);
                    $publisherClusters  = PublisherFolderTool::getClustersFromPath($publisherInfo['path']);
                    $inserted           = false;
                    
                    foreach( $clustersToHide as $clusterToHide )
                    {
                        if( in_array($clusterToHide, $publisherClusters) )
                        {
                            if ( !$inserted )
                            {
                                $db->query( sprintf(
                                    "INSERT INTO ezpending_actions (action, created, param)
                                        VALUES ('check_node_visibility', %d, '%s' )",
                                    time(),
                                    $contentObject->mainNodeID()
                                ));
                                $inserted = true;
                            }
                            
                            ObjectVisibilityManager::updateClusterLimitation($contentObjectID, $clusterToHide, true);
                        }
                    }
                }
                break;
            }
        }
    }
    /**
     * @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();
    }