'MediaWiki\\Interwiki\\ClassicInterwikiLookup' => __DIR__ . '/includes/interwiki/ClassicInterwikiLookup.php',
'MediaWiki\\Interwiki\\InterwikiLookup' => __DIR__ . '/includes/interwiki/InterwikiLookup.php',
'MediaWiki\\Interwiki\\InterwikiLookupAdapter' => __DIR__ . '/includes/interwiki/InterwikiLookupAdapter.php',
+ 'MediaWiki\\Interwiki\\NullInterwikiLookup' => __DIR__ . '/includes/interwiki/NullInterwikiLookup.php',
'MediaWiki\\Languages\\Data\\CrhExceptions' => __DIR__ . '/languages/data/CrhExceptions.php',
'MediaWiki\\Languages\\Data\\Names' => __DIR__ . '/languages/data/Names.php',
'MediaWiki\\Languages\\Data\\ZhConversion' => __DIR__ . '/languages/data/ZhConversion.php',
* @file
* @ingroup Deployment
*/
+
+use MediaWiki\Interwiki\NullInterwikiLookup;
use MediaWiki\MediaWikiServices;
use MediaWiki\Shell\Shell;
$installerConfig = self::getInstallerConfig( $defaultConfig );
// Reset all services and inject config overrides
- MediaWiki\MediaWikiServices::resetGlobalInstance( $installerConfig );
+ MediaWikiServices::resetGlobalInstance( $installerConfig );
// Don't attempt to load user language options (T126177)
// This will be overridden in the web installer with the user-specified language
Language::getLocalisationCache()->disableBackend();
// Disable all global services, since we don't have any configuration yet!
- MediaWiki\MediaWikiServices::disableStorageBackend();
+ MediaWikiServices::disableStorageBackend();
+ $mwServices = MediaWikiServices::getInstance();
// Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and
// SqlBagOStuff will then throw since we just disabled wfGetDB)
- $wgObjectCaches = MediaWikiServices::getInstance()->getMainConfig()->get( 'ObjectCaches' );
+ $wgObjectCaches = $mwServices->getMainConfig()->get( 'ObjectCaches' );
$wgMemc = ObjectCache::getInstance( CACHE_NONE );
+ // Disable interwiki lookup, to avoid database access during parses
+ $mwServices->redefineService( 'InterwikiLookup', function () {
+ return new NullInterwikiLookup();
+ } );
+
// Having a user with id = 0 safeguards us from DB access via User::loadOptions().
$wgUser = User::newFromId( 0 );
RequestContext::getMain()->setUser( $wgUser );
--- /dev/null
+<?php
+/**
+ * Copyright (C) 2018 Kunal Mehta <legoktm@member.fsf.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+namespace MediaWiki\Interwiki;
+
+/**
+ * An interwiki lookup that has no data, intended
+ * for use in the installer.
+ *
+ * @since 1.31
+ */
+class NullInterwikiLookup implements InterwikiLookup {
+
+ /**
+ * @inheritDoc
+ */
+ public function isValidInterwiki( $prefix ) {
+ return false;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function fetch( $prefix ) {
+ return false;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getAllPrefixes( $local = null ) {
+ return [];
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function invalidateCache( $prefix ) {
+ }
+}