[pmwiki-users] Markup engine global improvement

Patrick R. Michaud pmichaud at pobox.com
Wed Jul 6 09:41:28 CDT 2005


On Wed, Jul 06, 2005 at 04:19:49PM +0200, Joachim Durchholz wrote:
> I wouldn't object to wrapping parts of PmWiki into classes, *but only if 
> that gives us a concrete advantage*. 
> ...
> PageStore is the one exception where stuff was wrapped into a class. 

Exactly true.  The advantages of using classes for PageStore was 
polymorphism and inheritance -- it provided an easy way to abstract
out the basic operations on the storage from the storage mechanism
itself.  In general I find that OO approaches decrease maintainability
for programmers who don't understand OO.

> It 
> turned out that the class is missing an important abstraction, namely 
> page renames. Writing a variation of that class would break at least the 
> Rename recipe.

Why do you claim this?  AFAICT the rename recipe uses ReadPage() and 
WritePage(), the same as the rest of PmWiki (and as it should).  
The generic approach for renaming a page is

    function RenamePage($oldname, $newname) {
      global $WikiDir;
      $page = ReadPage($oldname);            # read old page
      WritePage($newname, $page);            # save with new name
      $WikiDir->delete($oldname);            # remove old page
    }

and this should work with any PageStore instance.

Pm



More information about the pmwiki-users mailing list