Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento: What's the use of Mage_Core_Block_Flush (core/flush) block?

Tags:

php

magento

It looks like this block directly flushes the output.

What's the practical use of this block? How can I use it?

Did anybody ever use it?

like image 854
Alex Avatar asked Dec 11 '25 09:12

Alex


1 Answers

It's not used by the core (afaik). It turns off output buffering, so the rendered output would be sent immediately. The only block where it would kind of work would be the root block, otherwise the nested core/flush block and all following blocks would be rendered before the containing outer blocks.

I can't think of a sensible use case. Since the front controller is responsible for sending the output to the client, the core/flush block breaks his process. In the worst case it could lead to PHP Headers already sent notices.

I don't know, but my guess is it is a relict from the pre-release days of Magento, where the whole rendering system wasn't finalized yet. Probably seemed like a good idea at the time.
Maybe someone who was with the core team at the time can enlighten us about the history.

like image 107
Vinai Avatar answered Dec 12 '25 22:12

Vinai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!