[Pmwiki-users] Re: Re: Re: Organization of pages (was: Hierarchical groups)

Patrick R. Michaud pmichaud
Thu Jun 17 12:50:30 CDT 2004


On Thu, Jun 17, 2004 at 08:16:06PM +0200, chr at home.se wrote:
> On Thu, 17 Jun 2004, Patrick R. Michaud wrote:
> 
> > On Thu, Jun 17, 2004 at 12:02:05PM +0200, chr at home.se wrote:
> > > 
> > > Great, that's really all I'm asking for at the moment. (Well, and that 
> > > the ID is increased each time a new page is created, which requires an 
> > > additional file to keep track of the ID of the last created page)
> > 
> > Actually, I wasn't going to do it that way, but rather use the time
> > ($Now) that the page is first created as the unique ID.  Since PmWiki 
> > doesn't (or won't) allow two pages to be created at the same time,
> > this number will always be unique.
> 
> What's the resoultion of $Now? If it's one second I'm not sure it's
> enough. 

It's one second, and that's *plenty* enough.  Essentially the code is

    if (!isset($page['ID'])) {
      $page['ID']=time(); sleep(1);
    }

and the "sleep" ensures that no other page can possibly get the
same ID.  Keep in mind that by this point PmWiki has already blocked
other processes from being able to edit/create pages so that two
pages cannot be edited/created at the same time, thus the next creation
has to occur at least one second later.

Pm



More information about the pmwiki-users mailing list