[pmwiki-users] Suggestion for a Page object

Patrick R. Michaud pmichaud at pobox.com
Fri Apr 8 18:02:15 CDT 2005


On Fri, Apr 08, 2005 at 06:50:00PM -0400, Martin Fick wrote:
> > I only went with classes for PageStore
> > objects because I needed the virtual method capabilities that
> > were there (which I don't think I need yet for pages).
> 
> I'm not sure what you mean by 'virtual' methods?

Oh.  The virtual methods are the part that allow ReadPage($pagename)
to work even though the underlying PageStore objects may be of different
types.

>   Yes, I was thinking that too.  Would obscuring pagefile
> inside of a Page object not correct this?  i.e. any
> functions needing access to the page date would go through
> Page and not even know that it's in a file, it could be in
> a DB.

Perhaps, but then what's the advantage to making pagefile available 
at all to the external world, if it's all hidden inside of the Page
object?  (More specifically, why would PageList ever need to know/use
the pagefile attribute?)

>   That would be very nice. It would be good to be able to
> load things on demand, even the 'text'.  A while ago we
> talked about being able to include sections of pages in the
> pagelist, this would be very usefull here.  Loading the
> text for all pages in FmtPgeList, regardless of whether it 
> is needed or not, would not be a good thing.  

Well, this is why FmtPageList would do the text via separate
reads of the page file -- including sections of pages is
almost by definition going to be a little on the slow side.
In this particular case caching the page doesn't do us much
good anyway, because when we include page sections we're going
to have to check its authorizations/permissions anyway, and
that requires reading a different (i.e., slower) function than 
PageRead anyway.

>   This part right here is the 'evil' part that I'm trying 
> to avoid in FmtPageList():
> 
>     $matches[] = array(
>       'pagename' => $pagefile,
>       'size' => strlen(@$page['text']),
>       'author' => @$page['author'],
>       'time' => $page['time']);
>   }
> [...]

As you might guess, that 'evil' part was written before PCache
existed, and it's waiting for the grand-pagelist-rewrite to be
fixed up.  :-)

Pm



More information about the pmwiki-users mailing list