Volunteer:Development/DabbleDB integration

From Gospel Translations

Revision as of 19:05, 22 August 2008 by Mahra (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to:navigation, search

In order for Gospel Translations to stay well organized with minimal load on volunteers, we needed to find a way to automate the insertion of the "About this Resource" box into articles.

How it works

0. All of our article information and activity records are stored in an online database at DabbleDB, which produces real-time data exports for us upon request.

1. A cronjob runs every 5 minutes on our web server to import the most up-to-date information from DabbleDB. It arrives in text format like this:

10 Reasons Why I Am Thankful for the God-Breathed Bible
Resource: 10 Reasons Why I Am Thankful for the God-Breathed Bible
Resource » Book/series: Taste and See
Resource » Author: John Piper
Resource » Second Author: None
Resource » Publisher: Desiring God
Resource » Topic: Spiritual Growth
Resource » Subtopic: The Bible
Resource » Media Type: Article
Resource » Date: November 20, 2006
Resource » Sort Order: 0
Translator: Zo Tin Khuma
Language: Burmese
Review Status: Not Reviewed

2. When the data is imported, it gets pushed through a PHP script that breaks it into a multidimensional array and saves it to a flat file using PHP's serialize function, in this format:

$db[ Language ][ Article Title ][ attribute ] => value

For instance

$db['Spanish']['Gospel Implications']['Publisher'] => "Ligonier Ministries"

3. Meanwhile, every article or book on our wiki calls a template, {{Info}}. The {{Info}} template figures out the language ($resLang) and title ($res) of the article and runs our custom parser function, {{#ib:}}. So this call

$db[ $resLang ][ $res ]['Publisher']

will return the publisher of the given article.

4. {{#ib:}} tries to find $db[ $resLang ][ $res ], and if successful it returns the code for the "About this Resource" box (including several [[Category:xx]] tags to help the wiki sort its content).

...and that is how the info automation with DabbleDB works.

Navigation
Volunteer Tools
Other Wikis
Toolbox