#!/bin/bash

if [ "$(CreoleGet activer_apache)" = 'oui' ];then
    # gestion des modes apache
    ENMOD="ssl rewrite authnz_ldap"
    DISMOD=""
    # gestion des cas particuliers (rpaf: #2570, jappix: #3151)
    if [ "$(CreoleGet activer_web_behind_revproxy)" = 'oui' ];then
        ENMOD="$ENMOD rpaf"
    else
        DISMOD="$DISMOD rpaf"
    fi
    if [ "$(CreoleGet activer_jappix non)" = 'oui' ];then
        ENMOD="$ENMOD proxy headers proxy_http"
    fi
    if [ "$(CreoleGet activer_eoleapps non)" = 'oui' ];then
        ENMOD="$ENMOD proxy headers proxy_http"
    fi
    CreoleRun "a2enmod $ENMOD >/dev/null" web
    [ ! -z $DISMOD ] && CreoleRun "a2dismod $DISMOD >/dev/null" web
    # activation de l'exension PHP mcrypt (#12922)
    if [ -f "$(CreoleGet container_path_web)/etc/php5/mods-available/mcrypt.ini" ];then
        CreoleRun "php5enmod mcrypt" web
    fi
fi

exit 0
