[Pmwiki-users] PmWikiDataStore - Using a class for page file i/o.

Patrick R. Michaud pmichaud
Sun Mar 21 23:18:33 CST 2004


On Sun, Mar 21, 2004 at 09:17:17PM -0800, Greg Morgan wrote:
> 
>    [1]http://www.pmichaud.com/wiki/Development/PmWikiDataStore
>    I've  just  finished  a  patch  for  PmWiki  that  I was hoping to get
>    included in the next release.

More comments--

I probably sent my previous message a bit prematurely and need to
think about the overall approach a bit more before rejecting the OO
approach outright.  However, one other item that probably needs to be 
considered in changing PmWiki's storage model is that it should be possible
for a single site to access pages from a variety of storage
mechanisms and not be restricted to a single medium.  For example, 
a site could use an SQL backend for some pages but still 
seamlessly access the pages that are stored as files in wiki.d, 
wikilib.d, and other custom directories that may have created.  
This makes it much easier to convert a site from one storage medium
to another without having to do a lot of page conversions.

My expectation has been that $WikiDir and $WikiLibDirs could grow 
smarter to allow someone to specify places other than file directories 
to look; i.e., one could do something like:

   $WikiDir = 'sql:PmWikiTable';
   $WikiLibDirs = array(&$WikiDir,'wikilib.d');

and the existing ReadPage/WritePage would call other user-supplied
functions based on the string type.  On the other hand, taking
an OO-based model we could potentially do something like:

   $WikiDir = new FBStore('wiki.d');
   $WikiLibDirs = array(&$WikiDir,new FBStore('wikilib.d');

with ReadPage(), WritePage(), etc., calling methods of $WikiDir and
$WikiLibDirs.  Then, when an SQL-based model is available, one can do:

   $WikiDir = new SQLStore('PmWikiTable');
   $WikiLibDirs = 
     array($&WikiDir,new FBStore('wiki.d'),new FBStore('wikilib.d'));

and all of the sites existing pages in wiki.d continue to work with 
new edits being stored in the SQL table.

This is also important so that people will continue to be able to
get the latest pages from wikilib.d/ when upgrading, and so we
won't need lots of admin scripts/functions to import/export pages 
between formats.

Pm



More information about the pmwiki-users mailing list