#!/bin/sh

set -e

case "$1" in
  install|upgrade)
    if dpkg --compare-versions "$2" lt "2.2.3.dfsg-2.4"; then
      # Make sure the new Moodle can install its files in yui - #689506
      if [ -h /usr/share/moodle/lib/yui ] ; then
        rm -f /usr/share/moodle/lib/yui
      fi
    fi
    if dpkg --compare-versions "$2" lt "2.5.1-1"; then
      # Remove directories we're going to replace with symlinks
      if [ -d /usr/share/moodle/lib/adodb ]; then
        rm -rf /usr/share/moodle/lib/adodb
      fi
      if [ -d /usr/share/moodle/lib/htmlpurifier/HTMLPurifier ]; then
        rm -rf /usr/share/moodle/lib/htmlpurifier/HTMLPurifier
      fi
    fi
  ;;
esac

#DEBHELPER#
