Perform time-consuming tasks after flushing output to user


Is there an easy, recommended and elegant way in Yii, to flush the html output to the client, close the connection, and keep doing stuff that requires a lot of processing? (while still accessing models, writing logs and the like)

I’ve already done that in plain PHP but now I need to do that in a Yii-based application without loosing the advantages of using the framework…

thanks in advance


Take a look at the extension runactions.

Thanks, seems exactly what I was looking for

Oh my god nooooooooooooooo, it is not!

ERunAction’s way to “perform an action in background” is to perform an httprequest to the server (itself) without waiting for the response.

That may be useful in some situations, but calling it "performing an action in the background" is quite misleading.

What I need is to flush the output to the user, close the connection, and continue doing stuff, WITHOUT generating a new request!!

I know how to do it in plain PHP, but I need to do it within Yii…