[pmwiki-users] Properties

Patrick R. Michaud pmichaud at pobox.com
Tue Dec 13 15:24:54 CST 2005


On Tue, Dec 13, 2005 at 10:16:57PM +0100, Sebastian Siedentopf wrote:
> 
> Am 13.12.2005 um 21:33 schrieb Patrick R. Michaud:
> >$SaveProperties would be intended only for those properties that
> >are stored in the markup (i.e., it's part of the edit sequence).
> >Other scripts that wish to store properties in page files can
> >already do this by calling WritePage directly.  PmWiki doesn't
> >remove page attributes unless explicitly told to do so somehow.
> 
> This answers the question, but how knows PmWiki about this?
> 
> For example I use the property A with
> 
> 	$page['A']= 'foo';
> 	WritePage(...,$page);
> 
> in my own script (never with the property markup) and a property B on  
> the page with
> 
> 	(:property B=value:)
> 
> Now I delete the markup
> 
> 	(:property B=value:)
> 
> from the page. So property B will be deleted when I save the page  
> again. But how does PmWiki knows, that property A wasn't on the page  
> before (I think a diff for every property is really slow)? This was  
> my only concern. But if it works, I'm fine.

Any attribute listed in $SaveProperties comes from properties set by
markup (i.e., "B" in your example above).  All other attributes, 
such as "A" above, are left alone.  The code is basically:

    global $Properties; 
    foreach($SaveProperties as $prop) {
      if (isset($Properties[$prop])) $new[$prop] = $Properties[$prop];
      else unset($new[$prop]);
    }

which only unsets those properties listed in $SaveProperties and
that weren't set somehow in the processing of the page.  

Pm




More information about the pmwiki-users mailing list