Last modified: 2007-01-08 19:29:10 UTC
I'd like to submit a patch which would allow to use the mediawiki-Parser independent from a database-server. We're developing a wikipedia-offline-reader (http://woc.fslab.de) and we need the mediawiki-parser to generate the installation-package. If we could integrate a small patch (essentially a few special cases with a global variable $wgNoDBMode), then this would make it significantly easier to use our generation-tools.
diff -ru mediawiki_svn/includes/Parser.php mediawiki_sa2/includes/Parser.php --- mediawiki_svn/includes/Parser.php 2007-01-01 20:14:56.000000000 +0100 +++ mediawiki_sa2/includes/Parser.php 2007-01-01 20:21:23.000000000 +0100 @@ -4011,6 +4011,11 @@ $query .= $dbr->addQuotes( $this->mLinkHolders['dbkeys'][$key] ); } } + + // support wgNoDBMode + if ( !empty($GLOBALS['wgNoDBMode']) ) + $query = 0; + if ( $query ) { $query .= '))'; if ( $options & RLH_FOR_UPDATE ) { diff -ru mediawiki_svn/includes/Setup.php mediawiki_sa2/includes/Setup.php --- mediawiki_svn/includes/Setup.php 2007-01-01 20:14:56.000000000 +0100 +++ mediawiki_sa2/includes/Setup.php 2007-01-01 20:29:03.000000000 +0100 @@ -49,7 +49,8 @@ $wgIP = false; # Load on demand # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor -$wgRequest = new WebRequest; +if ( empty($GLOBALS['wgNoDBMode']) ) # support wgNoDBMode + $wgRequest = new WebRequest; if ( function_exists( 'posix_uname' ) ) { $wguname = posix_uname(); $wgNodeName = $wguname['nodename']; diff -ru mediawiki_svn/includes/StubObject.php mediawiki_sa2/includes/StubObject.php --- mediawiki_svn/includes/StubObject.php 2007-01-01 20:14:56.000000000 +0100 +++ mediawiki_sa2/includes/StubObject.php 2007-01-01 20:41:25.000000000 +0100 @@ -89,7 +89,9 @@ function _newObject() { global $wgContLanguageCode, $wgRequest, $wgUser, $wgContLang; - $code = $wgRequest->getVal('uselang', $wgUser->getOption('language') ); + // supprt wgNoDBMode + if ( empty($GLOBALS['wgNoDBMode']) ) + $code = $wgRequest->getVal('uselang', $wgUser->getOption('language') ); // if variant is explicitely selected, use it instead the one from wgUser // see bug #7605 diff -ru mediawiki_svn/includes/Title.php mediawiki_sa2/includes/Title.php --- mediawiki_svn/includes/Title.php 2007-01-01 20:14:56.000000000 +0100 +++ mediawiki_sa2/includes/Title.php 2007-01-01 21:06:24.000000000 +0100 @@ -917,7 +917,7 @@ // FIXME: this causes breakage in various places when we // actually expected a local URL and end up with dupe prefixes. - if ($wgRequest->getVal('action') == 'render') { + if (empty($GLOBALS['wgNoDBMode']) and $wgRequest->getVal('action') == 'render') { # support wgNoDBMode $url = $wgServer . $url; } }
Created attachment 2998 [details] proposed patch for "noDBmode" This is exactly the patch I just posted as a comment. Sorry, I didn't know about the "attachment" feature ;-)
Ultimately, I don't think this is something we'd ever want to support in the core code. If you're only using a MediaWiki installation to generate the parsed content, then you could maintain the hack locally.