/**
 * Sets application localized url to NULL and sets its visibility as private
 * @param int $appId Id of application to be hidden
 * @param string $clusterIdentifier Identifier of cluster
 * @param eZDBInterface $db db to be used
 * @param eZCLI $cli command line to be used
 * @param boolean $dryRun Decides whether queries should be outputed to CLI or be used to update the DB
 */
function hideFromApplicationLocalized( $appId, $clusterIdentifier, eZDBInterface $db, eZCLI $cli, $dryRun = false )
{
    global $appId, $clusterIdentifier, $db, $eZDB, $cli, $dryRun;
    
    $update = sprintf( "UPDATE mm_application_localized
                            SET url = NULL, restriction_level = 'private'
                            WHERE application_id='%s' AND cluster_identifier='%s'", 
                        $db->escapeString($appId),
                        $db->escapeString($clusterIdentifier) );
    if ( !$dryRun )
    {
        $db->query( $update );
    }
    else
    {
        $cli->output( $update );
    }
}
function setClusterFrontendUrlData(array $clusterDomains, eZDBInterface $db, eZCLI $cli, $dumpSql)
{
    $db->beginQuery();
    foreach ($clusterDomains as $clusterIdentifier => $url)
    {
        $query = sprintf("UPDATE bo_cluster SET frontend_url = '%s' WHERE identifier='%s';", $url, $clusterIdentifier);
        if ($dumpSql) {
            $cli->notice($query);
            continue;
        }
        $cli->notice("Setting frontend_url to {$url} for cluster {$clusterIdentifier}");
        $db->query($query);
    }
    return $db->commitQuery();
}