This makes sure that folders are moved to trash when deleted with rmdir() instead of unlink(). This happens for example when deleting a folder over WebDAV. The web UI uses unlink() so it wasn't affected.