[pmwiki-devel] UpdatePage() and warnings
Crisses
crisses at kinhost.org
Tue Nov 7 08:43:51 CST 2006
On Nov 7, 2006, at 9:16 AM, Patrick R. Michaud wrote:
>> 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).
I'd change this to:
$CopyPageFrom = 'Main.HomePage';
$CopyPageTo = 'Main.WikiSandbox';
function CopyPageText()
{
global $CopyPageFrom, $CopyPageTo;
$source = RetrieveAuthPage($CopyPageFrom,"edit");
if (!$source) { return; }
$dest = RetrieveAuthPage($CopyPageTo,"edit");
if (!$dest) { return; }
$newdest = $dest;
$newdest['text'] .= "\n".$source['text'];
UpdatePage($CopyPageTo, $dest, $newdest);
}
HandleAction['copy'] = "CopyPageText";
Then call http://path.to/wiki/Main/WikiSandbox?action=copy
Crisses
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-devel/attachments/20061107/14887676/attachment-0001.html
More information about the pmwiki-devel
mailing list