[pmwiki-users] Can PmWiki pages be populated using a database like Mongo DB?

Petko Yotov 5ko at 5ko.fr
Sun Sep 24 04:35:29 CDT 2017


Yes, PmWiki can potentially use anything for data storage, be it plain 
text, JSON, XML and/or gzipped files or any database (SQLite, MySQL, 
LDAP, etc.), or even thin air.

You only need to write a new class that extends the core PageStore class 
and redefine the functions exists(), read(), write(), delete() and ls() 
to return the page names and attributes in the format expected by PmWiki 
(associative arrays).

Your PHP installation will probably require a set of MongoDB compatible 
functions among:

   http://php.net/manual/en/set.mongodb.php
   http://php.net/manual/en/book.mongo.php
   http://php.net/manual/en/class.mongoclient.php

You should also enable UTF-8 in PmWiki before you start: the PHP 
functions to encode and decode JSON data are very unreliable if the data 
is not valid UTF-8 (you get blank/empty values):

   http://www.pmwiki.org/wiki/PmWiki/UTF-8


The following add-ons create and use a custom PageStore class, see if 
they can inspire you:

   http://www.pmwiki.org/wiki/Cookbook/CompressedPageStore (gz)
   http://www.pmwiki.org/wiki/Cookbook/PageTopStore (2 copies)
   http://www.pmwiki.org/wiki/Cookbook/Phonebook (LDAP)
   http://www.pmwiki.org/wiki/Cookbook/SessionPageStore (thin air)
   http://www.pmwiki.org/wiki/Cookbook/SQLite (sqlite)
   http://www.pmwiki.org/wiki/Cookbook/XMLPageStore (xml)

The SQLite recipe page also shows how one would install in config.php 
such a PageStore class with or without keeping any existing core PmWiki 
or custom PageStore classes.

Petko

-- 
PmWeekly Blog  :  http://www.pmwiki.org/News
If you upgrade :  http://www.pmwiki.org/Upgrades


On 2017-09-22 21:29, Mckenzie Mae Weller wrote:
> I'm working on a project and we'd like to set up our site in a wiki 
> format
> (such as through PmWiki), but need to populate the wiki pages using 
> data
> from a Mongo DB database, or something similar, that will host a number 
> of
> JSON files.
> 
> Is this something that could be doable, and if so, are their any 
> examples /
> tutorial-esque documentation out there to help me get started?



More information about the pmwiki-users mailing list