Rewrite clean-up-lanaguages.sh in PHP