Has anyone ever considered integrating mediawiki with svn (subversion) so that editors could use svn to check out, edit, and commit pages?
I maintain a number of small mediawiki sites for business use. I want to use my favorite editor (emacs) to edit pages. But I don't want just one-page-at-a-time editing. I want to work with a number of pages concurrently, possibly editing them over hours or days, and write them back to the wiki only when they are ready. In other words, to work with pages just like I work with code.
I can do some of this with third-party tools like Perl's CMS::Mediawiki or with WikipediaFS. But even then I have no easy way to merge the latest changes from the wiki with my files, or to see what changes I've made, or to see version history, etc. In other words, I want all the features of a real version control client like svn.
Imagine:
% cd /path/to/my/wiki
# Download all new pages and changes from the wiki # Obviously not something you could do with wikipedia.com :) - but great for small-to-medium wikis % svn update
# See what pages I've modified % svn status
# Compare my modifications to the server's versions % svn diff
# Add a few new pages % svn add System_functions.wk User_API.wk
# Commit all my changes % svn commit
So. My crazy idea is to modify mediawiki (or write a mediawiki plugin) to keep a svn repository in sync with mediawiki's own page version database.
Here's a rough outline of how this might work.
In the mediawiki code:
* When a new wiki is created, create an empty svn repository in a configurable directory. The repository could be configured to use a single flat directory (for small wikis), or an alphabetical hierarchical directory A/, B/, C/ (for larger wikis). Each wiki page will be represented by a file named like "The_page_title.wk".
* Whenever a new page is created via the web site, "svn add" a new .wk file in the repository.
* Whenever a new version of an existing page is saved via the website, also modify the file in the server's svn repository and "svn commit" it.
And in an svn commit hook:
* Whenever a new page is added, issue a web request (or a command- line php script) to create it in mediawiki's database too.
* Whenever a change is committed, issue a web request (or a command- line php script) to make that change in mediawiki's database too.
Same with delete, rename, etc. Whatever happens to the mediawiki database needs to happen to svn, and vica versa.
Caveats: I don't have an in-depth knowledge of the mediawiki php code so I don't know how centralized functions are, e.g. if there a single place in the code where pages get added, saved, and deleted. And I might be vastly underestimating how easy it is to keep these two datastores in sync.
Feedback, pointers, references to similar work, or gentle explanations of why I'm insane are greatly appreciated.
Thanks for reading this far :), Jon
On 06/06/07, Jonathan Swartz swartz@pobox.com wrote:
Has anyone ever considered integrating mediawiki with svn (subversion) so that editors could use svn to check out, edit, and commit pages?
If you want to try to hack such a creature together, Svnwiki might be useful for cues:
http://en.wikipedia.org/wiki/Svnwiki
- d.
On Jun 6, 2007, at 4:43 AM, David Gerard wrote:
On 06/06/07, Jonathan Swartz swartz@pobox.com wrote:
Has anyone ever considered integrating mediawiki with svn (subversion) so that editors could use svn to check out, edit, and commit pages?
If you want to try to hack such a creature together, Svnwiki might be useful for cues:
Thanks! I hadn't seen that, it will definitely be useful.
So I take it you haven't heard of any official plans to do this before? Just don't want to reinvent the wheel.
Jon
mediawiki-l@lists.wikimedia.org