[pmwiki-devel] UpdatePage() and warnings
Petko Yotov
5ko at free.fr
Wed Nov 8 05:04:03 CST 2006
> > So, how can I postpone the UpdatePage() call after the markup
> > rules are
> > loaded?.
...
> If you saw my other post about this subject, what you want to do is
> delay the calling of this code until later.
>
> #1 Move it all into a function.
> #2 figure out a method of delay.
>
> If you want this to run automatically, I suggest you do something
> like the following in your cookbook module:
>
> $stamp = intval(@filemtime("$WorkDir/.textcopied"));
> $now = time();
> if($now - $stamp > 60*60*24)
> {
> register_shutdown_function("SwapPages", getcwd())
> }
>
> function SwapPages($dir = NULL) {
> // disable for testing!!
> // ignore_user_abort();
> if ($dir) { flush(); chdir($dir); }
> foreach($MyListOfPages as $mypage)
> {
> CopyPageText($mypage, 'Main.INBOX');
> }
> touch("$WorkDir/.textcopied");
> ...
> }
>
> And make sure you look at all of PM's notes to Caveman about how to
> properly execute register_shutdown_function.
>
> The nice thing about this is that the user won't have to wait a long
> time for their browser to reload.
>
> Be careful about testing before you disable user abort, however.
>
> Crisses
Thank you for your answers, Crisses. I read your message yesterday but I
actually wish this to be done automatically, without anyone having to
call .../pmwiki.php?action=copy.
I'll see if it can be done with register_shutdown_function(), otherwise, I
have safe_mode so ignore_user_abort() will not work. Anyway, there will be
usually one only page to copy per day which is fast, and there is no need to
ignore_user_abort(), unless there are no visits for months.
Thanks for your kind comments, I'll test it tonight and will tell you if it
worked.
Petko
More information about the pmwiki-devel
mailing list