Page MenuHomePhabricator

new extension: "Offline" database driver reads articles.xml.bz2
Closed, ResolvedPublic

Description

extension source code

Starting with others peoples' work, I wrote this in the hope that standalone MW installations will become commonplace.

Any help would be appreciated, with mediawiki.org hosting and posting especially.

Great work!

-Adam Wight


Version: unspecified
Severity: enhancement
URL: http://www.mediawiki.org/wiki/Extension:Offline

attachment Offline-0.5.tar.gz ignored as obsolete

Details

Reference
bz27580

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:25 PM
bzimport set Reference to bz27580.
bzimport added a subscriber: Unknown Object (MLST).

Neat!

See http://www.mediawiki.org/wiki/Manual:Developing_extensions#Publishing_your_extension regarding publishing on mediawiki.org

If you want to host your extension in our SVN repository (which will allow it to benefit from localisation and other developers' attention), you can apply for commit access: http://www.mediawiki.org/wiki/Commit_access

A few nitpicks after looking at code:

  • We don't use ?> - it helps nothing and can lead to hard to track bugs if someone leaves whitespace after it
  • You don't need to split i18n messages into two files
  • Message keys should have an unique prefix, such as offline_ to avoid possible conflicts with other extensions
  • APC functions are not available on every PHP installation, check with function_exists() first
  • Why are you disabling other databases unconditionally?

Great point about the database, I will look into it. The goal I've set for myself is to have a hybrid live/bz2 system which could do useful things like display local edits, then batch upload them to a DVCS when the net is back, etc... so what level are you suggesting I hook in at?

It might require small changes in mediawiki to drop the accelerator cache requirement, and I can imagine further changes which would open many possibilities for useful data source plugins. As an example, there is a master/slave concept wrapped around many (363) separate db calls, not the sort of thing to be hardcoded into core logic in the first place.

I haven't looked at your code, so the answer may be there.

I like your idea, but I wonder if you could use this to load pages into the local DB as they are viewed. Then edits could be performed and merged with the main repository when you can go "online". This would make MediaWiki into a sort of DVCS for editing.

Created attachment 8184
extension source code

Attached:

Thanks to Max Semenik for some good ideas--most of his suggestions are corrected in the attached files. A new pseudo-driver "DatabaseBz2" can be configured as either the primary or the fallback data source.

However, a mediawiki bug (or my error) is preventing the retrieved article from being displayed when this extension is set as the secondary, and the primary db cannot open a connection. Strange. The workaround is to change the db insertion at the end of Offline.php from

$wgDBservers[] = array(

to a replacement:

$wgDBservers[0] = array(

Have fun!

-Adam

sumanah wrote:

Adam, did you end up applying for commit access? As far as I can tell, your extension is not available in the MediaWiki SVN repository. So please do apply and put it in there, as Max suggested in comment 1.

https://www.mediawiki.org/wiki/Commit_access_requests#Requesting_commit_access