Zend MVC flush during execution
I am trying to figure out how to mimic the Bugzilla sanity check output, where Bugzilla is checking various references in database to look for logic flaws. After each check, the result is flushed to the client. (The full set of tests can take a while). In the result, there is also a link which triggers 'repairs' to any issue that comes up. This is useful to get before the entire (slow) set of tests has completed.
Handling errors would be an issue, when headers are already sent, but my assumption here is that after the first database check is complete, it's safe to flush the result. The idea is to have this as an admin only feature, and any开发者_JAVA技巧 error after the first check completes would be useful to output in the order it occurs in any case, to resolve any issues with the database.
How can I accomplish this using Zend MVC?
I am trying to figure out how to mimic the Bugzilla sanity check output, where Bugzilla is checking various references in database to look for logic flaws
Bugzilla uses a non-standard extension to MIME, called multipart/x-mixed-replace
. It is not supported on all clients, IE in particular.
How can I accomplish this using Zend MVC?
Not without ignoring most of the framework's tools, no. In particular, you'd need to push out headers and content yourself, avoiding the use of automatic helpers.
This sounds like a job for Gearman. You can set up your long-running process as a worker, and have it continually send status information and partial data. You can then consume the status and partial data and deliver the latest progress to users via simple ajax polling, something that should fit right in to your existing code.
Or you can just fire and forget and tell the client to come back later for the final processed result.
精彩评论