flush() doesn't work in page context, we need to use $wgOut