[pmwiki-users] Tweak to saving a page

Peter Lutz dreiaugen at gmx.de
Fri Feb 13 06:08:51 CST 2009


Hi,

I would like to have a special saving behaviour for some $group.$name combinations. This is for conflict management when using pmwiki to fill a database with several users. 

I want pmwiki to always save as the next page in queue not yet existent.

Example:
"Assume a page Querygroup.5 and 3 users A,B and C click a button to make and edit Querygroup.6. A drops and he is not saving anything. B saves first and his page becomes Querygroup.6, C saves last and his page becomes Querygroup.7."

Is there already a recipe for this?

If not, please read on and give me some help.

In the pmwiki.php I found the function exists($pagename). It's just a wild guess that it's the right function, but I'll use as an example of how I thought to incoporate the tweak.

  function exists($pagename) {
    if (!$pagename) return false;
    $pagefile = $this->pagefile($pagename);
    return ($pagefile && file_exists($pagefile));

--into-->

  function exists($pagename) {
    if ($pagename[$Group] == $GlobalSaveTweak) && (integer($pagename[$Name])) {
      while $pagename[$Name] <= $pagefile[$Name] {
        $pagename[$Name] = $pagename[$Name]+1;
        }
    if (!$pagename) return false;
    $pagefile = $this->pagefile($pagename);
    return ($pagefile && file_exists($pagefile));

As you perhaps can see I don't really know php. I just hope there is a place to do something like this. And can $GlobalSaveTweak be an array?

peter



More information about the pmwiki-users mailing list