fixed profiling; fixed wfMsg() use of memcached; put block log in initialdata.sql
[lhc/web/wiklou.git] / includes / Setup.php
1 <?
2 # The main wiki script and things like database
3 # conversion and maintenance scripts all share a
4 # common setup of including lots of classes and
5 # setting up a few globals.
6 #
7
8 global $IP;
9 include_once( "$IP/GlobalFunctions.php" );
10 include_once( "$IP/Namespace.php" );
11 include_once( "$IP/Skin.php" );
12 include_once( "$IP/OutputPage.php" );
13 include_once( "$IP/DifferenceEngine.php" );
14 include_once( "$IP/SearchEngine.php" );
15 include_once( "$IP/User.php" );
16 include_once( "$IP/LinkCache.php" );
17 include_once( "$IP/Title.php" );
18 include_once( "$IP/Article.php" );
19 include_once( "$IP/MagicWord.php" );
20 include_once( "$IP/MemCachedClient.inc.php" );
21 include_once( "$IP/Block.php" );
22
23 global $wgUser, $wgLang, $wgOut, $wgTitle;
24 global $wgArticle, $wgDeferredUpdateList, $wgLinkCache;
25 global $wgMemc, $wgMagicWords, $wgMwRedir, $wgDebugLogFile;
26
27 class MemCachedClientforWiki extends MemCachedClient {
28 function _debug( $text ) {
29 wfDebug( "memcached: $text\n" );
30 }
31 }
32
33 $wgMemc = new MemCachedClientforWiki();
34 if( $wgUseMemCached ) {
35 $wgMemc->set_servers( $wgMemCachedServers );
36 $wgMemc->set_debug( $wgMemCachedDebug );
37
38 # Test it to see if it's working
39 if ( $wgDebugLogFile && !$wgMemc->set( "test", "", 0 ) ) {
40 wfDebug( "Memcached error: " . $wgMemc->error_string() . "\n" );
41 }
42 }
43
44 include_once( "$IP/Language.php" );
45
46 $wgOut = new OutputPage();
47 wfDebug( "\n\n" );
48
49 $wgLangClass = "Language" . ucfirst( $wgLanguageCode );
50 if( ! class_exists( $wgLangClass ) ) {
51 include_once( "$IP/LanguageUtf8.php" );
52 $wgLangClass = "LanguageUtf8";
53 }
54 $wgLang = new $wgLangClass();
55
56 if( !isset( $wgProfiling ) )
57 $wgProfiling = false;
58
59 if ( $wgProfiling ) {
60 include_once( "$IP/Profiling.php" );
61 } else {
62 function wfProfileIn( $fn ) {}
63 function wfProfileOut( $fn = "" ) {}
64 function wfGetProfilingOutput( $s, $e ) {}
65 function wfProfileClose() {}
66 }
67
68 $wgUser = User::loadFromSession();
69 $wgDeferredUpdateList = array();
70 $wgLinkCache = new LinkCache();
71 $wgMagicWords = array();
72 $wgMwRedir =& MagicWord::get( MAG_REDIRECT );
73 ?>