<?php
+/**
+ * Include most things that's need to customize the site
+ * @package MediaWiki
+ */
-# This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
-if( defined( "MEDIAWIKI" ) ) {
+/**
+ * This file is not a valid entry point, perform no further processing unless
+ * MEDIAWIKI is defined
+ */
+if( defined( 'MEDIAWIKI' ) ) {
# The main wiki script and things like database
# conversion and maintenance scripts all share a
# Set up Memcached
#
require_once( 'memcached-client.php' );
+
+ /**
+ *
+ * @package MediaWiki
+ */
class MemCachedClientforWiki extends memcached {
function _debugprint( $text ) {
wfDebug( "memcached: $text\n" );
$wgMemc->set_servers( $wgMemCachedServers );
$wgMemc->set_debug( $wgMemCachedDebug );
+ $messageMemc = &$wgMemc;
+} elseif ( $wgUseTurckShm ) {
+ # Turck shared memory
+ #
+ require_once( 'ObjectCache.php' );
+ $wgMemc = new TurckBagOStuff;
$messageMemc = &$wgMemc;
} else {
+ /**
+ * No shared memory
+ * @package MediaWiki
+ */
class FakeMemCachedClient {
function add ($key, $val, $exp = 0) { return true; }
function decr ($key, $amt=1) { return null; }
$wgLoadBalancer->loadMasterPos();
wfProfileOut( $fname.'-database' );
+wfProfileIn( $fname.'-User' );
+
+# Extension setup functions
+# Entries should be added to this variable during the inclusion
+# of the extension file. This allows the extension to perform
+# any necessary initialisation in the fully initialised environment
+foreach ( $wgSkinExtensionFunctions as $func ) {
+ $func();
+}
+
+if( $wgCommandLineMode ) {
+ # Used for some maintenance scripts; user session cookies can screw things up
+ # when the database is in an in-between state.
+ $wgUser = new User();
+} else {
+ $wgUser = User::loadFromSession();
+}
+
+// FIXME : we don't know what the user entered (see SpecialPreferences.php [AV])
+if( count( $wgUserLanguages ) &&
+ !empty( $wgUser->mOptions['language'] ) &&
+ in_array( $wgUser->mOptions['language'], $wgUserLanguages ) ) {
+ // Change language of the site
+ $wgUserLanguageCode = $wgUser->mOptions['language'];
+ // we will load messages from file instead of from database
+ $wgUseDatabaseMessages = false;
+ # FIXME: THIS WILL BREAK NAMESPACES, VARIABLES,
+ # SEARCH INDEX UPDATES, AND MANY MANY THINGS.
+ # DO NOT USE THIS MODE EXCEPT FOR TESTING RIGHT NOW.
+}
+
+wfProfileOut( $fname.'-User' );
wfProfileIn( $fname.'-language' );
require_once( 'languages/Language.php' );
-$wgMessageCache = new MessageCache;
+$wgMessageCache = new MessageCache;
-$wgLangClass = 'Language' . ucfirst( $wgLanguageCode );
+$wgLangClass = 'Language' . str_replace( '-', '_', ucfirst( $wgLanguageCode ) );
if( ! class_exists( $wgLangClass ) || ($wgLanguageCode == 'en' && !$wgUseLatin1) ) {
# Default to English/UTF-8
require_once( 'languages/LanguageUtf8.php' );
unset( $wgLang );
$wgLang = $xxx;
}
+
+// now that we have a language object, set per language user defaults options
+// if we didn't grabbed them from database.
+if(!$wgUser->mDataLoaded) { $wgUser->loadDefaultFromLanguage(); }
+// and change the messages array used
+
+if(isset($wgUserLanguageCode)) {
+ /** Need to load the language datas */
+ require_once( 'languages/Language'.str_replace('-', '_', ucfirst( $wgUserLanguageCode )).'.php');
+ $sitemsgarray = 'wgAllMessages'.ucfirst($wgLanguageCode);
+ $usermsgarray = 'wgAllMessages'.str_replace('-', '_', ucfirst( $wgUserLanguageCode ));
+ $$sitemsgarray = &$$usermsgarray;
+ // rebuild the language object messages
+ $wgLang->Language();
+}
+
+
+
wfProfileOut( $fname.'-language' );
wfProfileIn( $fname.'-MessageCache' );
$wgBlockCache = new BlockCache( true );
wfProfileOut( $fname.'-BlockCache' );
-wfProfileIn( $fname.'-User' );
-
-if( $wgCommandLineMode ) {
- # Used for some maintenance scripts; user session cookies can screw things up
- # when the database is in an in-between state.
- $wgUser = new User();
-} else {
- $wgUser = User::loadFromSession();
-}
-
-wfProfileOut( $fname.'-User' );
wfProfileIn( $fname.'-misc2' );
$wgDeferredUpdateList = array();