#!/bin/sh
CONFIG_PATH="/usr/syno/etc/packages/WebStation"
CONFIG_FILES="WebStation.json VirtualHost.json PHPSettings.json"
PHP_CONFIG_DIRS="php56 php70"

if [ "$SYNOPKG_PKG_STATUS" != UPGRADE ]; then
	for dir in ${PHP_CONFIG_DIRS}; do
		if [ -d "${CONFIG_PATH}/${dir}" ]; then
			/usr/bin/rm -r "${CONFIG_PATH:?}/${dir:?}"
		fi
	done
	if [ -L /usr/local/etc/suphp ]; then
		/usr/bin/rm -r /usr/local/etc/suphp
	fi

	if [ -f /usr/syno/numanod/conf/conf_webstation_php ]; then
		/usr/bin/rm /usr/syno/numanod/conf/conf_webstation_php
	fi
fi
exit 0
