[pmwiki-users] PmWiki 2.2-beta12 - UpdatePage() released
Patrick R. Michaud
pmichaud at pobox.com
Fri Oct 6 19:33:31 CDT 2006
On Fri, Oct 06, 2006 at 05:44:26PM -0500, The Editor wrote:
> On 10/6/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> > On Fri, Oct 06, 2006 at 02:38:11PM +0200, Thomas -Balu- Walter wrote:
> > > On Wed, Oct 04, 2006 at 02:50:38PM -0500, Patrick R. Michaud wrote:
> > > > The UpdatePage line should probably read
> > > >
> > > > UpdatePage($d, $oldpage, $newpage);
> > >
> > > Just being curious: What's the reason for $oldpage?
> > it seemed to make more sense to have the caller pass the
> > page structure just read to UpdatePage, instead of requiring
> > UpdatePage to perform a second read on top of the first one.
> It's not a big deal to me either way, but thought I'd mention the same
> question crossed my mind. I initially assumed this function would
> simply resave the same page--with any new changes. IE--read page,
> change page[text] or page[title], then update the same page. Using
> two page variables seemed a rather counterintuitive, and unnecessaily
> complex way to do it.
> If you did it this way you wouldn't have to do a second file read
> either (eh, unless to make the diff?).
Oh, I suppose that's a somewhat different way to look at UpdatePage().
Currently UpdatePage assumes that whatever you pass as the $newpage
argument is _everything_ you want to have saved in the new page,
not just the new things you want saved. I suppose it could be
done the other way.
But for almost all of the things that I'm planning to do with
UpdatePage, I'll need to know the current contents of the page
before I can figure out what the new contents should be (e.g.,
inserting or adding text to an existing page). So, I have to
read the page before ever calling UpdatePage, and it seems
odd to require UpdatePage to do another read on top of that.
More information about the pmwiki-users