CONTRIB-4745 :: a better fix, compatible with moodle 2.6

Signed-off-by: Joseph Rézeau <moodle@rezeau.org>