[pmwiki-users] PmWiki 2.2-beta12 - UpdatePage() released

Crisses crisses at kinhost.org
Wed Oct 4 14:28:10 CDT 2006


On Oct 4, 2006, at 12:47 PM, The Editor wrote:

>
> Uh, help? I just downloaded the latest beta (12) and tried rewriting
> my setpage function which is the only place doing file saves.  And I'm
> getting this message:
>
> PmWiki can't process your request
> Cannot write page to (wiki.d/)...changes not saved
> We are sorry for any inconvenience.

That's a problem with the server, not PmWiki.

Check permissions on wiki.d -- is this a new installation?  You don't  
seem to have permissions to add a new file to the folder.

> Here's the function written mostly with cut and pastes from Crisses
> input.  Any thoughts anyone?
>
> function SetPage() {
> 	global $WorkDir, $data, $log, $_POST, $DataKey;
> 	$d = $DataKey.$_POST[datapage];
> 	$oldpage = ReadPage($d);
> 	$newpage = $oldpage;
> 	$newpage['text'] = "(:comment data:) \n\n$data(:comment data:)
> \n\n[[#Log]] \n\n$log(:comment data:) \n\n";

Toss an
print_r($newpage);
here, so you can check what you're sending.  There will probably only  
be 3 or 4 items in $newpage set if $oldpage didn't exist (i.e. even  
if the page doesn't exist, ReadPage has output).

Note -- this does NOT have anything to do with the server error  
reported above.

> 	UpdatePage($pagename, $oldpage, $newpage);
> 	return;
> 	}
>
> Any help that anyone could give would be appreciated.  BTW, will this
> work if a page is not yet created also?

It works to start new wiki pages.

> Or will I have to do
> conditionals and have two methods for saving?

No.

> In this case the page
> does exist.

that should be fine.  I know: I've used it to add new pages ;)

Crisses





More information about the pmwiki-users mailing list