[PHP] How to handle actions that may take a long time?

2005-02-27 Thread Cajus Pollmeier
Hi there,
I'd like to know your opinion about how to handle events that may take 
more than a minute to finish in PHP. In this case,  the code is 
performing a recursive action on a large LDAP tree where I'd like to 
present something like a status page ("Please wait, blah blah" with 
some animated gif or so), while the action takes place in background.

Is it possible to fork away this PHP code and set some SESSION vars to 
trigger the end of the status page? Or do I have to put this action 
behind a one pixel image and act when the page is "really" complete? 
Also I'm not sure how to handle the script execution timeout problem...

Any ideas/hints? Some feedback would be appreciated ;-)
Cheers,
Cajus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to handle actions that may take a long time?

2005-03-01 Thread Cajus Pollmeier
Am Dienstag, 1. März 2005 01:24 schrieb Richard Lynch:
> Cajus Pollmeier wrote:
> > I'd like to know your opinion about how to handle events that may take
> > more than a minute to finish in PHP. In this case,  the code is
> > performing a recursive action on a large LDAP tree where I'd like to
> > present something like a status page ("Please wait, blah blah" with
> > some animated gif or so), while the action takes place in background.
> >
> > Is it possible to fork away this PHP code and set some SESSION vars to
> > trigger the end of the status page? Or do I have to put this action
> > behind a one pixel image and act when the page is "really" complete?
> > Also I'm not sure how to handle the script execution timeout problem...
>
> Do you really expect the user wants to sit there for all the time waiting
> for the process to finish?

Yes. Should be the case, because later actions would depend on a changed data 
set. In this case I'm renaming entries of a complete subtree. This may last a 
long time and should not be abortable in any way. While this may change the 
data the user is working on, he/she should wait till it is completed.

> Is there ANY way to factor out that code and do it before they get there?
> Obviously not for a search where the user types in what they want, but is
> that what you are doing?  You don't say; I can't guess.

See above.

> Basically, if I have to sit there waiting, then I'm not really all that
> impressed with an animated gif or whatever...

Not you. But most people are not impressed by a spinning gear, globe or 
whatever your browser shows up.

> Perhaps you have them logged in already, and you could record their search
> parameters and assign it an ID, and perform the search in the background,
> and then have a page to deliver the results to later.

I'm not sure how I could fork away a PHP process to be not interruptible, or 
behave like you're writing above.

Just thinking about a session thingie. Place a little iframe on the page which 
reloads once a second and check a session variable if we're finished. If we 
are, reload the parent page.

Thanks,
Cajus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to handle actions that may take a long time?

2005-03-01 Thread Cajus Pollmeier
Am Dienstag, 1. März 2005 09:14 schrieb [EMAIL PROTECTED]:
> You can send a piece of HTML defining some little thing like a div layer
> with your "please wait, bla bla bla"
> So the visitor can read something.
> When the process is finished, you can write another piece of HTML
> containing some JavaScript lines, changing the text (and icons or
> images) so you can inform your visitor that the process had finished.

If it's possible I'd like to avoid js ;-)

> This is the clasical no end web page... You can do something similar
> with frames, so in a little frame the visitor can see the status,
> (searching, wait...) and in another big frame can do something usefull.

I'm going to evaluate some things...

Thanks,
Cajus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php