The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to use php sleep function in vb
Hi,
I want to use sleep function in the installation code of the plugin, however i cannot display any message before the function. Everything is being displayed at the end of the installation process. Example: echo test; flush(); ob_flush(); vbflush(); sleep(2); echo test; die(); It returns testtest after two minutes and i want to display test and after two minutes another test message. I tried to use all kind of flush functions, but none of the above worked. Any idea how I can do that? |
#2
|
|||
|
|||
I believe the issue is that if you have "GZIP HTML Output" set to yes (under "Cookies and HTTP Header Options" in the admincp options), then ob_start() is called before there's any output (which is of course the only way it can be gzip'd before it's sent). It's the same for all the control panel pages, I think. So I think maybe what you could do is something like: (Edit: I removed the code because the code above already calls ob_flush(), and in any case the right thing to do is call vbflush as Paul posted below.)
But I wonder what happens if the web server is set to gzip output? If so, maybe you'll have the same problem even after doing this. Edit: But I just noticed that you were calling ob_flush(), so if buffering were the problem it seems like that should have done it. So maybe the issue *is* that your web server is buffering. I did a little more research and it looks like if mod_gzip or mod_deflate is configured to compress that type of output, then it will be buffered. (I'm not sure what content-type is sent if you don't explicitly set a header). |
#3
|
||||
|
||||
I use a similar setup with vbulletin gzip off but server gzip on without problem.
|
#4
|
|||
|
|||
That's good to know. But I wonder what happens in that case? Does the server somehow decide not to gzip it? Or maybe it does it in parts? I guess I'll have to experiment when I get a chance.
|
#5
|
||||
|
||||
I think its a case of when the gzip is executed as opposed to server files with that level of call. Here's some info http://www.gzip.org/README.mvs
|
#6
|
|||
|
|||
I just noticed that the first post does show a call to ob_flush(), so I guess my response about output buffering doesn't make sense.
|
#8
|
|||
|
|||
Hi Guys,
I tried to call vbflush(); and that didn't solve my problem. GZIP HTML Output in admin panel is set to no. What i have now is: echo $message . "<br />\r\n"; vbflush(); sleep(2); Any other ideas? |
#9
|
|||
|
|||
Did you try just making a non-vb php script and see if that works? My understanding is that the web server and even the browser could be buffering output so that what you're trying to do won't work.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|