[pmwiki-devel] UpdatePage() and warnings
Petko Yotov
5ko at free.fr
Tue Nov 7 12:33:38 CST 2006
On Tuesday 07 November 2006 15:16, you wrote:
> On Sat, Nov 04, 2006 at 01:23:59AM +0100, Petko Yotov wrote:
> > I am using pmwiki-2.2.0-beta15 an I am trying to copy a page content into
> > another page. I always get these errors:
> >
> > Warning: array_keys() [function.array-keys]: The first argument should be
> > an array in .../pmwiki.php on line 1458
> >
> > Warning: array_values() [function.array-values]: The argument should be
> > an array in .../pmwiki.php on line 1459
> >
> > Warning: preg_replace() [function.preg-replace]: Empty regular expression
> > in .../pmwiki.php on line 1459
> >
> > Here is my function (adapted from
> > http://www.pmwiki.org/wiki/Cookbook/DebuggingForCookbookAuthors ):
> >
> > function CopyPageText($sourcename, $targetname)
> > {
> > $source = RetrieveAuthPage($sourcename,"edit");
> > if (!$source) { return; }
> >
> > $dest = RetrieveAuthPage($targetname,"edit");
> > if (!$dest) { return; }
> >
> > $newdest = $dest;
> > $newdest['text'] .= "\n".$source['text'];
> >
> > UpdatePage($targetname, $dest, $newdest);
> > }
> > CopyPageText( 'Main.HomePage', 'Main.WikiSandbox');
>
> When is this function being called? It looks to me as
> though it's being called prior to any of the markup rules
> being loaded (and UpdatePage() really wants to occur
> after the markup rules are loaded).
>
> Pm
Hello,
I would like to call it once per day. I have a list of pages to be checked and
moved into a sort of "Inbox", if their content is outdated. So, there is a
file "$WorkDir/.textcopied" that is touched after the function call:
(simplified)
$stamp = intval(@filemtime("$WorkDir/.textcopied"));
$now = time();
if($now - $stamp > 60*60*24)
{
foreach($MyListOfPages as $mypage)
{
CopyPageText($mypage, 'Main.INBOX');
}
touch("$WorkDir/.textcopied");
}
That is in a cookbook-type file called from config.php.
So, how can I postpone the UpdatePage() call after the markup rules are
loaded?
Thanks,
Petko
More information about the pmwiki-devel
mailing list