r14516 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14515‎ | r14516 | r14517 >
Date:08:19, 1 June 2006
Author:brion
Status:old
Tags:
Comment:
Revert to r14512; domas introduced massive breakage with incomplete experimental changes. They will be recommitted when they work. :)
Modified paths:
  • /trunk/phase3/includes/AjaxDispatcher.php (modified) (history)
  • /trunk/phase3/includes/AjaxFunctions.php (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/AutoLoader.php (deleted) (history)
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/CacheManager.php (modified) (history)
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/Credits.php (modified) (history)
  • /trunk/phase3/includes/Database.php (modified) (history)
  • /trunk/phase3/includes/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/DatabasePostgreSQL.php (modified) (history)
  • /trunk/phase3/includes/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Export.php (modified) (history)
  • /trunk/phase3/includes/ExternalStoreDB.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/HistoryBlob.php (modified) (history)
  • /trunk/phase3/includes/HttpFunctions.php (modified) (history)
  • /trunk/phase3/includes/Image.php (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/LinksUpdate.php (modified) (history)
  • /trunk/phase3/includes/LoadBalancer.php (modified) (history)
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/includes/Math.php (modified) (history)
  • /trunk/phase3/includes/MessageCache.php (modified) (history)
  • /trunk/phase3/includes/ObjectCache.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/ParserXML.php (modified) (history)
  • /trunk/phase3/includes/Profiling.php (modified) (history)
  • /trunk/phase3/includes/ProxyTools.php (modified) (history)
  • /trunk/phase3/includes/QueryPage.php (modified) (history)
  • /trunk/phase3/includes/RawPage.php (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/SearchEngine.php (modified) (history)
  • /trunk/phase3/includes/SearchMySQL.php (modified) (history)
  • /trunk/phase3/includes/SearchMySQL4.php (modified) (history)
  • /trunk/phase3/includes/SearchTsearch2.php (modified) (history)
  • /trunk/phase3/includes/SearchUpdate.php (modified) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/SpecialBlockme.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/includes/SpecialRecentchanges.php (modified) (history)
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/includes/SpecialVersion.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/UpdateClasses.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/WebRequest.php (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AutoLoader.php
@@ -1,223 +0,0 @@
2 -<?php
3 -
4 -/* This defines autoloading handler for whole MediaWiki framework */
5 -function __autoload($class_name) {
6 - $classes = array(
7 - 'AjaxDispatcher' => 'AjaxDispatcher.php',
8 - 'AjaxCachePolicy' => 'AjaxFunctions.php',
9 - 'Article' => 'Article.php',
10 - 'AuthPlugin' => 'AuthPlugin.php',
11 - 'BagOStuff' => 'BagOStuff.php',
12 - 'HashBagOStuff' => 'BagOStuff.php',
13 - 'SqlBagOStuff' => 'BagOStuff.php',
14 - 'MediaWikiBagOStuff' => 'BagOStuff.php',
15 - 'TurckBagOStuff' => 'BagOStuff.php',
16 - 'APCBagOStuff' => 'BagOStuff.php',
17 - 'eAccelBagOStuff' => 'BagOStuff.php',
18 - 'Block' => 'Block.php',
19 - 'CacheManager' => 'CacheManager.php',
20 - 'CategoryPage' => 'CategoryPage.php',
21 - 'Categoryfinder' => 'Categoryfinder.php',
22 - 'RCCacheEntry' => 'ChangesList.php',
23 - 'ChangesList' => 'ChangesList.php',
24 - 'OldChangesList' => 'ChangesList.php',
25 - 'EnhancedChangesList' => 'ChangesList.php',
26 - 'DBObject' => 'Database.php',
27 - 'Database' => 'Database.php',
28 - 'DatabaseMysql' => 'Database.php',
29 - 'ResultWrapper' => 'Database.php',
30 - 'OracleBlob' => 'DatabaseOracle.php',
31 - 'DatabaseOracle' => 'DatabaseOracle.php',
32 - 'DatabasePgsql' => 'DatabasePostgreSQL.php',
33 - 'DatabasePostgreSQL' => 'DatabasePostgreSQL.php',
34 - 'DateFormatter' => 'DateFormatter.php',
35 - 'DifferenceEngine' => 'DifferenceEngine.php',
36 - '_DiffOp' => 'DifferenceEngine.php',
37 - '_DiffOp_Copy' => 'DifferenceEngine.php',
38 - '_DiffOp_Delete' => 'DifferenceEngine.php',
39 - '_DiffOp_Add' => 'DifferenceEngine.php',
40 - '_DiffOp_Change' => 'DifferenceEngine.php',
41 - '_DiffEngine' => 'DifferenceEngine.php',
42 - 'Diff' => 'DifferenceEngine.php',
43 - 'MappedDiff' => 'DifferenceEngine.php',
44 - 'DiffFormatter' => 'DifferenceEngine.php',
45 - '_HWLDF_WordAccumulator' => 'DifferenceEngine.php',
46 - 'WordLevelDiff' => 'DifferenceEngine.php',
47 - 'TableDiffFormatter' => 'DifferenceEngine.php',
48 - 'EditPage' => 'EditPage.php',
49 - 'Exif' => 'Exif.php',
50 - 'FormatExif' => 'Exif.php',
51 - 'WikiExporter' => 'Export.php',
52 - 'XmlDumpWriter' => 'Export.php',
53 - 'DumpOutput' => 'Export.php',
54 - 'DumpFileOutput' => 'Export.php',
55 - 'DumpPipeOutput' => 'Export.php',
56 - 'DumpGZipOutput' => 'Export.php',
57 - 'DumpBZip2Output' => 'Export.php',
58 - 'Dump7ZipOutput' => 'Export.php',
59 - 'DumpFilter' => 'Export.php',
60 - 'DumpNotalkFilter' => 'Export.php',
61 - 'DumpNamespaceFilter' => 'Export.php',
62 - 'DumpLatestFilter' => 'Export.php',
63 - 'DumpMultiWriter' => 'Export.php',
64 - 'ExternalEdit' => 'ExternalEdit.php',
65 - 'ExternalStore' => 'ExternalStore.php',
66 - 'ExternalStoreDB' => 'ExternalStoreDB.php',
67 - 'ExternalStoreHttp' => 'ExternalStoreHttp.php',
68 - 'FakeTitle' => 'FakeTitle.php',
69 - 'FeedItem' => 'Feed.php',
70 - 'ChannelFeed' => 'Feed.php',
71 - 'RSSFeed' => 'Feed.php',
72 - 'AtomFeed' => 'Feed.php',
73 - 'ReplacerCallback' => 'GlobalFunctions.php',
74 - 'Group' => 'Group.php',
75 - 'HTMLForm' => 'HTMLForm.php',
76 - 'HistoryBlob' => 'HistoryBlob.php',
77 - 'ConcatenatedGzipHistoryBlob' => 'HistoryBlob.php',
78 - 'HistoryBlobStub' => 'HistoryBlob.php',
79 - 'HistoryBlobCurStub' => 'HistoryBlob.php',
80 - 'Image' => 'Image.php',
81 - 'ThumbnailImage' => 'Image.php',
82 - 'ImageGallery' => 'ImageGallery.php',
83 - 'ImagePage' => 'ImagePage.php',
84 - 'ImageHistoryList' => 'ImagePage.php',
85 - 'ImageRemote' => 'ImageRemote.php',
86 - 'Job' => 'JobQueue.php',
87 - 'Licenses' => 'Licenses.php',
88 - 'License' => 'Licenses.php',
89 - 'LinkBatch' => 'LinkBatch.php',
90 - 'LinkCache' => 'LinkCache.php',
91 - 'LinkFilter' => 'LinkFilter.php',
92 - 'Linker' => 'Linker.php',
93 - 'LinksUpdate' => 'LinksUpdate.php',
94 - 'LoadBalancer' => 'LoadBalancer.php',
95 - 'LogPage' => 'LogPage.php',
96 - 'MacBinary' => 'MacBinary.php',
97 - 'MagicWord' => 'MagicWord.php',
98 - 'MathRenderer' => 'Math.php',
99 - 'MessageCache' => 'MessageCache.php',
100 - 'MimeMagic' => 'MimeMagic.php',
101 - 'Namespace' => 'Namespace.php',
102 - 'FakeMemCachedClient' => 'ObjectCache.php',
103 - 'ObjectCacheManager' => 'ObjectCache.php',
104 - 'MemCachedClientforWiki' => 'ObjectCache.php',
105 - 'OutputPage' => 'OutputPage.php',
106 - 'PageHistory' => 'PageHistory.php',
107 - 'Parser' => 'Parser.php',
108 - 'ParserOutput' => 'Parser.php',
109 - 'ParserOptions' => 'Parser.php',
110 - 'ParserCache' => 'ParserCache.php',
111 - 'element' => 'ParserXML.php',
112 - 'xml2php' => 'ParserXML.php',
113 - 'ParserXML' => 'ParserXML.php',
114 - 'ProfilerSimple' => 'ProfilerSimple.php',
115 - 'ProfilerSimpleUDP' => 'ProfilerSimpleUDP.php',
116 - 'Profiler' => 'Profiling.php',
117 - 'ProxyTools' => 'ProxyTools.php',
118 - 'ProtectionForm' => 'ProtectionForm.php',
119 - 'QueryPage' => 'QueryPage.php',
120 - 'PageQueryPage' => 'QueryPage.php',
121 - 'RawPage' => 'RawPage.php',
122 - 'RecentChange' => 'RecentChange.php',
123 - 'Revision' => 'Revision.php',
124 - 'Sanitizer' => 'Sanitizer.php',
125 - 'SearchEngine' => 'SearchEngine.php',
126 - 'SearchResultSet' => 'SearchEngine.php',
127 - 'SearchResult' => 'SearchEngine.php',
128 - 'SearchEngineDummy' => 'SearchEngine.php',
129 - 'SearchMySQL' => 'SearchMySQL.php',
130 - 'MySQLSearchResultSet' => 'SearchMySQL.php',
131 - 'SearchMySQL4' => 'SearchMySQL4.php',
132 - 'SearchTsearch2' => 'SearchTsearch2.php',
133 - 'SearchUpdate' => 'SearchUpdate.php',
134 - 'SearchUpdateMyISAM' => 'SearchUpdate.php',
135 - 'SiteConfiguration' => 'SiteConfiguration.php',
136 - 'SiteStatsUpdate' => 'SiteStatsUpdate.php',
137 - 'Skin' => 'Skin.php',
138 - 'MediaWiki_I18N' => 'SkinTemplate.php',
139 - 'SkinTemplate' => 'SkinTemplate.php',
140 - 'QuickTemplate' => 'SkinTemplate.php',
141 - 'SpecialAllpages' => 'SpecialAllpages.php',
142 - 'AncientPagesPage' => 'SpecialAncientpages.php',
143 - 'IPBlockForm' => 'SpecialBlockip.php',
144 - 'BookSourceList' => 'SpecialBooksources.php',
145 - 'BrokenRedirectsPage' => 'SpecialBrokenRedirects.php',
146 - 'CategoriesPage' => 'SpecialCategories.php',
147 - 'EmailConfirmation' => 'SpecialConfirmemail.php',
148 - 'contribs_finder' => 'SpecialContributions.php',
149 - 'DeadendPagesPage' => 'SpecialDeadendpages.php',
150 - 'DisambiguationsPage' => 'SpecialDisambiguations.php',
151 - 'DoubleRedirectsPage' => 'SpecialDoubleRedirects.php',
152 - 'EmailUserForm' => 'SpecialEmailuser.php',
153 - 'GroupsForm' => 'SpecialGroups.php',
154 - 'WikiRevision' => 'SpecialImport.php',
155 - 'WikiImporter' => 'SpecialImport.php',
156 - 'ImportStringSource' => 'SpecialImport.php',
157 - 'ImportStreamSource' => 'SpecialImport.php',
158 - 'IPUnblockForm' => 'SpecialIpblocklist.php',
159 - 'ListredirectsPage' => 'SpecialListredirects.php',
160 - 'ListUsersPage' => 'SpecialListusers.php',
161 - 'DBLockForm' => 'SpecialLockdb.php',
162 - 'LogReader' => 'SpecialLog.php',
163 - 'LogViewer' => 'SpecialLog.php',
164 - 'LonelyPagesPage' => 'SpecialLonelypages.php',
165 - 'LongPagesPage' => 'SpecialLongpages.php',
166 - 'MIMEsearchPage' => 'SpecialMIMEsearch.php',
167 - 'MostcategoriesPage' => 'SpecialMostcategories.php',
168 - 'MostimagesPage' => 'SpecialMostimages.php',
169 - 'MostlinkedPage' => 'SpecialMostlinked.php',
170 - 'MostlinkedCategoriesPage' => 'SpecialMostlinkedcategories.php',
171 - 'MostrevisionsPage' => 'SpecialMostrevisions.php',
172 - 'MovePageForm' => 'SpecialMovepage.php',
173 - 'NewPagesPage' => 'SpecialNewpages.php',
174 - 'SpecialPage' => 'SpecialPage.php',
175 - 'UnlistedSpecialPage' => 'SpecialPage.php',
176 - 'IncludableSpecialPage' => 'SpecialPage.php',
177 - 'PopularPagesPage' => 'SpecialPopularpages.php',
178 - 'PreferencesForm' => 'SpecialPreferences.php',
179 - 'SpecialPrefixindex' => 'SpecialPrefixindex.php',
180 - 'RevisionDeleteForm' => 'SpecialRevisiondelete.php',
181 - 'RevisionDeleter' => 'SpecialRevisiondelete.php',
182 - 'SpecialSearch' => 'SpecialSearch.php',
183 - 'ShortPagesPage' => 'SpecialShortpages.php',
184 - 'UncategorizedCategoriesPage' => 'SpecialUncategorizedcategories.php',
185 - 'UncategorizedPagesPage' => 'SpecialUncategorizedpages.php',
186 - 'PageArchive' => 'SpecialUndelete.php',
187 - 'UndeleteForm' => 'SpecialUndelete.php',
188 - 'DBUnlockForm' => 'SpecialUnlockdb.php',
189 - 'UnusedCategoriesPage' => 'SpecialUnusedcategories.php',
190 - 'UnusedimagesPage' => 'SpecialUnusedimages.php',
191 - 'UnusedtemplatesPage' => 'SpecialUnusedtemplates.php',
192 - 'UnwatchedpagesPage' => 'SpecialUnwatchedpages.php',
193 - 'UploadForm' => 'SpecialUpload.php',
194 - 'UploadFormMogile' => 'SpecialUploadMogile.php',
195 - 'LoginForm' => 'SpecialUserlogin.php',
196 - 'UserrightsForm' => 'SpecialUserrights.php',
197 - 'SpecialVersion' => 'SpecialVersion.php',
198 - 'WantedCategoriesPage' => 'SpecialWantedcategories.php',
199 - 'WantedPagesPage' => 'SpecialWantedpages.php',
200 - 'WhatLinksHerePage' => 'SpecialWhatlinkshere.php',
201 - 'SquidUpdate' => 'SquidUpdate.php',
202 - 'Title' => 'Title.php',
203 - 'User' => 'User.php',
204 - 'MailAddress' => 'UserMailer.php',
205 - 'EmailNotification' => 'UserMailer.php',
206 - 'WatchedItem' => 'WatchedItem.php',
207 - 'WebRequest' => 'WebRequest.php',
208 - 'FauxRequest' => 'WebRequest.php',
209 - 'MediaWiki' => 'Wiki.php',
210 - 'WikiError' => 'WikiError.php',
211 - 'WikiErrorMsg' => 'WikiError.php',
212 - 'WikiXmlError' => 'WikiError.php',
213 - 'ZhClient' => 'ZhClient.php',
214 - 'memcached' => 'memcached-client.php',
215 - 'UtfNormal' => 'normal/UtfNormal.php'
216 - );
217 - if (array_key_exists($class_name, $classes)) {
218 - require($classes[$class_name]);
219 - } else {
220 - return false;
221 - }
222 -}
223 -
224 -?>
\ No newline at end of file
Index: trunk/phase3/includes/SpecialRecentchanges.php
@@ -6,6 +6,13 @@
77 */
88
99 /**
 10+ *
 11+ */
 12+require_once( 'Feed.php' );
 13+require_once( 'ChangesList.php' );
 14+require_once( 'Revision.php' );
 15+
 16+/**
1017 * Constructor
1118 */
1219 function wfSpecialRecentchanges( $par, $specialPage ) {
Index: trunk/phase3/includes/ParserXML.php
@@ -5,6 +5,9 @@
66 * @subpackage Experimental
77 */
88
 9+/** */
 10+require_once ('Parser.php');
 11+
912 /**
1013 * This should one day become the XML->(X)HTML parser
1114 * Based on work by Jan Hidders and Magnus Manske
Index: trunk/phase3/includes/ImagePage.php
@@ -9,6 +9,8 @@
1010 if( !defined( 'MEDIAWIKI' ) )
1111 die( -1 );
1212
 13+require_once( 'Image.php' );
 14+
1315 /**
1416 * Special handling for image description pages
1517 * @package MediaWiki
@@ -307,8 +309,9 @@
308310 $wgOut->addHTML($sharedtext);
309311
310312 if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
 313+ require_once("HttpFunctions.php");
311314 $ur = ini_set('allow_url_fopen', true);
312 - $text = HttpFunctions::getHTTP($url . '?action=render');
 315+ $text = wfGetHTTP($url . '?action=render');
313316 ini_set('allow_url_fopen', $ur);
314317 if ($text)
315318 $this->mExtraDescription = $text;
@@ -671,6 +674,7 @@
672675 }
673676
674677 function blockedIPpage() {
 678+ require_once( 'EditPage.php' );
675679 $edit = new EditPage( $this );
676680 return $edit->blockedIPpage();
677681 }
Index: trunk/phase3/includes/AjaxDispatcher.php
@@ -1,5 +1,18 @@
22 <?php
33
 4+//$wgRequestTime = microtime();
 5+
 6+// unset( $IP );
 7+// @ini_set( 'allow_url_fopen', 0 ); # For security...
 8+
 9+# Valid web server entry point, enable includes.
 10+# Please don't move this line to includes/Defines.php. This line essentially defines
 11+# a valid entry point. If you put it in includes/Defines.php, then any script that includes
 12+# it becomes an entry point, thereby defeating its purpose.
 13+// define( 'MEDIAWIKI', true );
 14+// require_once( './includes/Defines.php' );
 15+// require_once( './LocalSettings.php' );
 16+// require_once( 'includes/Setup.php' );
417 require_once( 'AjaxFunctions.php' );
518
619 if ( ! $wgUseAjax ) {
Index: trunk/phase3/includes/SearchEngine.php
@@ -195,8 +195,10 @@
196196 $class = $wgSearchType;
197197 } elseif( $wgDBtype == 'mysql' ) {
198198 $class = 'SearchMySQL4';
 199+ require_once( 'SearchMySQL4.php' );
199200 } else if ( $wgDBtype == 'PostgreSQL' ) {
200201 $class = 'SearchTsearch2';
 202+ require_once( 'SearchTsearch2.php' );
201203 } else {
202204 $class = 'SearchEngineDummy';
203205 }
Index: trunk/phase3/includes/Parser.php
@@ -6,6 +6,11 @@
77 * @subpackage Parser
88 */
99
 10+/** */
 11+require_once( 'Sanitizer.php' );
 12+require_once( 'HttpFunctions.php' );
 13+require_once( 'ImageGallery.php' );
 14+
1015 /**
1116 * Update this version number when the ParserOutput format
1217 * changes in an incompatible way, so the parser cache
@@ -447,7 +452,7 @@
448453 $output = wfEscapeHTMLTagsOnly( $content );
449454 break;
450455 case 'math':
451 - $output = MathRenderer::renderMath( $content );
 456+ $output = renderMath( $content );
452457 break;
453458 case 'pre':
454459 // Backwards-compatibility hack
@@ -2967,7 +2972,7 @@
29682973 }
29692974 }
29702975
2971 - $text = HttpFunctions::getHTTP($url);
 2976+ $text = wfGetHTTP($url);
29722977 if (!$text)
29732978 return wfMsg('scarytranscludefailed', $url);
29742979
Index: trunk/phase3/includes/Setup.php
@@ -22,14 +22,13 @@
2323 die( -1 );
2424 }
2525
26 -require('AutoLoader.php');
27 -
2826 if( !isset( $wgProfiling ) )
2927 $wgProfiling = false;
3028
3129 if ( function_exists( 'wfProfileIn' ) ) {
3230 /* nada, everything should be done already */
3331 } elseif ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) {
 32+ require_once( 'Profiling.php' );
3433 $wgProfiling = true;
3534 if ($wgProfilerType == "") {
3635 $wgProfiler = new Profiler();
@@ -49,8 +48,29 @@
5049 require_once( 'GlobalFunctions.php' );
5150 require_once( 'Hooks.php' );
5251 require_once( 'Namespace.php' );
 52+require_once( 'User.php' );
 53+require_once( 'Skin.php' );
 54+require_once( 'OutputPage.php' );
 55+require_once( 'LinkCache.php' );
 56+require_once( 'LinkBatch.php' );
 57+require_once( 'Title.php' );
 58+require_once( 'Article.php' );
5359 require_once( 'MagicWord.php' );
 60+require_once( 'Block.php' );
 61+require_once( 'MessageCache.php' );
 62+require_once( 'Parser.php' );
 63+require_once( 'ParserCache.php' );
 64+require_once( 'WebRequest.php' );
 65+require_once( 'LoadBalancer.php' );
 66+require_once( 'HistoryBlob.php' );
 67+require_once( 'ProxyTools.php' );
 68+require_once( 'ObjectCache.php' );
 69+require_once( 'WikiError.php' );
 70+require_once( 'SpecialPage.php' );
5471
 72+if ( $wgUseDynamicDates ) {
 73+ require_once( 'DateFormatter.php' );
 74+}
5575
5676 wfProfileOut( $fname.'-includes' );
5777 wfProfileIn( $fname.'-misc1' );
@@ -88,9 +108,9 @@
89109 wfProfileOut( $fname.'-misc1' );
90110 wfProfileIn( $fname.'-memcached' );
91111
92 -$wgMemc =& ObjectCacheManager::getMainCache();
93 -$messageMemc =& ObjectCacheManager::getMessageCache();
94 -$parserMemc =& ObjectCacheManager::getParserCache();
 112+$wgMemc =& wfGetMainCache();
 113+$messageMemc =& wfGetMessageCacheStorage();
 114+$parserMemc =& wfGetParserCacheStorage();
95115
96116 wfDebug( 'Main cache: ' . get_class( $wgMemc ) .
97117 "\nMessage cache: " . get_class( $messageMemc ) .
@@ -188,6 +208,7 @@
189209 }
190210
191211 if( !is_object( $wgAuth ) ) {
 212+ require_once( 'AuthPlugin.php' );
192213 $wgAuth = new AuthPlugin();
193214 }
194215
@@ -275,6 +296,7 @@
276297 $wgMwRedir =& MagicWord::get( MAG_REDIRECT );
277298
278299 if ( $wgUseXMLparser ) {
 300+ require_once( 'ParserXML.php' );
279301 $wgParser = new ParserXML();
280302 } else {
281303 $wgParser = new Parser();
Index: trunk/phase3/includes/SpecialBlockme.php
@@ -12,7 +12,7 @@
1313 {
1414 global $wgBlockOpenProxies, $wgOut, $wgProxyKey;
1515
16 - $ip = ProxyTools::getIP();
 16+ $ip = wfGetIP();
1717
1818 if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $ip . $wgProxyKey ) ) {
1919 $wgOut->addWikiText( wfMsg( "disabled" ) );
Index: trunk/phase3/includes/Export.php
@@ -22,6 +22,9 @@
2323 * @subpackage SpecialPage
2424 */
2525
 26+/** */
 27+require_once( 'Revision.php' );
 28+
2629 define( 'MW_EXPORT_FULL', 0 );
2730 define( 'MW_EXPORT_CURRENT', 1 );
2831
Index: trunk/phase3/includes/EditPage.php
@@ -725,7 +725,7 @@
726726 $this->summary = '';
727727 if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI )
728728 $this->textbox1 = wfMsgWeirdKey ( $this->mArticle->mTitle->getText() ) ;
729 - ProxyTools::proxyCheck();
 729+ wfProxyCheck();
730730 }
731731
732732 /**
@@ -1118,6 +1118,7 @@
11191119 $wgOut->addHTML( "<input type=\"hidden\" name=\"wpAutoSummary\" value=\"$autosumm\" />\n" );
11201120
11211121 if ( $this->isConflict ) {
 1122+ require_once( "DifferenceEngine.php" );
11221123 $wgOut->addWikiText( '==' . wfMsg( "yourdiff" ) . '==' );
11231124
11241125 $de = new DifferenceEngine( $this->mTitle );
@@ -1617,6 +1618,7 @@
16181619 * @return string HTML
16191620 */
16201621 function getDiff() {
 1622+ require_once( 'DifferenceEngine.php' );
16211623 $oldtext = $this->mArticle->fetchContent();
16221624 $newtext = $this->mArticle->replaceSection(
16231625 $this->section, $this->textbox1, $this->summary, $this->edittime );
Index: trunk/phase3/includes/SpecialUpload.php
@@ -9,6 +9,8 @@
1010 *
1111 */
1212 require_once 'Image.php';
 13+require_once 'MacBinary.php';
 14+require_once 'Licenses.php';
1315 /**
1416 * Entry point
1517 */
Index: trunk/phase3/includes/OutputPage.php
@@ -5,6 +5,9 @@
66 * @package MediaWiki
77 */
88
 9+if ( $wgUseTeX )
 10+ require_once 'Math.php';
 11+
912 /**
1013 * @todo document
1114 * @package MediaWiki
@@ -647,7 +650,7 @@
648651
649652 $id = $wgUser->blockedBy();
650653 $reason = $wgUser->blockedFor();
651 - $ip = ProxyTools::getIP();
 654+ $ip = wfGetIP();
652655
653656 if ( is_numeric( $id ) ) {
654657 $name = User::whoIs( $id );
Index: trunk/phase3/includes/SearchUpdate.php
@@ -37,6 +37,7 @@
3838 $fname = 'SearchUpdate::doUpdate';
3939 wfProfileIn( $fname );
4040
 41+ require_once( 'SearchEngine.php' );
4142 $search = SearchEngine::create();
4243 $lc = $search->legalSearchChars() . '&#;';
4344
Index: trunk/phase3/includes/LinksUpdate.php
@@ -119,6 +119,7 @@
120120 if ( $this->mRecursive ) {
121121 $tlto = $this->mTitle->getTemplateLinksTo();
122122 if ( count( $tlto ) ) {
 123+ require_once( 'JobQueue.php' );
123124 Job::queueLinksJobs( $tlto );
124125 }
125126 }
@@ -154,6 +155,7 @@
155156 if ( $this->mRecursive ) {
156157 $tlto = $this->mTitle->getTemplateLinksTo();
157158 if ( count( $tlto ) ) {
 159+ require_once( 'JobQueue.php' );
158160 Job::queueLinksJobs( $tlto );
159161 }
160162 }
Index: trunk/phase3/includes/WebRequest.php
@@ -117,6 +117,7 @@
118118 $data = $wgContLang->checkTitleEncoding( $data );
119119 }
120120 }
 121+ require_once( 'normal/UtfNormal.php' );
121122 $data = $this->normalizeUnicode( $data );
122123 return $data;
123124 } else {
Index: trunk/phase3/includes/Revision.php
@@ -4,6 +4,10 @@
55 * @todo document
66 */
77
 8+/** */
 9+require_once( 'Database.php' );
 10+require_once( 'Article.php' );
 11+
812 /** @+ */
913 define( 'MW_REV_DELETED_TEXT', 1 );
1014 define( 'MW_REV_DELETED_COMMENT', 2 );
@@ -510,6 +514,7 @@
511515 wfProfileOut( $fname );
512516 return false;
513517 }
 518+ require_once('ExternalStore.php');
514519 $text=ExternalStore::fetchFromURL($url);
515520 }
516521
@@ -599,6 +604,7 @@
600605 } else {
601606 $store = $wgDefaultExternalStore;
602607 }
 608+ require_once('ExternalStore.php');
603609 // Store and get the URL
604610 $data = ExternalStore::insert( $store, $data );
605611 if ( !$data ) {
Index: trunk/phase3/includes/SearchTsearch2.php
@@ -23,6 +23,9 @@
2424 * @subpackage Search
2525 */
2626
 27+/** */
 28+require_once( 'SearchEngine.php' );
 29+
2730 /**
2831 * @todo document
2932 * @package MediaWiki
Index: trunk/phase3/includes/Wiki.php
@@ -176,8 +176,10 @@
177177
178178 switch( $title->getNamespace() ) {
179179 case NS_IMAGE:
 180+ require_once( 'includes/ImagePage.php' );
180181 return new ImagePage( $title );
181182 case NS_CATEGORY:
 183+ require_once( 'includes/CategoryPage.php' );
182184 return new CategoryPage( $title );
183185 default:
184186 return new Article( $title );
@@ -282,6 +284,8 @@
283285 $n = intval( $wgJobRunRate );
284286 }
285287
 288+ require_once( 'JobQueue.php' );
 289+
286290 while ( $n-- && false != ($job = Job::pop())) {
287291 $output = $job->toString() . "\n";
288292 if ( !$job->run() ) {
@@ -355,7 +359,8 @@
356360 }
357361 break;
358362 case 'credits':
359 - Credits::showCreditsPage( $article );
 363+ require_once( 'includes/Credits.php' );
 364+ showCreditsPage( $article );
360365 break;
361366 case 'submit':
362367 if( !$this->getVal( 'CommandLineMode' ) && !$request->checkSessionCookie() ) {
@@ -370,9 +375,11 @@
371376 $oldid = $request->getVal( 'oldid' );
372377 if( !$this->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal ||
373378 $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
 379+ require_once( 'includes/EditPage.php' );
374380 $editor = new EditPage( $article );
375381 $editor->submit();
376382 } elseif( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
 383+ require_once( 'includes/ExternalEdit.php' );
377384 $mode = $request->getVal( 'mode' );
378385 $extedit = new ExternalEdit( $article, $mode );
379386 $extedit->edit();
@@ -382,10 +389,12 @@
383390 if( $_SERVER['REQUEST_URI'] == $title->getInternalURL( 'action=history' ) ) {
384391 $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
385392 }
 393+ require_once( 'includes/PageHistory.php' );
386394 $history = new PageHistory( $article );
387395 $history->history();
388396 break;
389397 case 'raw':
 398+ require_once( 'includes/RawPage.php' );
390399 $raw = new RawPage( $article );
391400 $raw->view();
392401 break;
Index: trunk/phase3/includes/ChangesList.php
@@ -7,6 +7,7 @@
88 * - recent changes
99 */
1010
 11+require_once("RecentChange.php");
1112 /**
1213 * @todo document
1314 * @package MediaWiki
Index: trunk/phase3/includes/AjaxFunctions.php
@@ -3,6 +3,8 @@
44 if( !defined( 'MEDIAWIKI' ) )
55 die( -1 );
66
 7+require_once('WebRequest.php');
 8+
79 /**
810 * Function converts an Javascript escaped string back into a string with
911 * specified charset (default is UTF-8).
Index: trunk/phase3/includes/SearchMySQL4.php
@@ -23,6 +23,8 @@
2424 * @subpackage Search
2525 */
2626
 27+require_once( 'SearchMySQL.php' );
 28+
2729 /**
2830 * @package MediaWiki
2931 * @subpackage Search
Index: trunk/phase3/includes/DifferenceEngine.php
@@ -5,6 +5,9 @@
66 * @subpackage DifferenceEngine
77 */
88
 9+/** */
 10+require_once( 'Revision.php' );
 11+
912 define( 'MAX_DIFF_LINE', 10000 );
1013 define( 'MAX_DIFF_XREF_LENGTH', 10000 );
1114
Index: trunk/phase3/includes/Title.php
@@ -5,7 +5,8 @@
66 * @package MediaWiki
77 */
88
9 -global $wgTitleInterwikiCache, $wgTitleCache;
 9+/** */
 10+require_once( 'normal/UtfNormal.php' );
1011
1112 $wgTitleInterwikiCache = array();
1213 $wgTitleCache = array();
@@ -333,6 +334,7 @@
334335 */
335336 /* static */ function indexTitle( $ns, $title ) {
336337 global $wgContLang;
 338+ require_once( 'SearchEngine.php' );
337339
338340 $lc = SearchEngine::legalSearchChars() . '&#;';
339341 $t = $wgContLang->stripForSearch( $title );
@@ -1160,7 +1162,8 @@
11611163 * Check that the corresponding skin exists
11621164 */
11631165 function isValidCssJsSubpage() {
1164 - return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), Skin::getSkinNames() ) );
 1166+ global $wgValidSkinNames;
 1167+ return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), $wgValidSkinNames ) );
11651168 }
11661169 /**
11671170 * Trim down a .css or .js subpage title to get the corresponding skin name
Index: trunk/phase3/includes/Image.php
@@ -12,6 +12,9 @@
1313 * extension=extensions/php_exif.dll
1414 */
1515
 16+if ($wgShowEXIF)
 17+ require_once('Exif.php');
 18+
1619 /**
1720 * Bump this number when serialized cache records may be incompatible.
1821 */
Index: trunk/phase3/includes/RawPage.php
@@ -10,6 +10,9 @@
1111 * @package MediaWiki
1212 */
1313
 14+/** */
 15+require_once( 'Revision.php' );
 16+
1417 /**
1518 * @todo document
1619 * @package MediaWiki
Index: trunk/phase3/includes/SkinTemplate.php
@@ -343,7 +343,8 @@
344344 $this->credits = false;
345345
346346 if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
347 - $this->credits = Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
 347+ require_once("Credits.php");
 348+ $this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
348349 } else {
349350 $tpl->set('lastmod', $this->lastModified());
350351 }
Index: trunk/phase3/includes/SpecialPreferences.php
@@ -444,7 +444,7 @@
445445 * @access private
446446 */
447447 function mainPrefsForm( $status , $message = '' ) {
448 - global $wgUser, $wgOut, $wgLang, $wgContLang;
 448+ global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames;
449449 global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
450450 global $wgDisableLangConversion;
451451 global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
@@ -723,7 +723,7 @@
724724 $previewtext = wfMsg('skinpreview');
725725 # Only show members of $wgValidSkinNames rather than
726726 # $skinNames (skins is all skin names from Language.php)
727 - foreach (Skin::getSkinNames() as $skinkey => $skinname ) {
 727+ foreach ($wgValidSkinNames as $skinkey => $skinname ) {
728728 if ( in_array( $skinkey, $wgSkipSkins ) ) {
729729 continue;
730730 }
Index: trunk/phase3/includes/ExternalStoreDB.php
@@ -6,7 +6,9 @@
77 * DB accessable external objects
88 *
99 */
 10+require_once( 'LoadBalancer.php' );
1011
 12+
1113 /** @package MediaWiki */
1214
1315 /**
Index: trunk/phase3/includes/HttpFunctions.php
@@ -3,89 +3,88 @@
44 * Various HTTP related functions
55 */
66
7 -class HttpFunctions {
8 - /**
9 - * Get the contents of a file by HTTP
10 - *
11 - * if $timeout is 'default', $wgHTTPTimeout is used
12 - */
13 - function getHTTP( $url, $timeout = 'default' ) {
14 - global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle;
 7+/**
 8+ * Get the contents of a file by HTTP
 9+ *
 10+ * if $timeout is 'default', $wgHTTPTimeout is used
 11+ */
 12+function wfGetHTTP( $url, $timeout = 'default' ) {
 13+ global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle;
1514
16 - # Use curl if available
17 - if ( function_exists( 'curl_init' ) ) {
18 - $c = curl_init( $url );
19 - if ( HttpFunctions::isLocalURL( $url ) ) {
20 - curl_setopt( $c, CURLOPT_PROXY, 'localhost:80' );
21 - } else if ($wgHTTPProxy) {
22 - curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy);
23 - }
 15+ # Use curl if available
 16+ if ( function_exists( 'curl_init' ) ) {
 17+ $c = curl_init( $url );
 18+ if ( wfIsLocalURL( $url ) ) {
 19+ curl_setopt( $c, CURLOPT_PROXY, 'localhost:80' );
 20+ } else if ($wgHTTPProxy) {
 21+ curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy);
 22+ }
2423
25 - if ( $timeout == 'default' ) {
26 - $timeout = $wgHTTPTimeout;
27 - }
28 - curl_setopt( $c, CURLOPT_TIMEOUT, $timeout );
29 - curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" );
 24+ if ( $timeout == 'default' ) {
 25+ $timeout = $wgHTTPTimeout;
 26+ }
 27+ curl_setopt( $c, CURLOPT_TIMEOUT, $timeout );
 28+ curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" );
3029
31 - # Set the referer to $wgTitle, even in command-line mode
32 - # This is useful for interwiki transclusion, where the foreign
33 - # server wants to know what the referring page is.
34 - # $_SERVER['REQUEST_URI'] gives a less reliable indication of the
35 - # referring page.
36 - if ( is_object( $wgTitle ) ) {
37 - curl_setopt( $c, CURLOPT_REFERER, $wgTitle->getFullURL() );
38 - }
 30+ # Set the referer to $wgTitle, even in command-line mode
 31+ # This is useful for interwiki transclusion, where the foreign
 32+ # server wants to know what the referring page is.
 33+ # $_SERVER['REQUEST_URI'] gives a less reliable indication of the
 34+ # referring page.
 35+ if ( is_object( $wgTitle ) ) {
 36+ curl_setopt( $c, CURLOPT_REFERER, $wgTitle->getFullURL() );
 37+ }
3938
40 - ob_start();
41 - curl_exec( $c );
42 - $text = ob_get_contents();
43 - ob_end_clean();
 39+ ob_start();
 40+ curl_exec( $c );
 41+ $text = ob_get_contents();
 42+ ob_end_clean();
4443
45 - # Don't return the text of error messages, return false on error
46 - if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) {
47 - $text = false;
48 - }
49 - curl_close( $c );
50 - } else {
51 - # Otherwise use file_get_contents, or its compatibility function from GlobalFunctions.php
52 - # This may take 3 minutes to time out, and doesn't have local fetch capabilities
53 - $url_fopen = ini_set( 'allow_url_fopen', 1 );
54 - $text = file_get_contents( $url );
55 - ini_set( 'allow_url_fopen', $url_fopen );
 44+ # Don't return the text of error messages, return false on error
 45+ if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) {
 46+ $text = false;
5647 }
57 - return $text;
 48+ curl_close( $c );
 49+ } else {
 50+ # Otherwise use file_get_contents, or its compatibility function from GlobalFunctions.php
 51+ # This may take 3 minutes to time out, and doesn't have local fetch capabilities
 52+ $url_fopen = ini_set( 'allow_url_fopen', 1 );
 53+ $text = file_get_contents( $url );
 54+ ini_set( 'allow_url_fopen', $url_fopen );
5855 }
 56+ return $text;
 57+}
5958
60 - /**
61 - * Check if the URL can be served by localhost
62 - */
63 - function isLocalURL( $url ) {
64 - global $wgCommandLineMode, $wgConf;
65 - if ( $wgCommandLineMode ) {
66 - return false;
67 - }
 59+/**
 60+ * Check if the URL can be served by localhost
 61+ */
 62+function wfIsLocalURL( $url ) {
 63+ global $wgCommandLineMode, $wgConf;
 64+ if ( $wgCommandLineMode ) {
 65+ return false;
 66+ }
6867
69 - // Extract host part
70 - $matches = array();
71 - if ( preg_match( '!^http://([\w.-]+)[/:].*$!', $url, $matches ) ) {
72 - $host = $matches[1];
73 - // Split up dotwise
74 - $domainParts = explode( '.', $host );
75 - // Check if this domain or any superdomain is listed in $wgConf as a local virtual host
76 - $domainParts = array_reverse( $domainParts );
77 - for ( $i = 0; $i < count( $domainParts ); $i++ ) {
78 - $domainPart = $domainParts[$i];
79 - if ( $i == 0 ) {
80 - $domain = $domainPart;
81 - } else {
82 - $domain = $domainPart . '.' . $domain;
83 - }
84 - if ( $wgConf->isLocalVHost( $domain ) ) {
85 - return true;
86 - }
 68+ // Extract host part
 69+ $matches = array();
 70+ if ( preg_match( '!^http://([\w.-]+)[/:].*$!', $url, $matches ) ) {
 71+ $host = $matches[1];
 72+ // Split up dotwise
 73+ $domainParts = explode( '.', $host );
 74+ // Check if this domain or any superdomain is listed in $wgConf as a local virtual host
 75+ $domainParts = array_reverse( $domainParts );
 76+ for ( $i = 0; $i < count( $domainParts ); $i++ ) {
 77+ $domainPart = $domainParts[$i];
 78+ if ( $i == 0 ) {
 79+ $domain = $domainPart;
 80+ } else {
 81+ $domain = $domainPart . '.' . $domain;
8782 }
 83+ if ( $wgConf->isLocalVHost( $domain ) ) {
 84+ return true;
 85+ }
8886 }
89 - return false;
9087 }
 88+ return false;
9189 }
 90+
9291 ?>
Index: trunk/phase3/includes/DatabasePostgreSQL.php
@@ -14,6 +14,11 @@
1515 */
1616
1717 /**
 18+ * Depends on database
 19+ */
 20+require_once( 'Database.php' );
 21+
 22+/**
1823 *
1924 * @package MediaWiki
2025 */
Index: trunk/phase3/includes/Block.php
@@ -169,7 +169,7 @@
170170 {
171171 $fname = 'Block::loadRange';
172172
173 - $iaddr = ProxyTools::IP2Hex( $address );
 173+ $iaddr = wfIP2Hex( $address );
174174 if ( $iaddr === false ) {
175175 # Invalid address
176176 return false;
@@ -207,7 +207,7 @@
208208 * Determine if a given integer IPv4 address is in a given CIDR network
209209 */
210210 function isAddressInRange( $addr, $range ) {
211 - list( $network, $bits ) = ProxyTools::parseCIDR( $range );
 211+ list( $network, $bits ) = wfParseCIDR( $range );
212212 if ( $network !== false && $addr >> ( 32 - $bits ) == $network >> ( 32 - $bits ) ) {
213213 return true;
214214 } else {
@@ -241,7 +241,7 @@
242242 $this->mRangeStart = '';
243243 $this->mRangeEnd = '';
244244 if ( $this->mUser == 0 ) {
245 - list( $network, $bits ) = ProxyTools::parseCIDR( $this->mAddress );
 245+ list( $network, $bits ) = wfParseCIDR( $this->mAddress );
246246 if ( $network !== false ) {
247247 $this->mRangeStart = sprintf( '%08X', $network );
248248 $this->mRangeEnd = sprintf( '%08X', $network + (1 << (32 - $bits)) - 1 );
@@ -431,7 +431,7 @@
432432 $parts = explode( '/', $range );
433433 if ( count( $parts ) == 2 ) {
434434 $shift = 32 - $parts[1];
435 - $ipint = ProxyTools::IP2Unsigned( $parts[0] );
 435+ $ipint = wfIP2Unsigned( $parts[0] );
436436 $ipint = $ipint >> $shift << $shift;
437437 $newip = long2ip( $ipint );
438438 $range = "$newip/{$parts[1]}";
Index: trunk/phase3/includes/Credits.php
@@ -24,165 +24,164 @@
2525 /**
2626 * This is largely cadged from PageHistory::history
2727 */
28 -class Credits {
29 - function showCreditsPage($article) {
30 - global $wgOut;
 28+function showCreditsPage($article) {
 29+ global $wgOut;
3130
32 - $fname = 'Credits::showCreditsPage';
 31+ $fname = 'showCreditsPage';
3332
34 - wfProfileIn( $fname );
 33+ wfProfileIn( $fname );
3534
36 - $wgOut->setPageTitle( $article->mTitle->getPrefixedText() );
37 - $wgOut->setSubtitle( wfMsg( 'creditspage' ) );
38 - $wgOut->setArticleFlag( false );
39 - $wgOut->setArticleRelated( true );
40 - $wgOut->setRobotpolicy( 'noindex,nofollow' );
 35+ $wgOut->setPageTitle( $article->mTitle->getPrefixedText() );
 36+ $wgOut->setSubtitle( wfMsg( 'creditspage' ) );
 37+ $wgOut->setArticleFlag( false );
 38+ $wgOut->setArticleRelated( true );
 39+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
4140
42 - if( $article->mTitle->getArticleID() == 0 ) {
43 - $s = wfMsg( 'nocredits' );
44 - } else {
45 - $s = Credits::getCredits($article, -1);
46 - }
 41+ if( $article->mTitle->getArticleID() == 0 ) {
 42+ $s = wfMsg( 'nocredits' );
 43+ } else {
 44+ $s = getCredits($article, -1);
 45+ }
4746
48 - $wgOut->addHTML( $s );
 47+ $wgOut->addHTML( $s );
4948
50 - wfProfileOut( $fname );
51 - }
 49+ wfProfileOut( $fname );
 50+}
5251
53 - function getCredits($article, $cnt, $showIfMax=true) {
54 - $fname = 'Credits::getCredits';
55 - wfProfileIn( $fname );
56 - $s = '';
 52+function getCredits($article, $cnt, $showIfMax=true) {
 53+ $fname = 'getCredits';
 54+ wfProfileIn( $fname );
 55+ $s = '';
5756
58 - if (isset($cnt) && $cnt != 0) {
59 - $s = Credits::getAuthorCredits($article);
60 - if ($cnt > 1 || $cnt < 0) {
61 - $s .= ' ' . Credits::getContributorCredits($article, $cnt - 1, $showIfMax);
62 - }
 57+ if (isset($cnt) && $cnt != 0) {
 58+ $s = getAuthorCredits($article);
 59+ if ($cnt > 1 || $cnt < 0) {
 60+ $s .= ' ' . getContributorCredits($article, $cnt - 1, $showIfMax);
6361 }
64 -
65 - wfProfileOut( $fname );
66 - return $s;
6762 }
6863
69 - /**
70 - *
71 - */
72 - function getAuthorCredits($article) {
73 - global $wgLang, $wgAllowRealName;
 64+ wfProfileOut( $fname );
 65+ return $s;
 66+}
7467
75 - $last_author = $article->getUser();
 68+/**
 69+ *
 70+ */
 71+function getAuthorCredits($article) {
 72+ global $wgLang, $wgAllowRealName;
7673
77 - if ($last_author == 0) {
78 - $author_credit = wfMsg('anonymous');
79 - } else {
80 - if($wgAllowRealName) { $real_name = User::whoIsReal($last_author); }
81 - $user_name = User::whoIs($last_author);
 74+ $last_author = $article->getUser();
8275
83 - if (!empty($real_name)) {
84 - $author_credit = Credits::creditLink($user_name, $real_name);
85 - } else {
86 - $author_credit = wfMsg('siteuser', Credits::creditLink($user_name));
87 - }
88 - }
 76+ if ($last_author == 0) {
 77+ $author_credit = wfMsg('anonymous');
 78+ } else {
 79+ if($wgAllowRealName) { $real_name = User::whoIsReal($last_author); }
 80+ $user_name = User::whoIs($last_author);
8981
90 - $timestamp = $article->getTimestamp();
91 - if ($timestamp) {
92 - $d = $wgLang->timeanddate($article->getTimestamp(), true);
 82+ if (!empty($real_name)) {
 83+ $author_credit = creditLink($user_name, $real_name);
9384 } else {
94 - $d = '';
 85+ $author_credit = wfMsg('siteuser', creditLink($user_name));
9586 }
96 - return wfMsg('lastmodifiedby', $d, $author_credit);
9787 }
9888
99 - /**
100 - *
101 - */
102 - function getContributorCredits($article, $cnt, $showIfMax) {
 89+ $timestamp = $article->getTimestamp();
 90+ if ($timestamp) {
 91+ $d = $wgLang->timeanddate($article->getTimestamp(), true);
 92+ } else {
 93+ $d = '';
 94+ }
 95+ return wfMsg('lastmodifiedby', $d, $author_credit);
 96+}
10397
104 - global $wgLang, $wgAllowRealName;
 98+/**
 99+ *
 100+ */
 101+function getContributorCredits($article, $cnt, $showIfMax) {
105102
106 - $contributors = $article->getContributors();
 103+ global $wgLang, $wgAllowRealName;
107104
108 - $others_link = '';
 105+ $contributors = $article->getContributors();
109106
110 - # Hmm... too many to fit!
 107+ $others_link = '';
111108
112 - if ($cnt > 0 && count($contributors) > $cnt) {
113 - $others_link = Credits::creditOthersLink($article);
114 - if (!$showIfMax) {
115 - return wfMsg('othercontribs', $others_link);
116 - } else {
117 - $contributors = array_slice($contributors, 0, $cnt);
118 - }
 109+ # Hmm... too many to fit!
 110+
 111+ if ($cnt > 0 && count($contributors) > $cnt) {
 112+ $others_link = creditOthersLink($article);
 113+ if (!$showIfMax) {
 114+ return wfMsg('othercontribs', $others_link);
 115+ } else {
 116+ $contributors = array_slice($contributors, 0, $cnt);
119117 }
 118+ }
120119
121 - $real_names = array();
122 - $user_names = array();
 120+ $real_names = array();
 121+ $user_names = array();
123122
124 - $anon = '';
 123+ $anon = '';
125124
126 - # Sift for real versus user names
 125+ # Sift for real versus user names
127126
128 - foreach ($contributors as $user_parts) {
129 - if ($user_parts[0] != 0) {
130 - if ($wgAllowRealName && !empty($user_parts[2])) {
131 - $real_names[] = Credits::creditLink($user_parts[1], $user_parts[2]);
132 - } else {
133 - $user_names[] = Credits::creditLink($user_parts[1]);
134 - }
 127+ foreach ($contributors as $user_parts) {
 128+ if ($user_parts[0] != 0) {
 129+ if ($wgAllowRealName && !empty($user_parts[2])) {
 130+ $real_names[] = creditLink($user_parts[1], $user_parts[2]);
135131 } else {
136 - $anon = wfMsg('anonymous');
 132+ $user_names[] = creditLink($user_parts[1]);
137133 }
 134+ } else {
 135+ $anon = wfMsg('anonymous');
138136 }
 137+ }
139138
140 - # Two strings: real names, and user names
 139+ # Two strings: real names, and user names
141140
142 - $real = $wgLang->listToText($real_names);
143 - $user = $wgLang->listToText($user_names);
 141+ $real = $wgLang->listToText($real_names);
 142+ $user = $wgLang->listToText($user_names);
144143
145 - # "ThisSite user(s) A, B and C"
 144+ # "ThisSite user(s) A, B and C"
146145
147 - if (!empty($user)) {
148 - $user = wfMsg('siteusers', $user);
149 - }
 146+ if (!empty($user)) {
 147+ $user = wfMsg('siteusers', $user);
 148+ }
150149
151 - # This is the big list, all mooshed together. We sift for blank strings
 150+ # This is the big list, all mooshed together. We sift for blank strings
152151
153 - $fulllist = array();
 152+ $fulllist = array();
154153
155 - foreach (array($real, $user, $anon, $others_link) as $s) {
156 - if (!empty($s)) {
157 - array_push($fulllist, $s);
158 - }
 154+ foreach (array($real, $user, $anon, $others_link) as $s) {
 155+ if (!empty($s)) {
 156+ array_push($fulllist, $s);
159157 }
 158+ }
160159
161 - # Make the list into text...
 160+ # Make the list into text...
162161
163 - $creds = $wgLang->listToText($fulllist);
 162+ $creds = $wgLang->listToText($fulllist);
164163
165 - # "Based on work by ..."
 164+ # "Based on work by ..."
166165
167 - return (empty($creds)) ? '' : wfMsg('othercontribs', $creds);
168 - }
 166+ return (empty($creds)) ? '' : wfMsg('othercontribs', $creds);
 167+}
169168
170 - /**
171 - *
172 - */
173 - function creditLink($user_name, $link_text = '') {
174 - global $wgUser, $wgContLang;
175 - $skin = $wgUser->getSkin();
176 - return $skin->makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name,
177 - htmlspecialchars( (empty($link_text)) ? $user_name : $link_text ));
178 - }
 169+/**
 170+ *
 171+ */
 172+function creditLink($user_name, $link_text = '') {
 173+ global $wgUser, $wgContLang;
 174+ $skin = $wgUser->getSkin();
 175+ return $skin->makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name,
 176+ htmlspecialchars( (empty($link_text)) ? $user_name : $link_text ));
 177+}
179178
180 - /**
181 - *
182 - */
183 - function creditOthersLink($article) {
184 - global $wgUser;
185 - $skin = $wgUser->getSkin();
186 - return $skin->makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits');
187 - }
 179+/**
 180+ *
 181+ */
 182+function creditOthersLink($article) {
 183+ global $wgUser;
 184+ $skin = $wgUser->getSkin();
 185+ return $skin->makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits');
188186 }
 187+
189188 ?>
Index: trunk/phase3/includes/PageHistory.php
@@ -576,6 +576,9 @@
577577 * @param string $type
578578 */
579579 function feed( $type ) {
 580+ require_once 'Feed.php';
 581+ require_once 'SpecialRecentchanges.php';
 582+
580583 global $wgFeedClasses;
581584 if( !isset( $wgFeedClasses[$type] ) ) {
582585 global $wgOut;
Index: trunk/phase3/includes/QueryPage.php
@@ -5,6 +5,11 @@
66 */
77
88 /**
 9+ *
 10+ */
 11+require_once 'Feed.php';
 12+
 13+/**
914 * List of query page classes and their associated special pages, for periodic update purposes
1015 */
1116 global $wgQueryPages; // not redundant
Index: trunk/phase3/includes/Skin.php
@@ -8,11 +8,28 @@
99 * @subpackage Skins
1010 */
1111
 12+# See skin.txt
 13+require_once( 'Linker.php' );
 14+require_once( 'Image.php' );
 15+
1216 # Get a list of available skins
1317 # Build using the regular expression '^(.*).php$'
1418 # Array keys are all lower case, array value keep the case used by filename
1519 #
1620
 21+$skinDir = dir( $wgStyleDirectory );
 22+
 23+# while code from www.php.net
 24+while (false !== ($file = $skinDir->read())) {
 25+ // Skip non-PHP files, hidden files, and '.dep' includes
 26+ if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
 27+ $aSkin = $matches[1];
 28+ $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
 29+ }
 30+}
 31+$skinDir->close();
 32+unset($matches);
 33+
1734 /**
1835 * The main skin class that provide methods and properties for all other skins.
1936 * This base class is also the "Standard" skin.
@@ -38,35 +55,9 @@
3956 */
4057 function getSkinNames() {
4158 global $wgValidSkinNames;
42 - if (!is_array($wgValidSkinNames)) {
43 - Skin::initializeSkinNames();
44 - }
4559 return $wgValidSkinNames;
4660 }
4761
48 - /**
49 - * Initializes set of available skins.
50 - * @return array of strings - skin names
51 - * @static
52 - */
53 -
54 - function initializeSkinNames() {
55 - global $wgStyleDirectory, $wgValidSkinNames;
56 - $skinDir = dir( $wgStyleDirectory );
57 -
58 - # while code from www.php.net
59 - while (false !== ($file = $skinDir->read())) {
60 - // Skip non-PHP files, hidden files, and '.dep' includes
61 - if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
62 - $aSkin = $matches[1];
63 - $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
64 - }
65 - }
66 - $skinDir->close();
67 - unset($matches);
68 -
69 - }
70 -
7162 /**
7263 * Normalize a skin preference value to a form that can be loaded.
7364 * If a skin can't be found, it will fall back to the configured
@@ -754,7 +745,7 @@
755746 $s = '';
756747 if ( $wgUser->isAnon() ) {
757748 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
758 - $n = ProxyTools::getIP();
 749+ $n = wfGetIP();
759750
760751 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
761752 $wgLang->getNsText( NS_TALK ) );
@@ -905,7 +896,8 @@
906897 }
907898
908899 if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
909 - $s .= ' ' . Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
 900+ require_once('Credits.php');
 901+ $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
910902 } else {
911903 $s .= $this->lastModified();
912904 }
@@ -1023,6 +1015,7 @@
10241016 */
10251017 function specialPagesList() {
10261018 global $wgUser, $wgContLang, $wgServer, $wgRedirectScript, $wgAvailableRights;
 1019+ require_once('SpecialPage.php');
10271020 $a = array();
10281021 $pages = SpecialPage::getPages();
10291022
Index: trunk/phase3/includes/LoadBalancer.php
@@ -7,6 +7,7 @@
88 /**
99 * Depends on the database object
1010 */
 11+require_once( 'Database.php' );
1112
1213 # Valid database indexes
1314 # Operation-based indexes
@@ -439,14 +440,12 @@
440441 }
441442
442443 extract( $server );
443 -
444444 # Get class for this database type
445 - if ($type != 'mysql' ) {
446 - $class = 'Database' . ucfirst( $type );
447 - } else {
448 - $class = 'Database';
 445+ $class = 'Database' . ucfirst( $type );
 446+ if ( !class_exists( $class ) ) {
 447+ require_once( "$class.php" );
449448 }
450 -
 449+
451450 # Create object
452451 $db = new $class( $host, $user, $password, $dbname, 1, $flags );
453452 $db->setLBInfo( $server );
Index: trunk/phase3/includes/SpecialPage.php
@@ -15,10 +15,6 @@
1616 * @subpackage SpecialPage
1717 */
1818
19 -/**
20 - * @todo put all global specialpages stuff into class
21 - */
22 -global $wgSpecialPages, $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
2319
2420 /**
2521 * @access private
Index: trunk/phase3/includes/LogPage.php
@@ -83,6 +83,7 @@
8484 $rcComment .= ': ' . $this->comment;
8585 }
8686
 87+ require_once( 'RecentChange.php' );
8788 RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
8889 $this->type, $this->action, $this->target, $this->comment, $this->params );
8990 }
Index: trunk/phase3/includes/SpecialVersion.php
@@ -190,7 +190,7 @@
191191 * @return string
192192 */
193193 function IPInfo() {
194 - $ip = str_replace( '--', ' - ', htmlspecialchars( ProxyTools::getIP() ) );
 194+ $ip = str_replace( '--', ' - ', htmlspecialchars( wfGetIP() ) );
195195 return "<!-- visited from $ip -->\n" .
196196 "<span style='display:none'>visited from $ip</span>";
197197 }
Index: trunk/phase3/includes/Math.php
@@ -248,13 +248,15 @@
249249 wfDebug( "TeX: getHashPath, hash is: $this->hash, path is: $path\n" );
250250 return $path;
251251 }
252 -
253 - static function renderMath ( $tex ) {
254 - global $wgUser;
255 - $math = new MathRenderer( $tex );
256 - $math->setOutputMode( $wgUser->getOption('math'));
257 - return $math->render();
258 - }
 252+
 253+
259254 }
260255
 256+function renderMath( $tex ) {
 257+ global $wgUser;
 258+ $math = new MathRenderer( $tex );
 259+ $math->setOutputMode( $wgUser->getOption('math'));
 260+ return $math->render();
 261+}
 262+
261263 ?>
Index: trunk/phase3/includes/SearchMySQL.php
@@ -24,6 +24,9 @@
2525 * @subpackage Search
2626 */
2727
 28+/** */
 29+require_once( 'SearchEngine.php' );
 30+
2831 /** @package MediaWiki */
2932 class SearchMySQL extends SearchEngine {
3033 /**
Index: trunk/phase3/includes/HistoryBlob.php
@@ -167,7 +167,18 @@
168168 }
169169 }
170170
 171+
171172 /**
 173+ * One-step cache variable to hold base blobs; operations that
 174+ * pull multiple revisions may often pull multiple times from
 175+ * the same blob. By keeping the last-used one open, we avoid
 176+ * redundant unserialization and decompression overhead.
 177+ */
 178+global $wgBlobCache;
 179+$wgBlobCache = array();
 180+
 181+
 182+/**
172183 * @package MediaWiki
173184 */
174185 class HistoryBlobStub {
@@ -204,15 +215,6 @@
205216 function getText() {
206217 $fname = 'HistoryBlob::getText';
207218 global $wgBlobCache;
208 - /**
209 - * One-step cache variable to hold base blobs; operations that
210 - * pull multiple revisions may often pull multiple times from
211 - * the same blob. By keeping the last-used one open, we avoid
212 - * redundant unserialization and decompression overhead.
213 - */
214 - if (!is_array($wgBlobCache)) {
215 - $wgBlobCache = array();
216 - }
217219 if( isset( $wgBlobCache[$this->mOldId] ) ) {
218220 $obj = $wgBlobCache[$this->mOldId];
219221 } else {
@@ -229,6 +231,7 @@
230232 wfProfileOut( $fname );
231233 return false;
232234 }
 235+ require_once('ExternalStore.php');
233236 $row->old_text=ExternalStore::fetchFromUrl($url);
234237
235238 }
Index: trunk/phase3/includes/Database.php
@@ -5,6 +5,11 @@
66 * @package MediaWiki
77 */
88
 9+/**
 10+ * Depends on the CacheManager
 11+ */
 12+require_once( 'CacheManager.php' );
 13+
914 /** See Database::makeList() */
1015 define( 'LIST_COMMA', 0 );
1116 define( 'LIST_AND', 1 );
Index: trunk/phase3/includes/DatabaseOracle.php
@@ -6,6 +6,11 @@
77 * @package MediaWiki
88 */
99
 10+/**
 11+ * Depends on database
 12+ */
 13+require_once( 'Database.php' );
 14+
1015 class OracleBlob extends DBObject {
1116 function isLOB() {
1217 return true;
Index: trunk/phase3/includes/CacheManager.php
@@ -6,6 +6,11 @@
77 */
88
99 /**
 10+ * We need the title class
 11+ */
 12+require_once( 'Title.php' );
 13+
 14+/**
1015 * Handles talking to the file cache, putting stuff in and taking it back out.
1116 * Mostly called from Article.php, also from DatabaseFunctions.php for the
1217 * emergency abort/fallback to cache.
Index: trunk/phase3/includes/ProxyTools.php
@@ -4,228 +4,230 @@
55 * @package MediaWiki
66 */
77
8 -class ProxyTools {
9 - function getForwardedFor() {
10 - if( function_exists( 'apache_request_headers' ) ) {
11 - // More reliable than $_SERVER due to case and -/_ folding
12 - $set = apache_request_headers();
13 - $index = 'X-Forwarded-For';
14 - } else {
15 - // Subject to spoofing with headers like X_Forwarded_For
16 - $set = $_SERVER;
17 - $index = 'HTTP_X_FORWARDED_FOR';
18 - }
19 - if( isset( $set[$index] ) ) {
20 - return $set[$index];
21 - } else {
22 - return null;
23 - }
 8+function wfGetForwardedFor() {
 9+ if( function_exists( 'apache_request_headers' ) ) {
 10+ // More reliable than $_SERVER due to case and -/_ folding
 11+ $set = apache_request_headers();
 12+ $index = 'X-Forwarded-For';
 13+ } else {
 14+ // Subject to spoofing with headers like X_Forwarded_For
 15+ $set = $_SERVER;
 16+ $index = 'HTTP_X_FORWARDED_FOR';
2417 }
 18+ if( isset( $set[$index] ) ) {
 19+ return $set[$index];
 20+ } else {
 21+ return null;
 22+ }
 23+}
2524
26 - /** Work out the IP address based on various globals */
27 - function getIP() {
28 - global $wgSquidServers, $wgSquidServersNoPurge, $wgIP;
 25+/** Work out the IP address based on various globals */
 26+function wfGetIP() {
 27+ global $wgSquidServers, $wgSquidServersNoPurge, $wgIP;
2928
30 - # Return cached result
31 - if ( !empty( $wgIP ) ) {
32 - return $wgIP;
33 - }
 29+ # Return cached result
 30+ if ( !empty( $wgIP ) ) {
 31+ return $wgIP;
 32+ }
3433
35 - /* collect the originating ips */
36 - # Client connecting to this webserver
37 - if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
38 - $ipchain = array( $_SERVER['REMOTE_ADDR'] );
39 - } else {
40 - # Running on CLI?
41 - $ipchain = array( '127.0.0.1' );
 34+ /* collect the originating ips */
 35+ # Client connecting to this webserver
 36+ if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
 37+ $ipchain = array( $_SERVER['REMOTE_ADDR'] );
 38+ } else {
 39+ # Running on CLI?
 40+ $ipchain = array( '127.0.0.1' );
 41+ }
 42+ $ip = $ipchain[0];
 43+
 44+ # Get list of trusted proxies
 45+ # Flipped for quicker access
 46+ $trustedProxies = array_flip( array_merge( $wgSquidServers, $wgSquidServersNoPurge ) );
 47+ if ( count( $trustedProxies ) ) {
 48+ # Append XFF on to $ipchain
 49+ $forwardedFor = wfGetForwardedFor();
 50+ if ( isset( $forwardedFor ) ) {
 51+ $xff = array_map( 'trim', explode( ',', $forwardedFor ) );
 52+ $xff = array_reverse( $xff );
 53+ $ipchain = array_merge( $ipchain, $xff );
4254 }
43 - $ip = $ipchain[0];
44 -
45 - # Get list of trusted proxies
46 - # Flipped for quicker access
47 - $trustedProxies = array_flip( array_merge( $wgSquidServers, $wgSquidServersNoPurge ) );
48 - if ( count( $trustedProxies ) ) {
49 - # Append XFF on to $ipchain
50 - $forwardedFor = ProxyTools::getForwardedFor();
51 - if ( isset( $forwardedFor ) ) {
52 - $xff = array_map( 'trim', explode( ',', $forwardedFor ) );
53 - $xff = array_reverse( $xff );
54 - $ipchain = array_merge( $ipchain, $xff );
55 - }
56 - # Step through XFF list and find the last address in the list which is a trusted server
57 - # Set $ip to the IP address given by that trusted server, unless the address is not sensible (e.g. private)
58 - foreach ( $ipchain as $i => $curIP ) {
59 - if ( array_key_exists( $curIP, $trustedProxies ) ) {
60 - if ( isset( $ipchain[$i + 1] ) && ProxyTools::isIPPublic( $ipchain[$i + 1] ) ) {
61 - $ip = $ipchain[$i + 1];
62 - }
63 - } else {
64 - break;
 55+ # Step through XFF list and find the last address in the list which is a trusted server
 56+ # Set $ip to the IP address given by that trusted server, unless the address is not sensible (e.g. private)
 57+ foreach ( $ipchain as $i => $curIP ) {
 58+ if ( array_key_exists( $curIP, $trustedProxies ) ) {
 59+ if ( isset( $ipchain[$i + 1] ) && wfIsIPPublic( $ipchain[$i + 1] ) ) {
 60+ $ip = $ipchain[$i + 1];
6561 }
 62+ } else {
 63+ break;
6664 }
6765 }
 66+ }
6867
69 - wfDebug( "IP: $ip\n" );
70 - $wgIP = $ip;
71 - return $ip;
 68+ wfDebug( "IP: $ip\n" );
 69+ $wgIP = $ip;
 70+ return $ip;
 71+}
 72+
 73+/**
 74+ * Given an IP address in dotted-quad notation, returns an unsigned integer.
 75+ * Like ip2long() except that it actually works and has a consistent error return value.
 76+ */
 77+function wfIP2Unsigned( $ip ) {
 78+ $n = ip2long( $ip );
 79+ if ( $n == -1 || $n === false ) { # Return value on error depends on PHP version
 80+ $n = false;
 81+ } elseif ( $n < 0 ) {
 82+ $n += pow( 2, 32 );
7283 }
 84+ return $n;
 85+}
7386
74 - /**
75 - * Given an IP address in dotted-quad notation, returns an unsigned integer.
76 - * Like ip2long() except that it actually works and has a consistent error return value.
77 - */
78 - function IP2Unsigned( $ip ) {
79 - $n = ip2long( $ip );
80 - if ( $n == -1 || $n === false ) { # Return value on error depends on PHP version
81 - $n = false;
82 - } elseif ( $n < 0 ) {
83 - $n += pow( 2, 32 );
84 - }
85 - return $n;
 87+/**
 88+ * Return a zero-padded hexadecimal representation of an IP address
 89+ */
 90+function wfIP2Hex( $ip ) {
 91+ $n = wfIP2Unsigned( $ip );
 92+ if ( $n !== false ) {
 93+ $n = sprintf( '%08X', $n );
8694 }
 95+ return $n;
 96+}
8797
88 - /**
89 - * Return a zero-padded hexadecimal representation of an IP address
90 - */
91 - function IP2Hex( $ip ) {
92 - $n = ProxyTools::IP2Unsigned( $ip );
93 - if ( $n !== false ) {
94 - $n = sprintf( '%08X', $n );
95 - }
96 - return $n;
 98+/**
 99+ * Determine if an IP address really is an IP address, and if it is public,
 100+ * i.e. not RFC 1918 or similar
 101+ */
 102+function wfIsIPPublic( $ip ) {
 103+ $n = wfIP2Unsigned( $ip );
 104+ if ( !$n ) {
 105+ return false;
97106 }
 107+
 108+ // ip2long accepts incomplete addresses, as well as some addresses
 109+ // followed by garbage characters. Check that it's really valid.
 110+ if( $ip != long2ip( $n ) ) {
 111+ return false;
 112+ }
98113
99 - /**
100 - * Determine if an IP address really is an IP address, and if it is public,
101 - * i.e. not RFC 1918 or similar
102 - */
103 - function isIPPublic( $ip ) {
104 - $n = ProxyTools::IP2Unsigned( $ip );
105 - if ( !$n ) {
 114+ static $privateRanges = false;
 115+ if ( !$privateRanges ) {
 116+ $privateRanges = array(
 117+ array( '10.0.0.0', '10.255.255.255' ), # RFC 1918 (private)
 118+ array( '172.16.0.0', '172.31.255.255' ), # "
 119+ array( '192.168.0.0', '192.168.255.255' ), # "
 120+ array( '0.0.0.0', '0.255.255.255' ), # this network
 121+ array( '127.0.0.0', '127.255.255.255' ), # loopback
 122+ );
 123+ }
 124+
 125+ foreach ( $privateRanges as $r ) {
 126+ $start = wfIP2Unsigned( $r[0] );
 127+ $end = wfIP2Unsigned( $r[1] );
 128+ if ( $n >= $start && $n <= $end ) {
106129 return false;
107130 }
108 -
109 - // ip2long accepts incomplete addresses, as well as some addresses
110 - // followed by garbage characters. Check that it's really valid.
111 - if( $ip != long2ip( $n ) ) {
112 - return false;
113 - }
 131+ }
 132+ return true;
 133+}
114134
115 - static $privateRanges = false;
116 - if ( !$privateRanges ) {
117 - $privateRanges = array(
118 - array( '10.0.0.0', '10.255.255.255' ), # RFC 1918 (private)
119 - array( '172.16.0.0', '172.31.255.255' ), # "
120 - array( '192.168.0.0', '192.168.255.255' ), # "
121 - array( '0.0.0.0', '0.255.255.255' ), # this network
122 - array( '127.0.0.0', '127.255.255.255' ), # loopback
123 - );
124 - }
 135+/**
 136+ * Forks processes to scan the originating IP for an open proxy server
 137+ * MemCached can be used to skip IPs that have already been scanned
 138+ */
 139+function wfProxyCheck() {
 140+ global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath;
 141+ global $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry;
 142+ global $wgProxyKey;
125143
126 - foreach ( $privateRanges as $r ) {
127 - $start = ProxyTools::IP2Unsigned( $r[0] );
128 - $end = ProxyTools::IP2Unsigned( $r[1] );
129 - if ( $n >= $start && $n <= $end ) {
130 - return false;
131 - }
132 - }
133 - return true;
 144+ if ( !$wgBlockOpenProxies ) {
 145+ return;
134146 }
135147
136 - /**
137 - * Forks processes to scan the originating IP for an open proxy server
138 - * MemCached can be used to skip IPs that have already been scanned
139 - */
140 - function proxyCheck() {
141 - global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath;
142 - global $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry;
143 - global $wgProxyKey;
 148+ $ip = wfGetIP();
144149
145 - if ( !$wgBlockOpenProxies ) {
146 - return;
 150+ # Get MemCached key
 151+ $skip = false;
 152+ if ( $wgUseMemCached ) {
 153+ $mcKey = "$wgDBname:proxy:ip:$ip";
 154+ $mcValue = $wgMemc->get( $mcKey );
 155+ if ( $mcValue ) {
 156+ $skip = true;
147157 }
 158+ }
148159
149 - $ip = ProxyTools::getIP();
 160+ # Fork the processes
 161+ if ( !$skip ) {
 162+ $title = Title::makeTitle( NS_SPECIAL, 'Blockme' );
 163+ $iphash = md5( $ip . $wgProxyKey );
 164+ $url = $title->getFullURL( 'ip='.$iphash );
150165
151 - # Get MemCached key
152 - $skip = false;
 166+ foreach ( $wgProxyPorts as $port ) {
 167+ $params = implode( ' ', array(
 168+ escapeshellarg( $wgProxyScriptPath ),
 169+ escapeshellarg( $ip ),
 170+ escapeshellarg( $port ),
 171+ escapeshellarg( $url )
 172+ ));
 173+ exec( "php $params &>/dev/null &" );
 174+ }
 175+ # Set MemCached key
153176 if ( $wgUseMemCached ) {
154 - $mcKey = "$wgDBname:proxy:ip:$ip";
155 - $mcValue = $wgMemc->get( $mcKey );
156 - if ( $mcValue ) {
157 - $skip = true;
158 - }
 177+ $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry );
159178 }
 179+ }
 180+}
160181
161 - # Fork the processes
162 - if ( !$skip ) {
163 - $title = Title::makeTitle( NS_SPECIAL, 'Blockme' );
164 - $iphash = md5( $ip . $wgProxyKey );
165 - $url = $title->getFullURL( 'ip='.$iphash );
 182+/**
 183+ * Convert a network specification in CIDR notation to an integer network and a number of bits
 184+ */
 185+function wfParseCIDR( $range ) {
 186+ $parts = explode( '/', $range, 2 );
 187+ if ( count( $parts ) != 2 ) {
 188+ return array( false, false );
 189+ }
 190+ $network = wfIP2Unsigned( $parts[0] );
 191+ if ( $network !== false && is_numeric( $parts[1] ) && $parts[1] >= 0 && $parts[1] <= 32 ) {
 192+ $bits = $parts[1];
 193+ } else {
 194+ $network = false;
 195+ $bits = false;
 196+ }
 197+ return array( $network, $bits );
 198+}
166199
167 - foreach ( $wgProxyPorts as $port ) {
168 - $params = implode( ' ', array(
169 - escapeshellarg( $wgProxyScriptPath ),
170 - escapeshellarg( $ip ),
171 - escapeshellarg( $port ),
172 - escapeshellarg( $url )
173 - ));
174 - exec( "php $params &>/dev/null &" );
175 - }
176 - # Set MemCached key
177 - if ( $wgUseMemCached ) {
178 - $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry );
179 - }
180 - }
 200+/**
 201+ * Check if an IP address is in the local proxy list
 202+ */
 203+function wfIsLocallyBlockedProxy( $ip ) {
 204+ global $wgProxyList;
 205+ $fname = 'wfIsLocallyBlockedProxy';
 206+
 207+ if ( !$wgProxyList ) {
 208+ return false;
181209 }
 210+ wfProfileIn( $fname );
182211
183 - /**
184 - * Convert a network specification in CIDR notation to an integer network and a number of bits
185 - */
186 - function parseCIDR( $range ) {
187 - $parts = explode( '/', $range, 2 );
188 - if ( count( $parts ) != 2 ) {
189 - return array( false, false );
190 - }
191 - $network = ProxyTools::IP2Unsigned( $parts[0] );
192 - if ( $network !== false && is_numeric( $parts[1] ) && $parts[1] >= 0 && $parts[1] <= 32 ) {
193 - $bits = $parts[1];
194 - } else {
195 - $network = false;
196 - $bits = false;
197 - }
198 - return array( $network, $bits );
 212+ if ( !is_array( $wgProxyList ) ) {
 213+ # Load from the specified file
 214+ $wgProxyList = array_map( 'trim', file( $wgProxyList ) );
199215 }
200216
201 - /**
202 - * Check if an IP address is in the local proxy list
203 - */
204 - function isLocallyBlockedProxy( $ip ) {
205 - global $wgProxyList;
206 - $fname = 'ProxyTools::isLocallyBlockedProxy';
 217+ if ( !is_array( $wgProxyList ) ) {
 218+ $ret = false;
 219+ } elseif ( array_search( $ip, $wgProxyList ) !== false ) {
 220+ $ret = true;
 221+ } elseif ( array_key_exists( $ip, $wgProxyList ) ) {
 222+ # Old-style flipped proxy list
 223+ $ret = true;
 224+ } else {
 225+ $ret = false;
 226+ }
 227+ wfProfileOut( $fname );
 228+ return $ret;
 229+}
207230
208 - if ( !$wgProxyList ) {
209 - return false;
210 - }
211 - wfProfileIn( $fname );
212231
213 - if ( !is_array( $wgProxyList ) ) {
214 - # Load from the specified file
215 - $wgProxyList = array_map( 'trim', file( $wgProxyList ) );
216 - }
217232
218 - if ( !is_array( $wgProxyList ) ) {
219 - $ret = false;
220 - } elseif ( array_search( $ip, $wgProxyList ) !== false ) {
221 - $ret = true;
222 - } elseif ( array_key_exists( $ip, $wgProxyList ) ) {
223 - # Old-style flipped proxy list
224 - $ret = true;
225 - } else {
226 - $ret = false;
227 - }
228 - wfProfileOut( $fname );
229 - return $ret;
230 - }
231 -}
 233+
232234 ?>
Index: trunk/phase3/includes/CategoryPage.php
@@ -10,6 +10,9 @@
1111 die( -1 );
1212
1313 global $wgCategoryMagicGallery;
 14+if( $wgCategoryMagicGallery )
 15+ /** */
 16+ require_once('ImageGallery.php');
1417
1518 /**
1619 * @package MediaWiki
Index: trunk/phase3/includes/User.php
@@ -5,6 +5,11 @@
66 * @package MediaWiki
77 */
88
 9+/**
 10+ *
 11+ */
 12+require_once( 'WatchedItem.php' );
 13+
914 # Number of characters in user_token field
1015 define( 'USER_TOKEN_LENGTH', 32 );
1116
@@ -428,7 +433,7 @@
429434 wfDebug( "$fname: checking...\n" );
430435
431436 $this->mBlockedby = 0;
432 - $ip = ProxyTools::getIP();
 437+ $ip = wfGetIP();
433438
434439 # User/IP blocking
435440 $block = new Block();
@@ -449,7 +454,7 @@
450455 if ( !$this->isAllowed('proxyunbannable') && !in_array( $ip, $wgProxyWhitelist ) ) {
451456
452457 # Local list
453 - if ( ProxyTools::isLocallyBlockedProxy( $ip ) ) {
 458+ if ( wfIsLocallyBlockedProxy( $ip ) ) {
454459 $this->mBlockedby = wfMsg( 'proxyblocker' );
455460 $this->mBlockreason = wfMsg( 'proxyblockreason' );
456461 }
@@ -533,7 +538,7 @@
534539 $limits = $wgRateLimits[$action];
535540 $keys = array();
536541 $id = $this->getId();
537 - $ip = ProxyTools::getIP();
 542+ $ip = wfGetIP();
538543
539544 if( isset( $limits['anon'] ) && $id == 0 ) {
540545 $keys["$wgDBname:limiter:$action:anon"] = $limits['anon'];
@@ -785,7 +790,7 @@
786791 function getName() {
787792 $this->loadFromDatabase();
788793 if ( $this->mName === false ) {
789 - $this->mName = ProxyTools::getIP();
 794+ $this->mName = wfGetIP();
790795 }
791796 return $this->mName;
792797 }
@@ -1521,7 +1526,7 @@
15221527 }
15231528
15241529 # Check if this IP address is already blocked
1525 - $ipblock = Block::newFromDB( ProxyTools::getIP() );
 1530+ $ipblock = Block::newFromDB( wfGetIP() );
15261531 if ( $ipblock->isValid() ) {
15271532 # If the user is already blocked. Then check if the autoblock would
15281533 # excede the user block. If it would excede, then do nothing, else
@@ -1536,8 +1541,8 @@
15371542 }
15381543
15391544 # Make a new block object with the desired properties
1540 - wfDebug( "Autoblocking {$this->mName}@" . ProxyTools::getIP() . "\n" );
1541 - $ipblock->mAddress = ProxyTools::getIP();
 1545+ wfDebug( "Autoblocking {$this->mName}@" . wfGetIP() . "\n" );
 1546+ $ipblock->mAddress = wfGetIP();
15421547 $ipblock->mUser = 0;
15431548 $ipblock->mBy = $userblock->mBy;
15441549 $ipblock->mReason = wfMsg( 'autoblocker', $this->getName(), $userblock->mReason );
@@ -1757,7 +1762,7 @@
17581763 $url = $this->confirmationTokenUrl( $expiration );
17591764 return $this->sendMail( wfMsg( 'confirmemail_subject' ),
17601765 wfMsg( 'confirmemail_body',
1761 - ProxyTools::getIP(),
 1766+ wfGetIP(),
17621767 $this->getName(),
17631768 $url,
17641769 $wgContLang->timeanddate( $expiration, false ) ) );
Index: trunk/phase3/includes/Article.php
@@ -4,6 +4,12 @@
55 * @package MediaWiki
66 */
77
 8+/**
 9+ * Need the CacheManager to be loaded
 10+ */
 11+require_once( 'CacheManager.php' );
 12+require_once( 'Revision.php' );
 13+
814 $wgArticleCurContentFields = false;
915 $wgArticleOldContentFields = false;
1016
@@ -756,6 +762,7 @@
757763 # diff page instead of the article.
758764
759765 if ( !is_null( $diff ) ) {
 766+ require_once( 'DifferenceEngine.php' );
760767 $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
761768
762769 $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid );
@@ -1226,6 +1233,7 @@
12271234
12281235 Article::onArticleCreate( $this->mTitle );
12291236 if(!$suppressRC) {
 1237+ require_once( 'RecentChange.php' );
12301238 $rcid = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, 'default',
12311239 '', strlen( $text ), $revisionId );
12321240 # Mark as patrolled if the user can and has the option set
@@ -1432,6 +1440,7 @@
14331441 $dbw->rollback();
14341442 } else {
14351443 # Update recentchanges and purge cache and whatnot
 1444+ require_once( 'RecentChange.php' );
14361445 $bot = (int)($wgUser->isBot() || $forceBot);
14371446 $rcid = RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary,
14381447 $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
@@ -1555,6 +1564,7 @@
15561565 $rcid = $wgRequest->getVal( 'rcid' );
15571566 if ( !is_null ( $rcid ) ) {
15581567 if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, false ) ) ) {
 1568+ require_once( 'RecentChange.php' );
15591569 RecentChange::markPatrolled( $rcid );
15601570 wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
15611571 $wgOut->setPagetitle( wfMsg( 'markedaspatrolled' ) );
@@ -1669,6 +1679,7 @@
16701680 * action=protect handler
16711681 */
16721682 function protect() {
 1683+ require_once 'ProtectionForm.php';
16731684 $form = new ProtectionForm( $this );
16741685 $form->show();
16751686 }
Index: trunk/phase3/includes/RecentChange.php
@@ -205,7 +205,7 @@
206206 }
207207
208208 if ( !$ip ) {
209 - $ip = ProxyTools::getIP();
 209+ $ip = wfGetIP();
210210 if ( !$ip ) {
211211 $ip = '';
212212 }
@@ -249,7 +249,7 @@
250250 $ip='', $size = 0, $newId = 0 )
251251 {
252252 if ( !$ip ) {
253 - $ip = ProxyTools::getIP();
 253+ $ip = wfGetIP();
254254 if ( !$ip ) {
255255 $ip = '';
256256 }
@@ -294,7 +294,7 @@
295295 /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false )
296296 {
297297 if ( !$ip ) {
298 - $ip = ProxyTools::getIP();
 298+ $ip = wfGetIP();
299299 if ( !$ip ) {
300300 $ip = '';
301301 }
@@ -344,7 +344,7 @@
345345 $type, $action, $target, $logComment, $params )
346346 {
347347 if ( !$ip ) {
348 - $ip = ProxyTools::getIP();
 348+ $ip = wfGetIP();
349349 if ( !$ip ) {
350350 $ip = '';
351351 }
Index: trunk/phase3/includes/Profiling.php
@@ -278,6 +278,7 @@
279279 }
280280 }
281281 $prof .= "\nTotal: $total\n\n";
 282+
282283 return $prof;
283284 }
284285
@@ -321,6 +322,7 @@
322323 } else {
323324 $pfhost = '';
324325 }
 326+
325327 $sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, "."pf_time=pf_time + {$timeSum} ".
326328 "WHERE pf_name='{$encname}' AND pf_server='{$pfhost}'";
327329 $dbw->query($sql);
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -27,6 +27,8 @@
2828
2929
3030 require_once( 'DatabaseFunctions.php' );
 31+require_once( 'UpdateClasses.php' );
 32+require_once( 'LogPage.php' );
3133 require_once( 'normal/UtfNormalUtil.php' );
3234 require_once( 'XmlFunctions.php' );
3335
@@ -1506,6 +1508,11 @@
15071509 return $wgMimeMagic;
15081510 }
15091511
 1512+ if (!class_exists("MimeMagic")) {
 1513+ #include on demand
 1514+ require_once("MimeMagic.php");
 1515+ }
 1516+
15101517 $wgMimeMagic= new MimeMagic();
15111518
15121519 return $wgMimeMagic;
@@ -1854,27 +1861,4 @@
18551862 }
18561863 }
18571864
1858 -/***** DEPRECATED INTERFACES *******/
1859 -function wfGetForwardedFor() { return ProxyTools::getForwardedFor(); }
1860 -function wfGetIP() { return ProxyTools::getIP(); }
1861 -function wfIP2Unsigned($ip) { return ProxyTools::IP2Unsigned($ip); }
1862 -function wfIP2Hex($ip) { return ProxyTools::IP2Hex($ip); }
1863 -function wfIsIPPublic($ip) { return ProxyTools::isIPPublic($ip); }
1864 -function wfProxyCheck() { return ProxyTools::proxyCheck(); }
1865 -function wfParseCIDR($range) { return ProxyTools::parseCIDR($range); }
1866 -function wfIsLocallyBlockedProxy($ip) { return ProxyTools::isLocallyBlockedProxy($ip); }
1867 -
1868 -function wfGetCache($type) { return ObjectCacheManager::getCache($type); }
1869 -function wfGetMainCache() { return ObjectCacheManager::getMainCache(); }
1870 -function wfGetMessageCacheStorage() { return ObjectCacheManager::getMessageCache(); }
1871 -function wfGetParserCacheStorage() { return ObjectCacheManager::getParserCache(); }
1872 -
1873 -function renderMath($tex) { return MathRenderer::renderMath($tex); }
1874 -
1875 -function showCreditsPage($article) { return Credits::showCreditsPage($article); }
1876 -function getCredits($article, $cnt, $showIfMax=true) { return Credits::getCredits($article,$cnt,$showIfMax); }
1877 -
1878 -function wfGetHTTP( $url, $timeout = 'default' ) { return HttpFunctions::getHTTP($url,$timeout); }
1879 -function wfIsLocalURL( $url ) { return HttpFunctions::isLocalURL($url); }
1880 -
18811865 ?>
Index: trunk/phase3/includes/ObjectCache.php
@@ -33,91 +33,93 @@
3434 global $wgCaches;
3535 $wgCaches = array();
3636
37 -class ObjectCacheManager {
38 - /* @static */
39 - function getCache( $inputType ) {
40 - global $wgCaches, $wgMemCachedServers, $wgMemCachedDebug, $wgMemCachedPersistent;
41 - $cache = false;
 37+/** @todo document */
 38+function &wfGetCache( $inputType ) {
 39+ global $wgCaches, $wgMemCachedServers, $wgMemCachedDebug, $wgMemCachedPersistent;
 40+ $cache = false;
4241
43 - if ( $inputType == CACHE_ANYTHING ) {
44 - reset( $wgCaches );
45 - $type = key( $wgCaches );
46 - if ( $type === false || $type === CACHE_NONE ) {
47 - $type = CACHE_DB;
48 - }
49 - } else {
50 - $type = $inputType;
 42+ if ( $inputType == CACHE_ANYTHING ) {
 43+ reset( $wgCaches );
 44+ $type = key( $wgCaches );
 45+ if ( $type === false || $type === CACHE_NONE ) {
 46+ $type = CACHE_DB;
5147 }
 48+ } else {
 49+ $type = $inputType;
 50+ }
5251
53 - if ( $type == CACHE_MEMCACHED ) {
54 - if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ){
55 - $wgCaches[CACHE_DB] = new MemCachedClientforWiki(
56 - array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) );
57 - $cache =& $wgCaches[CACHE_DB];
58 - $cache->set_servers( $wgMemCachedServers );
59 - $cache->set_debug( $wgMemCachedDebug );
60 - }
61 - } elseif ( $type == CACHE_ACCEL ) {
62 - if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) {
63 - if ( function_exists( 'eaccelerator_get' ) ) {
64 - $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff;
65 - } elseif ( function_exists( 'apc_fetch') ) {
66 - $wgCaches[CACHE_ACCEL] = new APCBagOStuff;
67 - } elseif ( function_exists( 'mmcache_get' ) ) {
68 - $wgCaches[CACHE_ACCEL] = new TurckBagOStuff;
69 - } else {
70 - $wgCaches[CACHE_ACCEL] = false;
 52+ if ( $type == CACHE_MEMCACHED ) {
 53+ if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ){
 54+ require_once( 'memcached-client.php' );
 55+
 56+ if (!class_exists("MemcachedClientforWiki")) {
 57+ class MemCachedClientforWiki extends memcached {
 58+ function _debugprint( $text ) {
 59+ wfDebug( "memcached: $text\n" );
 60+ }
7161 }
7262 }
73 - if ( $wgCaches[CACHE_ACCEL] !== false ) {
74 - $cache =& $wgCaches[CACHE_ACCEL];
75 - }
76 - }
7763
78 - if ( $type == CACHE_DB || ( $inputType == CACHE_ANYTHING && $cache === false ) ) {
79 - if ( !array_key_exists( CACHE_DB, $wgCaches ) ) {
80 - $wgCaches[CACHE_DB] = new MediaWikiBagOStuff('objectcache');
81 - }
 64+ $wgCaches[CACHE_DB] = new MemCachedClientforWiki(
 65+ array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) );
8266 $cache =& $wgCaches[CACHE_DB];
 67+ $cache->set_servers( $wgMemCachedServers );
 68+ $cache->set_debug( $wgMemCachedDebug );
8369 }
84 -
85 - if ( $cache === false ) {
86 - if ( !array_key_exists( CACHE_NONE, $wgCaches ) ) {
87 - $wgCaches[CACHE_NONE] = new FakeMemCachedClient;
 70+ } elseif ( $type == CACHE_ACCEL ) {
 71+ if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) {
 72+ if ( function_exists( 'eaccelerator_get' ) ) {
 73+ require_once( 'BagOStuff.php' );
 74+ $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff;
 75+ } elseif ( function_exists( 'apc_fetch') ) {
 76+ require_once( 'BagOStuff.php' );
 77+ $wgCaches[CACHE_ACCEL] = new APCBagOStuff;
 78+ } elseif ( function_exists( 'mmcache_get' ) ) {
 79+ require_once( 'BagOStuff.php' );
 80+ $wgCaches[CACHE_ACCEL] = new TurckBagOStuff;
 81+ } else {
 82+ $wgCaches[CACHE_ACCEL] = false;
8883 }
89 - $cache =& $wgCaches[CACHE_NONE];
9084 }
 85+ if ( $wgCaches[CACHE_ACCEL] !== false ) {
 86+ $cache =& $wgCaches[CACHE_ACCEL];
 87+ }
 88+ }
9189
92 - return $cache;
 90+ if ( $type == CACHE_DB || ( $inputType == CACHE_ANYTHING && $cache === false ) ) {
 91+ if ( !array_key_exists( CACHE_DB, $wgCaches ) ) {
 92+ require_once( 'BagOStuff.php' );
 93+ $wgCaches[CACHE_DB] = new MediaWikiBagOStuff('objectcache');
 94+ }
 95+ $cache =& $wgCaches[CACHE_DB];
9396 }
94 -
95 - /** @static */
96 - function &getMainCache() {
97 - global $wgMainCacheType;
98 - $ret =& ObjectCacheManager::getCache( $wgMainCacheType );
99 - return $ret;
 97+
 98+ if ( $cache === false ) {
 99+ if ( !array_key_exists( CACHE_NONE, $wgCaches ) ) {
 100+ $wgCaches[CACHE_NONE] = new FakeMemCachedClient;
 101+ }
 102+ $cache =& $wgCaches[CACHE_NONE];
100103 }
101104
102 - /** @static */
103 - function &getMessageCache() {
104 - global $wgMessageCacheType;
105 - $ret =& ObjectCacheManager::getCache( $wgMessageCacheType );
106 - return $ret;
107 - }
108 -
109 - /** @static */
110 - function &getParserCache() {
111 - global $wgParserCacheType;
112 - $ret =& ObjectCacheManager::getCache( $wgParserCacheType );
113 - return $ret;
114 - }
115 -
 105+ return $cache;
116106 }
117107
118 -class MemCachedClientforWiki extends memcached {
119 - function _debugprint( $text ) {
120 - wfDebug( "memcached: $text\n" );
121 - }
 108+function &wfGetMainCache() {
 109+ global $wgMainCacheType;
 110+ $ret =& wfGetCache( $wgMainCacheType );
 111+ return $ret;
122112 }
123113
 114+function &wfGetMessageCacheStorage() {
 115+ global $wgMessageCacheType;
 116+ $ret =& wfGetCache( $wgMessageCacheType );
 117+ return $ret;
 118+}
 119+
 120+function &wfGetParserCacheStorage() {
 121+ global $wgParserCacheType;
 122+ $ret =& wfGetCache( $wgParserCacheType );
 123+ return $ret;
 124+}
 125+
124126 ?>
Index: trunk/phase3/includes/UpdateClasses.php
@@ -5,4 +5,13 @@
66 * @package MediaWiki
77 */
88
 9+/**
 10+ *
 11+ */
 12+
 13+require_once( 'SiteStatsUpdate.php' );
 14+require_once( 'LinksUpdate.php' );
 15+require_once( 'SearchUpdate.php' );
 16+require_once( 'SquidUpdate.php' );
 17+
918 ?>
\ No newline at end of file
Index: trunk/phase3/includes/SpecialUserlogin.php
@@ -210,7 +210,7 @@
211211 return false;
212212 }
213213
214 - $ip = ProxyTools::getIP();
 214+ $ip = wfGetIP();
215215 if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) &&
216216 $wgUser->inSorbsBlacklist( $ip ) )
217217 {
@@ -416,7 +416,7 @@
417417
418418 $u->saveSettings();
419419
420 - $ip = ProxyTools::getIP();
 420+ $ip = wfGetIP();
421421 if ( '' == $ip ) { $ip = '(Unknown)'; }
422422
423423 $m = wfMsg( 'passwordremindertext', $ip, $u->getName(), $np, $wgServer . $wgScript );
Index: trunk/phase3/includes/MessageCache.php
@@ -5,6 +5,9 @@
66 * @subpackage Cache
77 */
88
 9+/** */
 10+require_once( 'Revision.php' );
 11+
912 /**
1013 *
1114 */

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r14512Fix for DynamicPageList, which registers a mixed-case tag name....brion06:41, 1 June 2006

Status & tagging log