[3.2][ticket/12487] Remove legacy code

This PR replaces #2404.

https://tracker.phpbb.com/browse/PHPBB3-12487

PHPBB3-12487