#!/bin/sh

OLD_PHP="php8.1"
MODULES="alias auth_basic authn_file authz_host authz_user autoindex deflate dir env negotiation status php8.4"

if [ -f /usr/share/eole/creole/dicos/20_web.xml ]
then
    # Purge rc packages
    CreoleRun "dpkg-query -f='\${Status}\t\${Package}\n' -W  \"*${OLD_PHP}*\"| awk  '/deinstall ok config-files/ {system(\"apt remove -y --purge \" \$4)}'" web
    CreoleRun "a2dismod ${OLD_PHP}" web
    if CreoleRun "dpkg --no-pager -l apache2 > /dev/null 2>&1" web; then
        # Enable required modules
        CreoleRun "a2enmod ${MODULES}" web
    fi
fi

exit 0
