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 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** |
| 10 | + * |
| 11 | + */ |
| 12 | +require_once( 'Feed.php' ); |
| 13 | +require_once( 'ChangesList.php' ); |
| 14 | +require_once( 'Revision.php' ); |
| 15 | + |
| 16 | +/** |
10 | 17 | * Constructor |
11 | 18 | */ |
12 | 19 | function wfSpecialRecentchanges( $par, $specialPage ) { |
Index: trunk/phase3/includes/ParserXML.php |
— | — | @@ -5,6 +5,9 @@ |
6 | 6 | * @subpackage Experimental |
7 | 7 | */ |
8 | 8 | |
| 9 | +/** */ |
| 10 | +require_once ('Parser.php'); |
| 11 | + |
9 | 12 | /** |
10 | 13 | * This should one day become the XML->(X)HTML parser |
11 | 14 | * Based on work by Jan Hidders and Magnus Manske |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -9,6 +9,8 @@ |
10 | 10 | if( !defined( 'MEDIAWIKI' ) ) |
11 | 11 | die( -1 ); |
12 | 12 | |
| 13 | +require_once( 'Image.php' ); |
| 14 | + |
13 | 15 | /** |
14 | 16 | * Special handling for image description pages |
15 | 17 | * @package MediaWiki |
— | — | @@ -307,8 +309,9 @@ |
308 | 310 | $wgOut->addHTML($sharedtext); |
309 | 311 | |
310 | 312 | if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) { |
| 313 | + require_once("HttpFunctions.php"); |
311 | 314 | $ur = ini_set('allow_url_fopen', true); |
312 | | - $text = HttpFunctions::getHTTP($url . '?action=render'); |
| 315 | + $text = wfGetHTTP($url . '?action=render'); |
313 | 316 | ini_set('allow_url_fopen', $ur); |
314 | 317 | if ($text) |
315 | 318 | $this->mExtraDescription = $text; |
— | — | @@ -671,6 +674,7 @@ |
672 | 675 | } |
673 | 676 | |
674 | 677 | function blockedIPpage() { |
| 678 | + require_once( 'EditPage.php' ); |
675 | 679 | $edit = new EditPage( $this ); |
676 | 680 | return $edit->blockedIPpage(); |
677 | 681 | } |
Index: trunk/phase3/includes/AjaxDispatcher.php |
— | — | @@ -1,5 +1,18 @@ |
2 | 2 | <?php |
3 | 3 | |
| 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' ); |
4 | 17 | require_once( 'AjaxFunctions.php' ); |
5 | 18 | |
6 | 19 | if ( ! $wgUseAjax ) { |
Index: trunk/phase3/includes/SearchEngine.php |
— | — | @@ -195,8 +195,10 @@ |
196 | 196 | $class = $wgSearchType; |
197 | 197 | } elseif( $wgDBtype == 'mysql' ) { |
198 | 198 | $class = 'SearchMySQL4'; |
| 199 | + require_once( 'SearchMySQL4.php' ); |
199 | 200 | } else if ( $wgDBtype == 'PostgreSQL' ) { |
200 | 201 | $class = 'SearchTsearch2'; |
| 202 | + require_once( 'SearchTsearch2.php' ); |
201 | 203 | } else { |
202 | 204 | $class = 'SearchEngineDummy'; |
203 | 205 | } |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -6,6 +6,11 @@ |
7 | 7 | * @subpackage Parser |
8 | 8 | */ |
9 | 9 | |
| 10 | +/** */ |
| 11 | +require_once( 'Sanitizer.php' ); |
| 12 | +require_once( 'HttpFunctions.php' ); |
| 13 | +require_once( 'ImageGallery.php' ); |
| 14 | + |
10 | 15 | /** |
11 | 16 | * Update this version number when the ParserOutput format |
12 | 17 | * changes in an incompatible way, so the parser cache |
— | — | @@ -447,7 +452,7 @@ |
448 | 453 | $output = wfEscapeHTMLTagsOnly( $content ); |
449 | 454 | break; |
450 | 455 | case 'math': |
451 | | - $output = MathRenderer::renderMath( $content ); |
| 456 | + $output = renderMath( $content ); |
452 | 457 | break; |
453 | 458 | case 'pre': |
454 | 459 | // Backwards-compatibility hack |
— | — | @@ -2967,7 +2972,7 @@ |
2968 | 2973 | } |
2969 | 2974 | } |
2970 | 2975 | |
2971 | | - $text = HttpFunctions::getHTTP($url); |
| 2976 | + $text = wfGetHTTP($url); |
2972 | 2977 | if (!$text) |
2973 | 2978 | return wfMsg('scarytranscludefailed', $url); |
2974 | 2979 | |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -22,14 +22,13 @@ |
23 | 23 | die( -1 ); |
24 | 24 | } |
25 | 25 | |
26 | | -require('AutoLoader.php'); |
27 | | - |
28 | 26 | if( !isset( $wgProfiling ) ) |
29 | 27 | $wgProfiling = false; |
30 | 28 | |
31 | 29 | if ( function_exists( 'wfProfileIn' ) ) { |
32 | 30 | /* nada, everything should be done already */ |
33 | 31 | } elseif ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) { |
| 32 | + require_once( 'Profiling.php' ); |
34 | 33 | $wgProfiling = true; |
35 | 34 | if ($wgProfilerType == "") { |
36 | 35 | $wgProfiler = new Profiler(); |
— | — | @@ -49,8 +48,29 @@ |
50 | 49 | require_once( 'GlobalFunctions.php' ); |
51 | 50 | require_once( 'Hooks.php' ); |
52 | 51 | 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' ); |
53 | 59 | 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' ); |
54 | 71 | |
| 72 | +if ( $wgUseDynamicDates ) { |
| 73 | + require_once( 'DateFormatter.php' ); |
| 74 | +} |
55 | 75 | |
56 | 76 | wfProfileOut( $fname.'-includes' ); |
57 | 77 | wfProfileIn( $fname.'-misc1' ); |
— | — | @@ -88,9 +108,9 @@ |
89 | 109 | wfProfileOut( $fname.'-misc1' ); |
90 | 110 | wfProfileIn( $fname.'-memcached' ); |
91 | 111 | |
92 | | -$wgMemc =& ObjectCacheManager::getMainCache(); |
93 | | -$messageMemc =& ObjectCacheManager::getMessageCache(); |
94 | | -$parserMemc =& ObjectCacheManager::getParserCache(); |
| 112 | +$wgMemc =& wfGetMainCache(); |
| 113 | +$messageMemc =& wfGetMessageCacheStorage(); |
| 114 | +$parserMemc =& wfGetParserCacheStorage(); |
95 | 115 | |
96 | 116 | wfDebug( 'Main cache: ' . get_class( $wgMemc ) . |
97 | 117 | "\nMessage cache: " . get_class( $messageMemc ) . |
— | — | @@ -188,6 +208,7 @@ |
189 | 209 | } |
190 | 210 | |
191 | 211 | if( !is_object( $wgAuth ) ) { |
| 212 | + require_once( 'AuthPlugin.php' ); |
192 | 213 | $wgAuth = new AuthPlugin(); |
193 | 214 | } |
194 | 215 | |
— | — | @@ -275,6 +296,7 @@ |
276 | 297 | $wgMwRedir =& MagicWord::get( MAG_REDIRECT ); |
277 | 298 | |
278 | 299 | if ( $wgUseXMLparser ) { |
| 300 | + require_once( 'ParserXML.php' ); |
279 | 301 | $wgParser = new ParserXML(); |
280 | 302 | } else { |
281 | 303 | $wgParser = new Parser(); |
Index: trunk/phase3/includes/SpecialBlockme.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | { |
14 | 14 | global $wgBlockOpenProxies, $wgOut, $wgProxyKey; |
15 | 15 | |
16 | | - $ip = ProxyTools::getIP(); |
| 16 | + $ip = wfGetIP(); |
17 | 17 | |
18 | 18 | if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $ip . $wgProxyKey ) ) { |
19 | 19 | $wgOut->addWikiText( wfMsg( "disabled" ) ); |
Index: trunk/phase3/includes/Export.php |
— | — | @@ -22,6 +22,9 @@ |
23 | 23 | * @subpackage SpecialPage |
24 | 24 | */ |
25 | 25 | |
| 26 | +/** */ |
| 27 | +require_once( 'Revision.php' ); |
| 28 | + |
26 | 29 | define( 'MW_EXPORT_FULL', 0 ); |
27 | 30 | define( 'MW_EXPORT_CURRENT', 1 ); |
28 | 31 | |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -725,7 +725,7 @@ |
726 | 726 | $this->summary = ''; |
727 | 727 | if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI ) |
728 | 728 | $this->textbox1 = wfMsgWeirdKey ( $this->mArticle->mTitle->getText() ) ; |
729 | | - ProxyTools::proxyCheck(); |
| 729 | + wfProxyCheck(); |
730 | 730 | } |
731 | 731 | |
732 | 732 | /** |
— | — | @@ -1118,6 +1118,7 @@ |
1119 | 1119 | $wgOut->addHTML( "<input type=\"hidden\" name=\"wpAutoSummary\" value=\"$autosumm\" />\n" ); |
1120 | 1120 | |
1121 | 1121 | if ( $this->isConflict ) { |
| 1122 | + require_once( "DifferenceEngine.php" ); |
1122 | 1123 | $wgOut->addWikiText( '==' . wfMsg( "yourdiff" ) . '==' ); |
1123 | 1124 | |
1124 | 1125 | $de = new DifferenceEngine( $this->mTitle ); |
— | — | @@ -1617,6 +1618,7 @@ |
1618 | 1619 | * @return string HTML |
1619 | 1620 | */ |
1620 | 1621 | function getDiff() { |
| 1622 | + require_once( 'DifferenceEngine.php' ); |
1621 | 1623 | $oldtext = $this->mArticle->fetchContent(); |
1622 | 1624 | $newtext = $this->mArticle->replaceSection( |
1623 | 1625 | $this->section, $this->textbox1, $this->summary, $this->edittime ); |
Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -9,6 +9,8 @@ |
10 | 10 | * |
11 | 11 | */ |
12 | 12 | require_once 'Image.php'; |
| 13 | +require_once 'MacBinary.php'; |
| 14 | +require_once 'Licenses.php'; |
13 | 15 | /** |
14 | 16 | * Entry point |
15 | 17 | */ |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -5,6 +5,9 @@ |
6 | 6 | * @package MediaWiki |
7 | 7 | */ |
8 | 8 | |
| 9 | +if ( $wgUseTeX ) |
| 10 | + require_once 'Math.php'; |
| 11 | + |
9 | 12 | /** |
10 | 13 | * @todo document |
11 | 14 | * @package MediaWiki |
— | — | @@ -647,7 +650,7 @@ |
648 | 651 | |
649 | 652 | $id = $wgUser->blockedBy(); |
650 | 653 | $reason = $wgUser->blockedFor(); |
651 | | - $ip = ProxyTools::getIP(); |
| 654 | + $ip = wfGetIP(); |
652 | 655 | |
653 | 656 | if ( is_numeric( $id ) ) { |
654 | 657 | $name = User::whoIs( $id ); |
Index: trunk/phase3/includes/SearchUpdate.php |
— | — | @@ -37,6 +37,7 @@ |
38 | 38 | $fname = 'SearchUpdate::doUpdate'; |
39 | 39 | wfProfileIn( $fname ); |
40 | 40 | |
| 41 | + require_once( 'SearchEngine.php' ); |
41 | 42 | $search = SearchEngine::create(); |
42 | 43 | $lc = $search->legalSearchChars() . '&#;'; |
43 | 44 | |
Index: trunk/phase3/includes/LinksUpdate.php |
— | — | @@ -119,6 +119,7 @@ |
120 | 120 | if ( $this->mRecursive ) { |
121 | 121 | $tlto = $this->mTitle->getTemplateLinksTo(); |
122 | 122 | if ( count( $tlto ) ) { |
| 123 | + require_once( 'JobQueue.php' ); |
123 | 124 | Job::queueLinksJobs( $tlto ); |
124 | 125 | } |
125 | 126 | } |
— | — | @@ -154,6 +155,7 @@ |
155 | 156 | if ( $this->mRecursive ) { |
156 | 157 | $tlto = $this->mTitle->getTemplateLinksTo(); |
157 | 158 | if ( count( $tlto ) ) { |
| 159 | + require_once( 'JobQueue.php' ); |
158 | 160 | Job::queueLinksJobs( $tlto ); |
159 | 161 | } |
160 | 162 | } |
Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -117,6 +117,7 @@ |
118 | 118 | $data = $wgContLang->checkTitleEncoding( $data ); |
119 | 119 | } |
120 | 120 | } |
| 121 | + require_once( 'normal/UtfNormal.php' ); |
121 | 122 | $data = $this->normalizeUnicode( $data ); |
122 | 123 | return $data; |
123 | 124 | } else { |
Index: trunk/phase3/includes/Revision.php |
— | — | @@ -4,6 +4,10 @@ |
5 | 5 | * @todo document |
6 | 6 | */ |
7 | 7 | |
| 8 | +/** */ |
| 9 | +require_once( 'Database.php' ); |
| 10 | +require_once( 'Article.php' ); |
| 11 | + |
8 | 12 | /** @+ */ |
9 | 13 | define( 'MW_REV_DELETED_TEXT', 1 ); |
10 | 14 | define( 'MW_REV_DELETED_COMMENT', 2 ); |
— | — | @@ -510,6 +514,7 @@ |
511 | 515 | wfProfileOut( $fname ); |
512 | 516 | return false; |
513 | 517 | } |
| 518 | + require_once('ExternalStore.php'); |
514 | 519 | $text=ExternalStore::fetchFromURL($url); |
515 | 520 | } |
516 | 521 | |
— | — | @@ -599,6 +604,7 @@ |
600 | 605 | } else { |
601 | 606 | $store = $wgDefaultExternalStore; |
602 | 607 | } |
| 608 | + require_once('ExternalStore.php'); |
603 | 609 | // Store and get the URL |
604 | 610 | $data = ExternalStore::insert( $store, $data ); |
605 | 611 | if ( !$data ) { |
Index: trunk/phase3/includes/SearchTsearch2.php |
— | — | @@ -23,6 +23,9 @@ |
24 | 24 | * @subpackage Search |
25 | 25 | */ |
26 | 26 | |
| 27 | +/** */ |
| 28 | +require_once( 'SearchEngine.php' ); |
| 29 | + |
27 | 30 | /** |
28 | 31 | * @todo document |
29 | 32 | * @package MediaWiki |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -176,8 +176,10 @@ |
177 | 177 | |
178 | 178 | switch( $title->getNamespace() ) { |
179 | 179 | case NS_IMAGE: |
| 180 | + require_once( 'includes/ImagePage.php' ); |
180 | 181 | return new ImagePage( $title ); |
181 | 182 | case NS_CATEGORY: |
| 183 | + require_once( 'includes/CategoryPage.php' ); |
182 | 184 | return new CategoryPage( $title ); |
183 | 185 | default: |
184 | 186 | return new Article( $title ); |
— | — | @@ -282,6 +284,8 @@ |
283 | 285 | $n = intval( $wgJobRunRate ); |
284 | 286 | } |
285 | 287 | |
| 288 | + require_once( 'JobQueue.php' ); |
| 289 | + |
286 | 290 | while ( $n-- && false != ($job = Job::pop())) { |
287 | 291 | $output = $job->toString() . "\n"; |
288 | 292 | if ( !$job->run() ) { |
— | — | @@ -355,7 +359,8 @@ |
356 | 360 | } |
357 | 361 | break; |
358 | 362 | case 'credits': |
359 | | - Credits::showCreditsPage( $article ); |
| 363 | + require_once( 'includes/Credits.php' ); |
| 364 | + showCreditsPage( $article ); |
360 | 365 | break; |
361 | 366 | case 'submit': |
362 | 367 | if( !$this->getVal( 'CommandLineMode' ) && !$request->checkSessionCookie() ) { |
— | — | @@ -370,9 +375,11 @@ |
371 | 376 | $oldid = $request->getVal( 'oldid' ); |
372 | 377 | if( !$this->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal || |
373 | 378 | $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) { |
| 379 | + require_once( 'includes/EditPage.php' ); |
374 | 380 | $editor = new EditPage( $article ); |
375 | 381 | $editor->submit(); |
376 | 382 | } elseif( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) { |
| 383 | + require_once( 'includes/ExternalEdit.php' ); |
377 | 384 | $mode = $request->getVal( 'mode' ); |
378 | 385 | $extedit = new ExternalEdit( $article, $mode ); |
379 | 386 | $extedit->edit(); |
— | — | @@ -382,10 +389,12 @@ |
383 | 390 | if( $_SERVER['REQUEST_URI'] == $title->getInternalURL( 'action=history' ) ) { |
384 | 391 | $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) ); |
385 | 392 | } |
| 393 | + require_once( 'includes/PageHistory.php' ); |
386 | 394 | $history = new PageHistory( $article ); |
387 | 395 | $history->history(); |
388 | 396 | break; |
389 | 397 | case 'raw': |
| 398 | + require_once( 'includes/RawPage.php' ); |
390 | 399 | $raw = new RawPage( $article ); |
391 | 400 | $raw->view(); |
392 | 401 | break; |
Index: trunk/phase3/includes/ChangesList.php |
— | — | @@ -7,6 +7,7 @@ |
8 | 8 | * - recent changes |
9 | 9 | */ |
10 | 10 | |
| 11 | +require_once("RecentChange.php"); |
11 | 12 | /** |
12 | 13 | * @todo document |
13 | 14 | * @package MediaWiki |
Index: trunk/phase3/includes/AjaxFunctions.php |
— | — | @@ -3,6 +3,8 @@ |
4 | 4 | if( !defined( 'MEDIAWIKI' ) ) |
5 | 5 | die( -1 ); |
6 | 6 | |
| 7 | +require_once('WebRequest.php'); |
| 8 | + |
7 | 9 | /** |
8 | 10 | * Function converts an Javascript escaped string back into a string with |
9 | 11 | * specified charset (default is UTF-8). |
Index: trunk/phase3/includes/SearchMySQL4.php |
— | — | @@ -23,6 +23,8 @@ |
24 | 24 | * @subpackage Search |
25 | 25 | */ |
26 | 26 | |
| 27 | +require_once( 'SearchMySQL.php' ); |
| 28 | + |
27 | 29 | /** |
28 | 30 | * @package MediaWiki |
29 | 31 | * @subpackage Search |
Index: trunk/phase3/includes/DifferenceEngine.php |
— | — | @@ -5,6 +5,9 @@ |
6 | 6 | * @subpackage DifferenceEngine |
7 | 7 | */ |
8 | 8 | |
| 9 | +/** */ |
| 10 | +require_once( 'Revision.php' ); |
| 11 | + |
9 | 12 | define( 'MAX_DIFF_LINE', 10000 ); |
10 | 13 | define( 'MAX_DIFF_XREF_LENGTH', 10000 ); |
11 | 14 | |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -5,7 +5,8 @@ |
6 | 6 | * @package MediaWiki |
7 | 7 | */ |
8 | 8 | |
9 | | -global $wgTitleInterwikiCache, $wgTitleCache; |
| 9 | +/** */ |
| 10 | +require_once( 'normal/UtfNormal.php' ); |
10 | 11 | |
11 | 12 | $wgTitleInterwikiCache = array(); |
12 | 13 | $wgTitleCache = array(); |
— | — | @@ -333,6 +334,7 @@ |
334 | 335 | */ |
335 | 336 | /* static */ function indexTitle( $ns, $title ) { |
336 | 337 | global $wgContLang; |
| 338 | + require_once( 'SearchEngine.php' ); |
337 | 339 | |
338 | 340 | $lc = SearchEngine::legalSearchChars() . '&#;'; |
339 | 341 | $t = $wgContLang->stripForSearch( $title ); |
— | — | @@ -1160,7 +1162,8 @@ |
1161 | 1163 | * Check that the corresponding skin exists |
1162 | 1164 | */ |
1163 | 1165 | 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 ) ); |
1165 | 1168 | } |
1166 | 1169 | /** |
1167 | 1170 | * Trim down a .css or .js subpage title to get the corresponding skin name |
Index: trunk/phase3/includes/Image.php |
— | — | @@ -12,6 +12,9 @@ |
13 | 13 | * extension=extensions/php_exif.dll |
14 | 14 | */ |
15 | 15 | |
| 16 | +if ($wgShowEXIF) |
| 17 | + require_once('Exif.php'); |
| 18 | + |
16 | 19 | /** |
17 | 20 | * Bump this number when serialized cache records may be incompatible. |
18 | 21 | */ |
Index: trunk/phase3/includes/RawPage.php |
— | — | @@ -10,6 +10,9 @@ |
11 | 11 | * @package MediaWiki |
12 | 12 | */ |
13 | 13 | |
| 14 | +/** */ |
| 15 | +require_once( 'Revision.php' ); |
| 16 | + |
14 | 17 | /** |
15 | 18 | * @todo document |
16 | 19 | * @package MediaWiki |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -343,7 +343,8 @@ |
344 | 344 | $this->credits = false; |
345 | 345 | |
346 | 346 | 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); |
348 | 349 | } else { |
349 | 350 | $tpl->set('lastmod', $this->lastModified()); |
350 | 351 | } |
Index: trunk/phase3/includes/SpecialPreferences.php |
— | — | @@ -444,7 +444,7 @@ |
445 | 445 | * @access private |
446 | 446 | */ |
447 | 447 | function mainPrefsForm( $status , $message = '' ) { |
448 | | - global $wgUser, $wgOut, $wgLang, $wgContLang; |
| 448 | + global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames; |
449 | 449 | global $wgAllowRealName, $wgImageLimits, $wgThumbLimits; |
450 | 450 | global $wgDisableLangConversion; |
451 | 451 | global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits; |
— | — | @@ -723,7 +723,7 @@ |
724 | 724 | $previewtext = wfMsg('skinpreview'); |
725 | 725 | # Only show members of $wgValidSkinNames rather than |
726 | 726 | # $skinNames (skins is all skin names from Language.php) |
727 | | - foreach (Skin::getSkinNames() as $skinkey => $skinname ) { |
| 727 | + foreach ($wgValidSkinNames as $skinkey => $skinname ) { |
728 | 728 | if ( in_array( $skinkey, $wgSkipSkins ) ) { |
729 | 729 | continue; |
730 | 730 | } |
Index: trunk/phase3/includes/ExternalStoreDB.php |
— | — | @@ -6,7 +6,9 @@ |
7 | 7 | * DB accessable external objects |
8 | 8 | * |
9 | 9 | */ |
| 10 | +require_once( 'LoadBalancer.php' ); |
10 | 11 | |
| 12 | + |
11 | 13 | /** @package MediaWiki */ |
12 | 14 | |
13 | 15 | /** |
Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -3,89 +3,88 @@ |
4 | 4 | * Various HTTP related functions |
5 | 5 | */ |
6 | 6 | |
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; |
15 | 14 | |
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 | + } |
24 | 23 | |
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" ); |
30 | 29 | |
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 | + } |
39 | 38 | |
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(); |
44 | 43 | |
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; |
56 | 47 | } |
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 ); |
58 | 55 | } |
| 56 | + return $text; |
| 57 | +} |
59 | 58 | |
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 | + } |
68 | 67 | |
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; |
87 | 82 | } |
| 83 | + if ( $wgConf->isLocalVHost( $domain ) ) { |
| 84 | + return true; |
| 85 | + } |
88 | 86 | } |
89 | | - return false; |
90 | 87 | } |
| 88 | + return false; |
91 | 89 | } |
| 90 | + |
92 | 91 | ?> |
Index: trunk/phase3/includes/DatabasePostgreSQL.php |
— | — | @@ -14,6 +14,11 @@ |
15 | 15 | */ |
16 | 16 | |
17 | 17 | /** |
| 18 | + * Depends on database |
| 19 | + */ |
| 20 | +require_once( 'Database.php' ); |
| 21 | + |
| 22 | +/** |
18 | 23 | * |
19 | 24 | * @package MediaWiki |
20 | 25 | */ |
Index: trunk/phase3/includes/Block.php |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | { |
171 | 171 | $fname = 'Block::loadRange'; |
172 | 172 | |
173 | | - $iaddr = ProxyTools::IP2Hex( $address ); |
| 173 | + $iaddr = wfIP2Hex( $address ); |
174 | 174 | if ( $iaddr === false ) { |
175 | 175 | # Invalid address |
176 | 176 | return false; |
— | — | @@ -207,7 +207,7 @@ |
208 | 208 | * Determine if a given integer IPv4 address is in a given CIDR network |
209 | 209 | */ |
210 | 210 | function isAddressInRange( $addr, $range ) { |
211 | | - list( $network, $bits ) = ProxyTools::parseCIDR( $range ); |
| 211 | + list( $network, $bits ) = wfParseCIDR( $range ); |
212 | 212 | if ( $network !== false && $addr >> ( 32 - $bits ) == $network >> ( 32 - $bits ) ) { |
213 | 213 | return true; |
214 | 214 | } else { |
— | — | @@ -241,7 +241,7 @@ |
242 | 242 | $this->mRangeStart = ''; |
243 | 243 | $this->mRangeEnd = ''; |
244 | 244 | if ( $this->mUser == 0 ) { |
245 | | - list( $network, $bits ) = ProxyTools::parseCIDR( $this->mAddress ); |
| 245 | + list( $network, $bits ) = wfParseCIDR( $this->mAddress ); |
246 | 246 | if ( $network !== false ) { |
247 | 247 | $this->mRangeStart = sprintf( '%08X', $network ); |
248 | 248 | $this->mRangeEnd = sprintf( '%08X', $network + (1 << (32 - $bits)) - 1 ); |
— | — | @@ -431,7 +431,7 @@ |
432 | 432 | $parts = explode( '/', $range ); |
433 | 433 | if ( count( $parts ) == 2 ) { |
434 | 434 | $shift = 32 - $parts[1]; |
435 | | - $ipint = ProxyTools::IP2Unsigned( $parts[0] ); |
| 435 | + $ipint = wfIP2Unsigned( $parts[0] ); |
436 | 436 | $ipint = $ipint >> $shift << $shift; |
437 | 437 | $newip = long2ip( $ipint ); |
438 | 438 | $range = "$newip/{$parts[1]}"; |
Index: trunk/phase3/includes/Credits.php |
— | — | @@ -24,165 +24,164 @@ |
25 | 25 | /** |
26 | 26 | * This is largely cadged from PageHistory::history |
27 | 27 | */ |
28 | | -class Credits { |
29 | | - function showCreditsPage($article) { |
30 | | - global $wgOut; |
| 28 | +function showCreditsPage($article) { |
| 29 | + global $wgOut; |
31 | 30 | |
32 | | - $fname = 'Credits::showCreditsPage'; |
| 31 | + $fname = 'showCreditsPage'; |
33 | 32 | |
34 | | - wfProfileIn( $fname ); |
| 33 | + wfProfileIn( $fname ); |
35 | 34 | |
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' ); |
41 | 40 | |
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 | + } |
47 | 46 | |
48 | | - $wgOut->addHTML( $s ); |
| 47 | + $wgOut->addHTML( $s ); |
49 | 48 | |
50 | | - wfProfileOut( $fname ); |
51 | | - } |
| 49 | + wfProfileOut( $fname ); |
| 50 | +} |
52 | 51 | |
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 = ''; |
57 | 56 | |
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); |
63 | 61 | } |
64 | | - |
65 | | - wfProfileOut( $fname ); |
66 | | - return $s; |
67 | 62 | } |
68 | 63 | |
69 | | - /** |
70 | | - * |
71 | | - */ |
72 | | - function getAuthorCredits($article) { |
73 | | - global $wgLang, $wgAllowRealName; |
| 64 | + wfProfileOut( $fname ); |
| 65 | + return $s; |
| 66 | +} |
74 | 67 | |
75 | | - $last_author = $article->getUser(); |
| 68 | +/** |
| 69 | + * |
| 70 | + */ |
| 71 | +function getAuthorCredits($article) { |
| 72 | + global $wgLang, $wgAllowRealName; |
76 | 73 | |
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(); |
82 | 75 | |
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); |
89 | 81 | |
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); |
93 | 84 | } else { |
94 | | - $d = ''; |
| 85 | + $author_credit = wfMsg('siteuser', creditLink($user_name)); |
95 | 86 | } |
96 | | - return wfMsg('lastmodifiedby', $d, $author_credit); |
97 | 87 | } |
98 | 88 | |
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 | +} |
103 | 97 | |
104 | | - global $wgLang, $wgAllowRealName; |
| 98 | +/** |
| 99 | + * |
| 100 | + */ |
| 101 | +function getContributorCredits($article, $cnt, $showIfMax) { |
105 | 102 | |
106 | | - $contributors = $article->getContributors(); |
| 103 | + global $wgLang, $wgAllowRealName; |
107 | 104 | |
108 | | - $others_link = ''; |
| 105 | + $contributors = $article->getContributors(); |
109 | 106 | |
110 | | - # Hmm... too many to fit! |
| 107 | + $others_link = ''; |
111 | 108 | |
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); |
119 | 117 | } |
| 118 | + } |
120 | 119 | |
121 | | - $real_names = array(); |
122 | | - $user_names = array(); |
| 120 | + $real_names = array(); |
| 121 | + $user_names = array(); |
123 | 122 | |
124 | | - $anon = ''; |
| 123 | + $anon = ''; |
125 | 124 | |
126 | | - # Sift for real versus user names |
| 125 | + # Sift for real versus user names |
127 | 126 | |
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]); |
135 | 131 | } else { |
136 | | - $anon = wfMsg('anonymous'); |
| 132 | + $user_names[] = creditLink($user_parts[1]); |
137 | 133 | } |
| 134 | + } else { |
| 135 | + $anon = wfMsg('anonymous'); |
138 | 136 | } |
| 137 | + } |
139 | 138 | |
140 | | - # Two strings: real names, and user names |
| 139 | + # Two strings: real names, and user names |
141 | 140 | |
142 | | - $real = $wgLang->listToText($real_names); |
143 | | - $user = $wgLang->listToText($user_names); |
| 141 | + $real = $wgLang->listToText($real_names); |
| 142 | + $user = $wgLang->listToText($user_names); |
144 | 143 | |
145 | | - # "ThisSite user(s) A, B and C" |
| 144 | + # "ThisSite user(s) A, B and C" |
146 | 145 | |
147 | | - if (!empty($user)) { |
148 | | - $user = wfMsg('siteusers', $user); |
149 | | - } |
| 146 | + if (!empty($user)) { |
| 147 | + $user = wfMsg('siteusers', $user); |
| 148 | + } |
150 | 149 | |
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 |
152 | 151 | |
153 | | - $fulllist = array(); |
| 152 | + $fulllist = array(); |
154 | 153 | |
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); |
159 | 157 | } |
| 158 | + } |
160 | 159 | |
161 | | - # Make the list into text... |
| 160 | + # Make the list into text... |
162 | 161 | |
163 | | - $creds = $wgLang->listToText($fulllist); |
| 162 | + $creds = $wgLang->listToText($fulllist); |
164 | 163 | |
165 | | - # "Based on work by ..." |
| 164 | + # "Based on work by ..." |
166 | 165 | |
167 | | - return (empty($creds)) ? '' : wfMsg('othercontribs', $creds); |
168 | | - } |
| 166 | + return (empty($creds)) ? '' : wfMsg('othercontribs', $creds); |
| 167 | +} |
169 | 168 | |
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 | +} |
179 | 178 | |
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'); |
188 | 186 | } |
| 187 | + |
189 | 188 | ?> |
Index: trunk/phase3/includes/PageHistory.php |
— | — | @@ -576,6 +576,9 @@ |
577 | 577 | * @param string $type |
578 | 578 | */ |
579 | 579 | function feed( $type ) { |
| 580 | + require_once 'Feed.php'; |
| 581 | + require_once 'SpecialRecentchanges.php'; |
| 582 | + |
580 | 583 | global $wgFeedClasses; |
581 | 584 | if( !isset( $wgFeedClasses[$type] ) ) { |
582 | 585 | global $wgOut; |
Index: trunk/phase3/includes/QueryPage.php |
— | — | @@ -5,6 +5,11 @@ |
6 | 6 | */ |
7 | 7 | |
8 | 8 | /** |
| 9 | + * |
| 10 | + */ |
| 11 | +require_once 'Feed.php'; |
| 12 | + |
| 13 | +/** |
9 | 14 | * List of query page classes and their associated special pages, for periodic update purposes |
10 | 15 | */ |
11 | 16 | global $wgQueryPages; // not redundant |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -8,11 +8,28 @@ |
9 | 9 | * @subpackage Skins |
10 | 10 | */ |
11 | 11 | |
| 12 | +# See skin.txt |
| 13 | +require_once( 'Linker.php' ); |
| 14 | +require_once( 'Image.php' ); |
| 15 | + |
12 | 16 | # Get a list of available skins |
13 | 17 | # Build using the regular expression '^(.*).php$' |
14 | 18 | # Array keys are all lower case, array value keep the case used by filename |
15 | 19 | # |
16 | 20 | |
| 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 | + |
17 | 34 | /** |
18 | 35 | * The main skin class that provide methods and properties for all other skins. |
19 | 36 | * This base class is also the "Standard" skin. |
— | — | @@ -38,35 +55,9 @@ |
39 | 56 | */ |
40 | 57 | function getSkinNames() { |
41 | 58 | global $wgValidSkinNames; |
42 | | - if (!is_array($wgValidSkinNames)) { |
43 | | - Skin::initializeSkinNames(); |
44 | | - } |
45 | 59 | return $wgValidSkinNames; |
46 | 60 | } |
47 | 61 | |
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 | | - |
71 | 62 | /** |
72 | 63 | * Normalize a skin preference value to a form that can be loaded. |
73 | 64 | * If a skin can't be found, it will fall back to the configured |
— | — | @@ -754,7 +745,7 @@ |
755 | 746 | $s = ''; |
756 | 747 | if ( $wgUser->isAnon() ) { |
757 | 748 | if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) { |
758 | | - $n = ProxyTools::getIP(); |
| 749 | + $n = wfGetIP(); |
759 | 750 | |
760 | 751 | $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), |
761 | 752 | $wgLang->getNsText( NS_TALK ) ); |
— | — | @@ -905,7 +896,8 @@ |
906 | 897 | } |
907 | 898 | |
908 | 899 | if (isset($wgMaxCredits) && $wgMaxCredits != 0) { |
909 | | - $s .= ' ' . Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); |
| 900 | + require_once('Credits.php'); |
| 901 | + $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); |
910 | 902 | } else { |
911 | 903 | $s .= $this->lastModified(); |
912 | 904 | } |
— | — | @@ -1023,6 +1015,7 @@ |
1024 | 1016 | */ |
1025 | 1017 | function specialPagesList() { |
1026 | 1018 | global $wgUser, $wgContLang, $wgServer, $wgRedirectScript, $wgAvailableRights; |
| 1019 | + require_once('SpecialPage.php'); |
1027 | 1020 | $a = array(); |
1028 | 1021 | $pages = SpecialPage::getPages(); |
1029 | 1022 | |
Index: trunk/phase3/includes/LoadBalancer.php |
— | — | @@ -7,6 +7,7 @@ |
8 | 8 | /** |
9 | 9 | * Depends on the database object |
10 | 10 | */ |
| 11 | +require_once( 'Database.php' ); |
11 | 12 | |
12 | 13 | # Valid database indexes |
13 | 14 | # Operation-based indexes |
— | — | @@ -439,14 +440,12 @@ |
440 | 441 | } |
441 | 442 | |
442 | 443 | extract( $server ); |
443 | | - |
444 | 444 | # 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" ); |
449 | 448 | } |
450 | | - |
| 449 | + |
451 | 450 | # Create object |
452 | 451 | $db = new $class( $host, $user, $password, $dbname, 1, $flags ); |
453 | 452 | $db->setLBInfo( $server ); |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -15,10 +15,6 @@ |
16 | 16 | * @subpackage SpecialPage |
17 | 17 | */ |
18 | 18 | |
19 | | -/** |
20 | | - * @todo put all global specialpages stuff into class |
21 | | - */ |
22 | | -global $wgSpecialPages, $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication; |
23 | 19 | |
24 | 20 | /** |
25 | 21 | * @access private |
Index: trunk/phase3/includes/LogPage.php |
— | — | @@ -83,6 +83,7 @@ |
84 | 84 | $rcComment .= ': ' . $this->comment; |
85 | 85 | } |
86 | 86 | |
| 87 | + require_once( 'RecentChange.php' ); |
87 | 88 | RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '', |
88 | 89 | $this->type, $this->action, $this->target, $this->comment, $this->params ); |
89 | 90 | } |
Index: trunk/phase3/includes/SpecialVersion.php |
— | — | @@ -190,7 +190,7 @@ |
191 | 191 | * @return string |
192 | 192 | */ |
193 | 193 | function IPInfo() { |
194 | | - $ip = str_replace( '--', ' - ', htmlspecialchars( ProxyTools::getIP() ) ); |
| 194 | + $ip = str_replace( '--', ' - ', htmlspecialchars( wfGetIP() ) ); |
195 | 195 | return "<!-- visited from $ip -->\n" . |
196 | 196 | "<span style='display:none'>visited from $ip</span>"; |
197 | 197 | } |
Index: trunk/phase3/includes/Math.php |
— | — | @@ -248,13 +248,15 @@ |
249 | 249 | wfDebug( "TeX: getHashPath, hash is: $this->hash, path is: $path\n" ); |
250 | 250 | return $path; |
251 | 251 | } |
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 | + |
259 | 254 | } |
260 | 255 | |
| 256 | +function renderMath( $tex ) { |
| 257 | + global $wgUser; |
| 258 | + $math = new MathRenderer( $tex ); |
| 259 | + $math->setOutputMode( $wgUser->getOption('math')); |
| 260 | + return $math->render(); |
| 261 | +} |
| 262 | + |
261 | 263 | ?> |
Index: trunk/phase3/includes/SearchMySQL.php |
— | — | @@ -24,6 +24,9 @@ |
25 | 25 | * @subpackage Search |
26 | 26 | */ |
27 | 27 | |
| 28 | +/** */ |
| 29 | +require_once( 'SearchEngine.php' ); |
| 30 | + |
28 | 31 | /** @package MediaWiki */ |
29 | 32 | class SearchMySQL extends SearchEngine { |
30 | 33 | /** |
Index: trunk/phase3/includes/HistoryBlob.php |
— | — | @@ -167,7 +167,18 @@ |
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
| 171 | + |
171 | 172 | /** |
| 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 | +/** |
172 | 183 | * @package MediaWiki |
173 | 184 | */ |
174 | 185 | class HistoryBlobStub { |
— | — | @@ -204,15 +215,6 @@ |
205 | 216 | function getText() { |
206 | 217 | $fname = 'HistoryBlob::getText'; |
207 | 218 | 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 | | - } |
217 | 219 | if( isset( $wgBlobCache[$this->mOldId] ) ) { |
218 | 220 | $obj = $wgBlobCache[$this->mOldId]; |
219 | 221 | } else { |
— | — | @@ -229,6 +231,7 @@ |
230 | 232 | wfProfileOut( $fname ); |
231 | 233 | return false; |
232 | 234 | } |
| 235 | + require_once('ExternalStore.php'); |
233 | 236 | $row->old_text=ExternalStore::fetchFromUrl($url); |
234 | 237 | |
235 | 238 | } |
Index: trunk/phase3/includes/Database.php |
— | — | @@ -5,6 +5,11 @@ |
6 | 6 | * @package MediaWiki |
7 | 7 | */ |
8 | 8 | |
| 9 | +/** |
| 10 | + * Depends on the CacheManager |
| 11 | + */ |
| 12 | +require_once( 'CacheManager.php' ); |
| 13 | + |
9 | 14 | /** See Database::makeList() */ |
10 | 15 | define( 'LIST_COMMA', 0 ); |
11 | 16 | define( 'LIST_AND', 1 ); |
Index: trunk/phase3/includes/DatabaseOracle.php |
— | — | @@ -6,6 +6,11 @@ |
7 | 7 | * @package MediaWiki |
8 | 8 | */ |
9 | 9 | |
| 10 | +/** |
| 11 | + * Depends on database |
| 12 | + */ |
| 13 | +require_once( 'Database.php' ); |
| 14 | + |
10 | 15 | class OracleBlob extends DBObject { |
11 | 16 | function isLOB() { |
12 | 17 | return true; |
Index: trunk/phase3/includes/CacheManager.php |
— | — | @@ -6,6 +6,11 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** |
| 10 | + * We need the title class |
| 11 | + */ |
| 12 | +require_once( 'Title.php' ); |
| 13 | + |
| 14 | +/** |
10 | 15 | * Handles talking to the file cache, putting stuff in and taking it back out. |
11 | 16 | * Mostly called from Article.php, also from DatabaseFunctions.php for the |
12 | 17 | * emergency abort/fallback to cache. |
Index: trunk/phase3/includes/ProxyTools.php |
— | — | @@ -4,228 +4,230 @@ |
5 | 5 | * @package MediaWiki |
6 | 6 | */ |
7 | 7 | |
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'; |
24 | 17 | } |
| 18 | + if( isset( $set[$index] ) ) { |
| 19 | + return $set[$index]; |
| 20 | + } else { |
| 21 | + return null; |
| 22 | + } |
| 23 | +} |
25 | 24 | |
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; |
29 | 28 | |
30 | | - # Return cached result |
31 | | - if ( !empty( $wgIP ) ) { |
32 | | - return $wgIP; |
33 | | - } |
| 29 | + # Return cached result |
| 30 | + if ( !empty( $wgIP ) ) { |
| 31 | + return $wgIP; |
| 32 | + } |
34 | 33 | |
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 ); |
42 | 54 | } |
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]; |
65 | 61 | } |
| 62 | + } else { |
| 63 | + break; |
66 | 64 | } |
67 | 65 | } |
| 66 | + } |
68 | 67 | |
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 ); |
72 | 83 | } |
| 84 | + return $n; |
| 85 | +} |
73 | 86 | |
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 ); |
86 | 94 | } |
| 95 | + return $n; |
| 96 | +} |
87 | 97 | |
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; |
97 | 106 | } |
| 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 | + } |
98 | 113 | |
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 ) { |
106 | 129 | return false; |
107 | 130 | } |
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 | +} |
114 | 134 | |
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; |
125 | 143 | |
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; |
134 | 146 | } |
135 | 147 | |
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(); |
144 | 149 | |
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; |
147 | 157 | } |
| 158 | + } |
148 | 159 | |
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 ); |
150 | 165 | |
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 |
153 | 176 | 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 ); |
159 | 178 | } |
| 179 | + } |
| 180 | +} |
160 | 181 | |
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 | +} |
166 | 199 | |
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; |
181 | 209 | } |
| 210 | + wfProfileIn( $fname ); |
182 | 211 | |
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 ) ); |
199 | 215 | } |
200 | 216 | |
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 | +} |
207 | 230 | |
208 | | - if ( !$wgProxyList ) { |
209 | | - return false; |
210 | | - } |
211 | | - wfProfileIn( $fname ); |
212 | 231 | |
213 | | - if ( !is_array( $wgProxyList ) ) { |
214 | | - # Load from the specified file |
215 | | - $wgProxyList = array_map( 'trim', file( $wgProxyList ) ); |
216 | | - } |
217 | 232 | |
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 | + |
232 | 234 | ?> |
Index: trunk/phase3/includes/CategoryPage.php |
— | — | @@ -10,6 +10,9 @@ |
11 | 11 | die( -1 ); |
12 | 12 | |
13 | 13 | global $wgCategoryMagicGallery; |
| 14 | +if( $wgCategoryMagicGallery ) |
| 15 | + /** */ |
| 16 | + require_once('ImageGallery.php'); |
14 | 17 | |
15 | 18 | /** |
16 | 19 | * @package MediaWiki |
Index: trunk/phase3/includes/User.php |
— | — | @@ -5,6 +5,11 @@ |
6 | 6 | * @package MediaWiki |
7 | 7 | */ |
8 | 8 | |
| 9 | +/** |
| 10 | + * |
| 11 | + */ |
| 12 | +require_once( 'WatchedItem.php' ); |
| 13 | + |
9 | 14 | # Number of characters in user_token field |
10 | 15 | define( 'USER_TOKEN_LENGTH', 32 ); |
11 | 16 | |
— | — | @@ -428,7 +433,7 @@ |
429 | 434 | wfDebug( "$fname: checking...\n" ); |
430 | 435 | |
431 | 436 | $this->mBlockedby = 0; |
432 | | - $ip = ProxyTools::getIP(); |
| 437 | + $ip = wfGetIP(); |
433 | 438 | |
434 | 439 | # User/IP blocking |
435 | 440 | $block = new Block(); |
— | — | @@ -449,7 +454,7 @@ |
450 | 455 | if ( !$this->isAllowed('proxyunbannable') && !in_array( $ip, $wgProxyWhitelist ) ) { |
451 | 456 | |
452 | 457 | # Local list |
453 | | - if ( ProxyTools::isLocallyBlockedProxy( $ip ) ) { |
| 458 | + if ( wfIsLocallyBlockedProxy( $ip ) ) { |
454 | 459 | $this->mBlockedby = wfMsg( 'proxyblocker' ); |
455 | 460 | $this->mBlockreason = wfMsg( 'proxyblockreason' ); |
456 | 461 | } |
— | — | @@ -533,7 +538,7 @@ |
534 | 539 | $limits = $wgRateLimits[$action]; |
535 | 540 | $keys = array(); |
536 | 541 | $id = $this->getId(); |
537 | | - $ip = ProxyTools::getIP(); |
| 542 | + $ip = wfGetIP(); |
538 | 543 | |
539 | 544 | if( isset( $limits['anon'] ) && $id == 0 ) { |
540 | 545 | $keys["$wgDBname:limiter:$action:anon"] = $limits['anon']; |
— | — | @@ -785,7 +790,7 @@ |
786 | 791 | function getName() { |
787 | 792 | $this->loadFromDatabase(); |
788 | 793 | if ( $this->mName === false ) { |
789 | | - $this->mName = ProxyTools::getIP(); |
| 794 | + $this->mName = wfGetIP(); |
790 | 795 | } |
791 | 796 | return $this->mName; |
792 | 797 | } |
— | — | @@ -1521,7 +1526,7 @@ |
1522 | 1527 | } |
1523 | 1528 | |
1524 | 1529 | # Check if this IP address is already blocked |
1525 | | - $ipblock = Block::newFromDB( ProxyTools::getIP() ); |
| 1530 | + $ipblock = Block::newFromDB( wfGetIP() ); |
1526 | 1531 | if ( $ipblock->isValid() ) { |
1527 | 1532 | # If the user is already blocked. Then check if the autoblock would |
1528 | 1533 | # excede the user block. If it would excede, then do nothing, else |
— | — | @@ -1536,8 +1541,8 @@ |
1537 | 1542 | } |
1538 | 1543 | |
1539 | 1544 | # 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(); |
1542 | 1547 | $ipblock->mUser = 0; |
1543 | 1548 | $ipblock->mBy = $userblock->mBy; |
1544 | 1549 | $ipblock->mReason = wfMsg( 'autoblocker', $this->getName(), $userblock->mReason ); |
— | — | @@ -1757,7 +1762,7 @@ |
1758 | 1763 | $url = $this->confirmationTokenUrl( $expiration ); |
1759 | 1764 | return $this->sendMail( wfMsg( 'confirmemail_subject' ), |
1760 | 1765 | wfMsg( 'confirmemail_body', |
1761 | | - ProxyTools::getIP(), |
| 1766 | + wfGetIP(), |
1762 | 1767 | $this->getName(), |
1763 | 1768 | $url, |
1764 | 1769 | $wgContLang->timeanddate( $expiration, false ) ) ); |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -4,6 +4,12 @@ |
5 | 5 | * @package MediaWiki |
6 | 6 | */ |
7 | 7 | |
| 8 | +/** |
| 9 | + * Need the CacheManager to be loaded |
| 10 | + */ |
| 11 | +require_once( 'CacheManager.php' ); |
| 12 | +require_once( 'Revision.php' ); |
| 13 | + |
8 | 14 | $wgArticleCurContentFields = false; |
9 | 15 | $wgArticleOldContentFields = false; |
10 | 16 | |
— | — | @@ -756,6 +762,7 @@ |
757 | 763 | # diff page instead of the article. |
758 | 764 | |
759 | 765 | if ( !is_null( $diff ) ) { |
| 766 | + require_once( 'DifferenceEngine.php' ); |
760 | 767 | $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); |
761 | 768 | |
762 | 769 | $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid ); |
— | — | @@ -1226,6 +1233,7 @@ |
1227 | 1234 | |
1228 | 1235 | Article::onArticleCreate( $this->mTitle ); |
1229 | 1236 | if(!$suppressRC) { |
| 1237 | + require_once( 'RecentChange.php' ); |
1230 | 1238 | $rcid = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, 'default', |
1231 | 1239 | '', strlen( $text ), $revisionId ); |
1232 | 1240 | # Mark as patrolled if the user can and has the option set |
— | — | @@ -1432,6 +1440,7 @@ |
1433 | 1441 | $dbw->rollback(); |
1434 | 1442 | } else { |
1435 | 1443 | # Update recentchanges and purge cache and whatnot |
| 1444 | + require_once( 'RecentChange.php' ); |
1436 | 1445 | $bot = (int)($wgUser->isBot() || $forceBot); |
1437 | 1446 | $rcid = RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary, |
1438 | 1447 | $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize, |
— | — | @@ -1555,6 +1564,7 @@ |
1556 | 1565 | $rcid = $wgRequest->getVal( 'rcid' ); |
1557 | 1566 | if ( !is_null ( $rcid ) ) { |
1558 | 1567 | if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, false ) ) ) { |
| 1568 | + require_once( 'RecentChange.php' ); |
1559 | 1569 | RecentChange::markPatrolled( $rcid ); |
1560 | 1570 | wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) ); |
1561 | 1571 | $wgOut->setPagetitle( wfMsg( 'markedaspatrolled' ) ); |
— | — | @@ -1669,6 +1679,7 @@ |
1670 | 1680 | * action=protect handler |
1671 | 1681 | */ |
1672 | 1682 | function protect() { |
| 1683 | + require_once 'ProtectionForm.php'; |
1673 | 1684 | $form = new ProtectionForm( $this ); |
1674 | 1685 | $form->show(); |
1675 | 1686 | } |
Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -205,7 +205,7 @@ |
206 | 206 | } |
207 | 207 | |
208 | 208 | if ( !$ip ) { |
209 | | - $ip = ProxyTools::getIP(); |
| 209 | + $ip = wfGetIP(); |
210 | 210 | if ( !$ip ) { |
211 | 211 | $ip = ''; |
212 | 212 | } |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | $ip='', $size = 0, $newId = 0 ) |
251 | 251 | { |
252 | 252 | if ( !$ip ) { |
253 | | - $ip = ProxyTools::getIP(); |
| 253 | + $ip = wfGetIP(); |
254 | 254 | if ( !$ip ) { |
255 | 255 | $ip = ''; |
256 | 256 | } |
— | — | @@ -294,7 +294,7 @@ |
295 | 295 | /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false ) |
296 | 296 | { |
297 | 297 | if ( !$ip ) { |
298 | | - $ip = ProxyTools::getIP(); |
| 298 | + $ip = wfGetIP(); |
299 | 299 | if ( !$ip ) { |
300 | 300 | $ip = ''; |
301 | 301 | } |
— | — | @@ -344,7 +344,7 @@ |
345 | 345 | $type, $action, $target, $logComment, $params ) |
346 | 346 | { |
347 | 347 | if ( !$ip ) { |
348 | | - $ip = ProxyTools::getIP(); |
| 348 | + $ip = wfGetIP(); |
349 | 349 | if ( !$ip ) { |
350 | 350 | $ip = ''; |
351 | 351 | } |
Index: trunk/phase3/includes/Profiling.php |
— | — | @@ -278,6 +278,7 @@ |
279 | 279 | } |
280 | 280 | } |
281 | 281 | $prof .= "\nTotal: $total\n\n"; |
| 282 | + |
282 | 283 | return $prof; |
283 | 284 | } |
284 | 285 | |
— | — | @@ -321,6 +322,7 @@ |
322 | 323 | } else { |
323 | 324 | $pfhost = ''; |
324 | 325 | } |
| 326 | + |
325 | 327 | $sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, "."pf_time=pf_time + {$timeSum} ". |
326 | 328 | "WHERE pf_name='{$encname}' AND pf_server='{$pfhost}'"; |
327 | 329 | $dbw->query($sql); |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -27,6 +27,8 @@ |
28 | 28 | |
29 | 29 | |
30 | 30 | require_once( 'DatabaseFunctions.php' ); |
| 31 | +require_once( 'UpdateClasses.php' ); |
| 32 | +require_once( 'LogPage.php' ); |
31 | 33 | require_once( 'normal/UtfNormalUtil.php' ); |
32 | 34 | require_once( 'XmlFunctions.php' ); |
33 | 35 | |
— | — | @@ -1506,6 +1508,11 @@ |
1507 | 1509 | return $wgMimeMagic; |
1508 | 1510 | } |
1509 | 1511 | |
| 1512 | + if (!class_exists("MimeMagic")) { |
| 1513 | + #include on demand |
| 1514 | + require_once("MimeMagic.php"); |
| 1515 | + } |
| 1516 | + |
1510 | 1517 | $wgMimeMagic= new MimeMagic(); |
1511 | 1518 | |
1512 | 1519 | return $wgMimeMagic; |
— | — | @@ -1854,27 +1861,4 @@ |
1855 | 1862 | } |
1856 | 1863 | } |
1857 | 1864 | |
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 | | - |
1881 | 1865 | ?> |
Index: trunk/phase3/includes/ObjectCache.php |
— | — | @@ -33,91 +33,93 @@ |
34 | 34 | global $wgCaches; |
35 | 35 | $wgCaches = array(); |
36 | 36 | |
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; |
42 | 41 | |
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; |
51 | 47 | } |
| 48 | + } else { |
| 49 | + $type = $inputType; |
| 50 | + } |
52 | 51 | |
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 | + } |
71 | 61 | } |
72 | 62 | } |
73 | | - if ( $wgCaches[CACHE_ACCEL] !== false ) { |
74 | | - $cache =& $wgCaches[CACHE_ACCEL]; |
75 | | - } |
76 | | - } |
77 | 63 | |
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 ) ); |
82 | 66 | $cache =& $wgCaches[CACHE_DB]; |
| 67 | + $cache->set_servers( $wgMemCachedServers ); |
| 68 | + $cache->set_debug( $wgMemCachedDebug ); |
83 | 69 | } |
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; |
88 | 83 | } |
89 | | - $cache =& $wgCaches[CACHE_NONE]; |
90 | 84 | } |
| 85 | + if ( $wgCaches[CACHE_ACCEL] !== false ) { |
| 86 | + $cache =& $wgCaches[CACHE_ACCEL]; |
| 87 | + } |
| 88 | + } |
91 | 89 | |
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]; |
93 | 96 | } |
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]; |
100 | 103 | } |
101 | 104 | |
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; |
116 | 106 | } |
117 | 107 | |
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; |
122 | 112 | } |
123 | 113 | |
| 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 | + |
124 | 126 | ?> |
Index: trunk/phase3/includes/UpdateClasses.php |
— | — | @@ -5,4 +5,13 @@ |
6 | 6 | * @package MediaWiki |
7 | 7 | */ |
8 | 8 | |
| 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 | + |
9 | 18 | ?> |
\ No newline at end of file |
Index: trunk/phase3/includes/SpecialUserlogin.php |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | |
214 | | - $ip = ProxyTools::getIP(); |
| 214 | + $ip = wfGetIP(); |
215 | 215 | if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) && |
216 | 216 | $wgUser->inSorbsBlacklist( $ip ) ) |
217 | 217 | { |
— | — | @@ -416,7 +416,7 @@ |
417 | 417 | |
418 | 418 | $u->saveSettings(); |
419 | 419 | |
420 | | - $ip = ProxyTools::getIP(); |
| 420 | + $ip = wfGetIP(); |
421 | 421 | if ( '' == $ip ) { $ip = '(Unknown)'; } |
422 | 422 | |
423 | 423 | $m = wfMsg( 'passwordremindertext', $ip, $u->getName(), $np, $wgServer . $wgScript ); |
Index: trunk/phase3/includes/MessageCache.php |
— | — | @@ -5,6 +5,9 @@ |
6 | 6 | * @subpackage Cache |
7 | 7 | */ |
8 | 8 | |
| 9 | +/** */ |
| 10 | +require_once( 'Revision.php' ); |
| 11 | + |
9 | 12 | /** |
10 | 13 | * |
11 | 14 | */ |