r14513 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14512‎ | r14513 | r14514 >
Date:07:22, 1 June 2006
Author:midom
Status:old
Tags:
Comment:
Use AutoLoader to load classes:
* remove require_once() throughout whole code, yet left in few places
* move global functions in HttpUtils, ProxyTools, Credits to class methods
* php5 only: __autoload() now used, combined with class->file map and require()
* move initialization of $wgValidSkinNames to Skin::getSkinNames()
* few more changes that will surely break stuff.
Modified paths:
  • /trunk/phase3/includes/AjaxDispatcher.php (modified) (history)
  • /trunk/phase3/includes/AjaxFunctions.php (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/AutoLoader.php (added) (history)
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/CacheManager.php (modified) (history)
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/Credits.php (modified) (history)
  • /trunk/phase3/includes/Database.php (modified) (history)
  • /trunk/phase3/includes/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/DatabasePostgreSQL.php (modified) (history)
  • /trunk/phase3/includes/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Export.php (modified) (history)
  • /trunk/phase3/includes/ExternalStoreDB.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/HistoryBlob.php (modified) (history)
  • /trunk/phase3/includes/HttpFunctions.php (modified) (history)
  • /trunk/phase3/includes/Image.php (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/LinksUpdate.php (modified) (history)
  • /trunk/phase3/includes/LoadBalancer.php (modified) (history)
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/includes/Math.php (modified) (history)
  • /trunk/phase3/includes/MessageCache.php (modified) (history)
  • /trunk/phase3/includes/ObjectCache.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/ParserXML.php (modified) (history)
  • /trunk/phase3/includes/Profiling.php (modified) (history)
  • /trunk/phase3/includes/ProxyTools.php (modified) (history)
  • /trunk/phase3/includes/QueryPage.php (modified) (history)
  • /trunk/phase3/includes/RawPage.php (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/SearchEngine.php (modified) (history)
  • /trunk/phase3/includes/SearchMySQL.php (modified) (history)
  • /trunk/phase3/includes/SearchMySQL4.php (modified) (history)
  • /trunk/phase3/includes/SearchTsearch2.php (modified) (history)
  • /trunk/phase3/includes/SearchUpdate.php (modified) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/SpecialBlockme.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/includes/SpecialRecentchanges.php (modified) (history)
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/includes/SpecialVersion.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/UpdateClasses.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/WebRequest.php (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -8,28 +8,11 @@
99 * @subpackage Skins
1010 */
1111
12 -# See skin.txt
13 -require_once( 'Linker.php' );
14 -require_once( 'Image.php' );
15 -
1612 # Get a list of available skins
1713 # Build using the regular expression '^(.*).php$'
1814 # Array keys are all lower case, array value keep the case used by filename
1915 #
2016
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 -
3417 /**
3518 * The main skin class that provide methods and properties for all other skins.
3619 * This base class is also the "Standard" skin.
@@ -55,9 +38,35 @@
5639 */
5740 function getSkinNames() {
5841 global $wgValidSkinNames;
 42+ if (!is_array($wgValidSkinNames)) {
 43+ Skin::initializeSkinNames();
 44+ }
5945 return $wgValidSkinNames;
6046 }
6147
 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+
6271 /**
6372 * Normalize a skin preference value to a form that can be loaded.
6473 * If a skin can't be found, it will fall back to the configured
@@ -745,7 +754,7 @@
746755 $s = '';
747756 if ( $wgUser->isAnon() ) {
748757 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
749 - $n = wfGetIP();
 758+ $n = ProxyTools::getIP();
750759
751760 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
752761 $wgLang->getNsText( NS_TALK ) );
@@ -896,8 +905,7 @@
897906 }
898907
899908 if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
900 - require_once('Credits.php');
901 - $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
 909+ $s .= ' ' . Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
902910 } else {
903911 $s .= $this->lastModified();
904912 }
@@ -1015,7 +1023,6 @@
10161024 */
10171025 function specialPagesList() {
10181026 global $wgUser, $wgContLang, $wgServer, $wgRedirectScript, $wgAvailableRights;
1019 - require_once('SpecialPage.php');
10201027 $a = array();
10211028 $pages = SpecialPage::getPages();
10221029
Index: trunk/phase3/includes/LoadBalancer.php
@@ -7,7 +7,6 @@
88 /**
99 * Depends on the database object
1010 */
11 -require_once( 'Database.php' );
1211
1312 # Valid database indexes
1413 # Operation-based indexes
@@ -440,12 +439,14 @@
441440 }
442441
443442 extract( $server );
 443+
444444 # Get class for this database type
445 - $class = 'Database' . ucfirst( $type );
446 - if ( !class_exists( $class ) ) {
447 - require_once( "$class.php" );
 445+ if ($type != 'mysql' ) {
 446+ $class = 'Database' . ucfirst( $type );
 447+ } else {
 448+ $class = 'Database';
448449 }
449 -
 450+
450451 # Create object
451452 $db = new $class( $host, $user, $password, $dbname, 1, $flags );
452453 $db->setLBInfo( $server );
Index: trunk/phase3/includes/EditPage.php
@@ -725,7 +725,7 @@
726726 $this->summary = '';
727727 if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI )
728728 $this->textbox1 = wfMsgWeirdKey ( $this->mArticle->mTitle->getText() ) ;
729 - wfProxyCheck();
 729+ ProxyTools::proxyCheck();
730730 }
731731
732732 /**
@@ -1118,7 +1118,6 @@
11191119 $wgOut->addHTML( "<input type=\"hidden\" name=\"wpAutoSummary\" value=\"$autosumm\" />\n" );
11201120
11211121 if ( $this->isConflict ) {
1122 - require_once( "DifferenceEngine.php" );
11231122 $wgOut->addWikiText( '==' . wfMsg( "yourdiff" ) . '==' );
11241123
11251124 $de = new DifferenceEngine( $this->mTitle );
@@ -1618,7 +1617,6 @@
16191618 * @return string HTML
16201619 */
16211620 function getDiff() {
1622 - require_once( 'DifferenceEngine.php' );
16231621 $oldtext = $this->mArticle->fetchContent();
16241622 $newtext = $this->mArticle->replaceSection(
16251623 $this->section, $this->textbox1, $this->summary, $this->edittime );
Index: trunk/phase3/includes/Math.php
@@ -248,15 +248,13 @@
249249 wfDebug( "TeX: getHashPath, hash is: $this->hash, path is: $path\n" );
250250 return $path;
251251 }
252 -
253 -
 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+ }
254259 }
255260
256 -function renderMath( $tex ) {
257 - global $wgUser;
258 - $math = new MathRenderer( $tex );
259 - $math->setOutputMode( $wgUser->getOption('math'));
260 - return $math->render();
261 -}
262 -
263261 ?>
Index: trunk/phase3/includes/PageHistory.php
@@ -576,9 +576,6 @@
577577 * @param string $type
578578 */
579579 function feed( $type ) {
580 - require_once 'Feed.php';
581 - require_once 'SpecialRecentchanges.php';
582 -
583580 global $wgFeedClasses;
584581 if( !isset( $wgFeedClasses[$type] ) ) {
585582 global $wgOut;
Index: trunk/phase3/includes/SpecialPreferences.php
@@ -444,7 +444,7 @@
445445 * @access private
446446 */
447447 function mainPrefsForm( $status , $message = '' ) {
448 - global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames;
 448+ global $wgUser, $wgOut, $wgLang, $wgContLang;
449449 global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
450450 global $wgDisableLangConversion;
451451 global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
@@ -723,7 +723,7 @@
724724 $previewtext = wfMsg('skinpreview');
725725 # Only show members of $wgValidSkinNames rather than
726726 # $skinNames (skins is all skin names from Language.php)
727 - foreach ($wgValidSkinNames as $skinkey => $skinname ) {
 727+ foreach (Skin::getSkinNames() as $skinkey => $skinname ) {
728728 if ( in_array( $skinkey, $wgSkipSkins ) ) {
729729 continue;
730730 }
Index: trunk/phase3/includes/SpecialPage.php
@@ -15,6 +15,10 @@
1616 * @subpackage SpecialPage
1717 */
1818
 19+/**
 20+ * @todo put all global specialpages stuff into class
 21+ */
 22+global $wgSpecialPages, $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
1923
2024 /**
2125 * @access private
Index: trunk/phase3/includes/DatabasePostgreSQL.php
@@ -14,11 +14,6 @@
1515 */
1616
1717 /**
18 - * Depends on database
19 - */
20 -require_once( 'Database.php' );
21 -
22 -/**
2318 *
2419 * @package MediaWiki
2520 */
Index: trunk/phase3/includes/AjaxDispatcher.php
@@ -1,18 +1,5 @@
22 <?php
33
4 -//$wgRequestTime = microtime();
5 -
6 -// unset( $IP );
7 -// @ini_set( 'allow_url_fopen', 0 ); # For security...
8 -
9 -# Valid web server entry point, enable includes.
10 -# Please don't move this line to includes/Defines.php. This line essentially defines
11 -# a valid entry point. If you put it in includes/Defines.php, then any script that includes
12 -# it becomes an entry point, thereby defeating its purpose.
13 -// define( 'MEDIAWIKI', true );
14 -// require_once( './includes/Defines.php' );
15 -// require_once( './LocalSettings.php' );
16 -// require_once( 'includes/Setup.php' );
174 require_once( 'AjaxFunctions.php' );
185
196 if ( ! $wgUseAjax ) {
Index: trunk/phase3/includes/SearchMySQL.php
@@ -24,9 +24,6 @@
2525 * @subpackage Search
2626 */
2727
28 -/** */
29 -require_once( 'SearchEngine.php' );
30 -
3128 /** @package MediaWiki */
3229 class SearchMySQL extends SearchEngine {
3330 /**
Index: trunk/phase3/includes/Parser.php
@@ -6,11 +6,6 @@
77 * @subpackage Parser
88 */
99
10 -/** */
11 -require_once( 'Sanitizer.php' );
12 -require_once( 'HttpFunctions.php' );
13 -require_once( 'ImageGallery.php' );
14 -
1510 /**
1611 * Update this version number when the ParserOutput format
1712 * changes in an incompatible way, so the parser cache
@@ -452,7 +447,7 @@
453448 $output = wfEscapeHTMLTagsOnly( $content );
454449 break;
455450 case 'math':
456 - $output = renderMath( $content );
 451+ $output = MathRenderer::renderMath( $content );
457452 break;
458453 case 'pre':
459454 // Backwards-compatibility hack
@@ -2972,7 +2967,7 @@
29732968 }
29742969 }
29752970
2976 - $text = wfGetHTTP($url);
 2971+ $text = HttpFunctions::getHTTP($url);
29772972 if (!$text)
29782973 return wfMsg('scarytranscludefailed', $url);
29792974
Index: trunk/phase3/includes/Revision.php
@@ -4,10 +4,6 @@
55 * @todo document
66 */
77
8 -/** */
9 -require_once( 'Database.php' );
10 -require_once( 'Article.php' );
11 -
128 /** @+ */
139 define( 'MW_REV_DELETED_TEXT', 1 );
1410 define( 'MW_REV_DELETED_COMMENT', 2 );
@@ -514,7 +510,6 @@
515511 wfProfileOut( $fname );
516512 return false;
517513 }
518 - require_once('ExternalStore.php');
519514 $text=ExternalStore::fetchFromURL($url);
520515 }
521516
@@ -604,7 +599,6 @@
605600 } else {
606601 $store = $wgDefaultExternalStore;
607602 }
608 - require_once('ExternalStore.php');
609603 // Store and get the URL
610604 $data = ExternalStore::insert( $store, $data );
611605 if ( !$data ) {
Index: trunk/phase3/includes/CacheManager.php
@@ -6,11 +6,6 @@
77 */
88
99 /**
10 - * We need the title class
11 - */
12 -require_once( 'Title.php' );
13 -
14 -/**
1510 * Handles talking to the file cache, putting stuff in and taking it back out.
1611 * Mostly called from Article.php, also from DatabaseFunctions.php for the
1712 * emergency abort/fallback to cache.
Index: trunk/phase3/includes/UpdateClasses.php
@@ -5,13 +5,4 @@
66 * @package MediaWiki
77 */
88
9 -/**
10 - *
11 - */
12 -
13 -require_once( 'SiteStatsUpdate.php' );
14 -require_once( 'LinksUpdate.php' );
15 -require_once( 'SearchUpdate.php' );
16 -require_once( 'SquidUpdate.php' );
17 -
189 ?>
\ No newline at end of file
Index: trunk/phase3/includes/HistoryBlob.php
@@ -167,18 +167,7 @@
168168 }
169169 }
170170
171 -
172171 /**
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 -/**
183172 * @package MediaWiki
184173 */
185174 class HistoryBlobStub {
@@ -215,6 +204,15 @@
216205 function getText() {
217206 $fname = 'HistoryBlob::getText';
218207 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+ }
219217 if( isset( $wgBlobCache[$this->mOldId] ) ) {
220218 $obj = $wgBlobCache[$this->mOldId];
221219 } else {
@@ -231,7 +229,6 @@
232230 wfProfileOut( $fname );
233231 return false;
234232 }
235 - require_once('ExternalStore.php');
236233 $row->old_text=ExternalStore::fetchFromUrl($url);
237234
238235 }
Index: trunk/phase3/includes/CategoryPage.php
@@ -10,9 +10,6 @@
1111 die( -1 );
1212
1313 global $wgCategoryMagicGallery;
14 -if( $wgCategoryMagicGallery )
15 - /** */
16 - require_once('ImageGallery.php');
1714
1815 /**
1916 * @package MediaWiki
Index: trunk/phase3/includes/SpecialBlockme.php
@@ -12,7 +12,7 @@
1313 {
1414 global $wgBlockOpenProxies, $wgOut, $wgProxyKey;
1515
16 - $ip = wfGetIP();
 16+ $ip = ProxyTools::getIP();
1717
1818 if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $ip . $wgProxyKey ) ) {
1919 $wgOut->addWikiText( wfMsg( "disabled" ) );
Index: trunk/phase3/includes/User.php
@@ -5,11 +5,6 @@
66 * @package MediaWiki
77 */
88
9 -/**
10 - *
11 - */
12 -require_once( 'WatchedItem.php' );
13 -
149 # Number of characters in user_token field
1510 define( 'USER_TOKEN_LENGTH', 32 );
1611
@@ -433,7 +428,7 @@
434429 wfDebug( "$fname: checking...\n" );
435430
436431 $this->mBlockedby = 0;
437 - $ip = wfGetIP();
 432+ $ip = ProxyTools::getIP();
438433
439434 # User/IP blocking
440435 $block = new Block();
@@ -454,7 +449,7 @@
455450 if ( !$this->isAllowed('proxyunbannable') && !in_array( $ip, $wgProxyWhitelist ) ) {
456451
457452 # Local list
458 - if ( wfIsLocallyBlockedProxy( $ip ) ) {
 453+ if ( ProxyTools::isLocallyBlockedProxy( $ip ) ) {
459454 $this->mBlockedby = wfMsg( 'proxyblocker' );
460455 $this->mBlockreason = wfMsg( 'proxyblockreason' );
461456 }
@@ -538,7 +533,7 @@
539534 $limits = $wgRateLimits[$action];
540535 $keys = array();
541536 $id = $this->getId();
542 - $ip = wfGetIP();
 537+ $ip = ProxyTools::getIP();
543538
544539 if( isset( $limits['anon'] ) && $id == 0 ) {
545540 $keys["$wgDBname:limiter:$action:anon"] = $limits['anon'];
@@ -790,7 +785,7 @@
791786 function getName() {
792787 $this->loadFromDatabase();
793788 if ( $this->mName === false ) {
794 - $this->mName = wfGetIP();
 789+ $this->mName = ProxyTools::getIP();
795790 }
796791 return $this->mName;
797792 }
@@ -1526,7 +1521,7 @@
15271522 }
15281523
15291524 # Check if this IP address is already blocked
1530 - $ipblock = Block::newFromDB( wfGetIP() );
 1525+ $ipblock = Block::newFromDB( ProxyTools::getIP() );
15311526 if ( $ipblock->isValid() ) {
15321527 # If the user is already blocked. Then check if the autoblock would
15331528 # excede the user block. If it would excede, then do nothing, else
@@ -1541,8 +1536,8 @@
15421537 }
15431538
15441539 # Make a new block object with the desired properties
1545 - wfDebug( "Autoblocking {$this->mName}@" . wfGetIP() . "\n" );
1546 - $ipblock->mAddress = wfGetIP();
 1540+ wfDebug( "Autoblocking {$this->mName}@" . ProxyTools::getIP() . "\n" );
 1541+ $ipblock->mAddress = ProxyTools::getIP();
15471542 $ipblock->mUser = 0;
15481543 $ipblock->mBy = $userblock->mBy;
15491544 $ipblock->mReason = wfMsg( 'autoblocker', $this->getName(), $userblock->mReason );
@@ -1762,7 +1757,7 @@
17631758 $url = $this->confirmationTokenUrl( $expiration );
17641759 return $this->sendMail( wfMsg( 'confirmemail_subject' ),
17651760 wfMsg( 'confirmemail_body',
1766 - wfGetIP(),
 1761+ ProxyTools::getIP(),
17671762 $this->getName(),
17681763 $url,
17691764 $wgContLang->timeanddate( $expiration, false ) ) );
Index: trunk/phase3/includes/DifferenceEngine.php
@@ -5,9 +5,6 @@
66 * @subpackage DifferenceEngine
77 */
88
9 -/** */
10 -require_once( 'Revision.php' );
11 -
129 define( 'MAX_DIFF_LINE', 10000 );
1310 define( 'MAX_DIFF_XREF_LENGTH', 10000 );
1411
Index: trunk/phase3/includes/Export.php
@@ -22,9 +22,6 @@
2323 * @subpackage SpecialPage
2424 */
2525
26 -/** */
27 -require_once( 'Revision.php' );
28 -
2926 define( 'MW_EXPORT_FULL', 0 );
3027 define( 'MW_EXPORT_CURRENT', 1 );
3128
Index: trunk/phase3/includes/RecentChange.php
@@ -205,7 +205,7 @@
206206 }
207207
208208 if ( !$ip ) {
209 - $ip = wfGetIP();
 209+ $ip = ProxyTools::getIP();
210210 if ( !$ip ) {
211211 $ip = '';
212212 }
@@ -249,7 +249,7 @@
250250 $ip='', $size = 0, $newId = 0 )
251251 {
252252 if ( !$ip ) {
253 - $ip = wfGetIP();
 253+ $ip = ProxyTools::getIP();
254254 if ( !$ip ) {
255255 $ip = '';
256256 }
@@ -294,7 +294,7 @@
295295 /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false )
296296 {
297297 if ( !$ip ) {
298 - $ip = wfGetIP();
 298+ $ip = ProxyTools::getIP();
299299 if ( !$ip ) {
300300 $ip = '';
301301 }
@@ -344,7 +344,7 @@
345345 $type, $action, $target, $logComment, $params )
346346 {
347347 if ( !$ip ) {
348 - $ip = wfGetIP();
 348+ $ip = ProxyTools::getIP();
349349 if ( !$ip ) {
350350 $ip = '';
351351 }
Index: trunk/phase3/includes/Setup.php
@@ -22,13 +22,14 @@
2323 die( -1 );
2424 }
2525
 26+require('AutoLoader.php');
 27+
2628 if( !isset( $wgProfiling ) )
2729 $wgProfiling = false;
2830
2931 if ( function_exists( 'wfProfileIn' ) ) {
3032 /* nada, everything should be done already */
3133 } elseif ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) {
32 - require_once( 'Profiling.php' );
3334 $wgProfiling = true;
3435 if ($wgProfilerType == "") {
3536 $wgProfiler = new Profiler();
@@ -48,29 +49,8 @@
4950 require_once( 'GlobalFunctions.php' );
5051 require_once( 'Hooks.php' );
5152 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' );
5953 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' );
7154
72 -if ( $wgUseDynamicDates ) {
73 - require_once( 'DateFormatter.php' );
74 -}
7555
7656 wfProfileOut( $fname.'-includes' );
7757 wfProfileIn( $fname.'-misc1' );
@@ -108,9 +88,9 @@
10989 wfProfileOut( $fname.'-misc1' );
11090 wfProfileIn( $fname.'-memcached' );
11191
112 -$wgMemc =& wfGetMainCache();
113 -$messageMemc =& wfGetMessageCacheStorage();
114 -$parserMemc =& wfGetParserCacheStorage();
 92+$wgMemc =& ObjectCacheManager::getMainCache();
 93+$messageMemc =& ObjectCacheManager::getMessageCache();
 94+$parserMemc =& ObjectCacheManager::getParserCache();
11595
11696 wfDebug( 'Main cache: ' . get_class( $wgMemc ) .
11797 "\nMessage cache: " . get_class( $messageMemc ) .
@@ -208,7 +188,6 @@
209189 }
210190
211191 if( !is_object( $wgAuth ) ) {
212 - require_once( 'AuthPlugin.php' );
213192 $wgAuth = new AuthPlugin();
214193 }
215194
@@ -296,7 +275,6 @@
297276 $wgMwRedir =& MagicWord::get( MAG_REDIRECT );
298277
299278 if ( $wgUseXMLparser ) {
300 - require_once( 'ParserXML.php' );
301279 $wgParser = new ParserXML();
302280 } else {
303281 $wgParser = new Parser();
Index: trunk/phase3/includes/QueryPage.php
@@ -5,11 +5,6 @@
66 */
77
88 /**
9 - *
10 - */
11 -require_once 'Feed.php';
12 -
13 -/**
149 * List of query page classes and their associated special pages, for periodic update purposes
1510 */
1611 global $wgQueryPages; // not redundant
Index: trunk/phase3/includes/MessageCache.php
@@ -5,9 +5,6 @@
66 * @subpackage Cache
77 */
88
9 -/** */
10 -require_once( 'Revision.php' );
11 -
129 /**
1310 *
1411 */
Index: trunk/phase3/includes/SpecialRecentchanges.php
@@ -6,13 +6,6 @@
77 */
88
99 /**
10 - *
11 - */
12 -require_once( 'Feed.php' );
13 -require_once( 'ChangesList.php' );
14 -require_once( 'Revision.php' );
15 -
16 -/**
1710 * Constructor
1811 */
1912 function wfSpecialRecentchanges( $par, $specialPage ) {
Index: trunk/phase3/includes/SpecialUpload.php
@@ -9,8 +9,6 @@
1010 *
1111 */
1212 require_once 'Image.php';
13 -require_once 'MacBinary.php';
14 -require_once 'Licenses.php';
1513 /**
1614 * Entry point
1715 */
Index: trunk/phase3/includes/RawPage.php
@@ -10,9 +10,6 @@
1111 * @package MediaWiki
1212 */
1313
14 -/** */
15 -require_once( 'Revision.php' );
16 -
1714 /**
1815 * @todo document
1916 * @package MediaWiki
Index: trunk/phase3/includes/ObjectCache.php
@@ -33,93 +33,91 @@
3434 global $wgCaches;
3535 $wgCaches = array();
3636
37 -/** @todo document */
38 -function &wfGetCache( $inputType ) {
39 - global $wgCaches, $wgMemCachedServers, $wgMemCachedDebug, $wgMemCachedPersistent;
40 - $cache = false;
 37+class ObjectCacheManager {
 38+ /* @static */
 39+ function getCache( $inputType ) {
 40+ global $wgCaches, $wgMemCachedServers, $wgMemCachedDebug, $wgMemCachedPersistent;
 41+ $cache = false;
4142
42 - if ( $inputType == CACHE_ANYTHING ) {
43 - reset( $wgCaches );
44 - $type = key( $wgCaches );
45 - if ( $type === false || $type === CACHE_NONE ) {
46 - $type = CACHE_DB;
 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;
4751 }
48 - } else {
49 - $type = $inputType;
50 - }
5152
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 - }
 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;
6171 }
6272 }
 73+ if ( $wgCaches[CACHE_ACCEL] !== false ) {
 74+ $cache =& $wgCaches[CACHE_ACCEL];
 75+ }
 76+ }
6377
64 - $wgCaches[CACHE_DB] = new MemCachedClientforWiki(
65 - array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) );
 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+ }
6682 $cache =& $wgCaches[CACHE_DB];
67 - $cache->set_servers( $wgMemCachedServers );
68 - $cache->set_debug( $wgMemCachedDebug );
6983 }
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;
 84+
 85+ if ( $cache === false ) {
 86+ if ( !array_key_exists( CACHE_NONE, $wgCaches ) ) {
 87+ $wgCaches[CACHE_NONE] = new FakeMemCachedClient;
8388 }
 89+ $cache =& $wgCaches[CACHE_NONE];
8490 }
85 - if ( $wgCaches[CACHE_ACCEL] !== false ) {
86 - $cache =& $wgCaches[CACHE_ACCEL];
87 - }
88 - }
8991
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];
 92+ return $cache;
9693 }
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];
 94+
 95+ /** @static */
 96+ function &getMainCache() {
 97+ global $wgMainCacheType;
 98+ $ret =& ObjectCacheManager::getCache( $wgMainCacheType );
 99+ return $ret;
103100 }
104101
105 - return $cache;
 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+
106116 }
107117
108 -function &wfGetMainCache() {
109 - global $wgMainCacheType;
110 - $ret =& wfGetCache( $wgMainCacheType );
111 - return $ret;
 118+class MemCachedClientforWiki extends memcached {
 119+ function _debugprint( $text ) {
 120+ wfDebug( "memcached: $text\n" );
 121+ }
112122 }
113123
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 -
126124 ?>
Index: trunk/phase3/includes/SearchEngine.php
@@ -195,10 +195,8 @@
196196 $class = $wgSearchType;
197197 } elseif( $wgDBtype == 'mysql' ) {
198198 $class = 'SearchMySQL4';
199 - require_once( 'SearchMySQL4.php' );
200199 } else if ( $wgDBtype == 'PostgreSQL' ) {
201200 $class = 'SearchTsearch2';
202 - require_once( 'SearchTsearch2.php' );
203201 } else {
204202 $class = 'SearchEngineDummy';
205203 }
Index: trunk/phase3/includes/SearchTsearch2.php
@@ -23,9 +23,6 @@
2424 * @subpackage Search
2525 */
2626
27 -/** */
28 -require_once( 'SearchEngine.php' );
29 -
3027 /**
3128 * @todo document
3229 * @package MediaWiki
Index: trunk/phase3/includes/ProxyTools.php
@@ -4,230 +4,228 @@
55 * @package MediaWiki
66 */
77
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';
 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+ }
1724 }
18 - if( isset( $set[$index] ) ) {
19 - return $set[$index];
20 - } else {
21 - return null;
22 - }
23 -}
2425
25 -/** Work out the IP address based on various globals */
26 -function wfGetIP() {
27 - global $wgSquidServers, $wgSquidServersNoPurge, $wgIP;
 26+ /** Work out the IP address based on various globals */
 27+ function getIP() {
 28+ global $wgSquidServers, $wgSquidServersNoPurge, $wgIP;
2829
29 - # Return cached result
30 - if ( !empty( $wgIP ) ) {
31 - return $wgIP;
32 - }
 30+ # Return cached result
 31+ if ( !empty( $wgIP ) ) {
 32+ return $wgIP;
 33+ }
3334
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 );
 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' );
5442 }
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];
 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;
6165 }
62 - } else {
63 - break;
6466 }
6567 }
66 - }
6768
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 );
 69+ wfDebug( "IP: $ip\n" );
 70+ $wgIP = $ip;
 71+ return $ip;
8372 }
84 - return $n;
85 -}
8673
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 );
 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;
9486 }
95 - return $n;
96 -}
9787
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;
 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;
10697 }
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 - }
11398
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 ) {
 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 ) {
129106 return false;
130107 }
131 - }
132 - return true;
133 -}
 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+ }
134114
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;
 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+ }
143125
144 - if ( !$wgBlockOpenProxies ) {
145 - return;
 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;
146134 }
147135
148 - $ip = wfGetIP();
 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;
149144
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;
 145+ if ( !$wgBlockOpenProxies ) {
 146+ return;
157147 }
158 - }
159148
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 );
 149+ $ip = ProxyTools::getIP();
165150
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
 151+ # Get MemCached key
 152+ $skip = false;
176153 if ( $wgUseMemCached ) {
177 - $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry );
 154+ $mcKey = "$wgDBname:proxy:ip:$ip";
 155+ $mcValue = $wgMemc->get( $mcKey );
 156+ if ( $mcValue ) {
 157+ $skip = true;
 158+ }
178159 }
179 - }
180 -}
181160
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 -}
 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 );
199166
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;
 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+ }
209181 }
210 - wfProfileIn( $fname );
211182
212 - if ( !is_array( $wgProxyList ) ) {
213 - # Load from the specified file
214 - $wgProxyList = array_map( 'trim', file( $wgProxyList ) );
 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 );
215199 }
216200
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 -}
 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';
230207
 208+ if ( !$wgProxyList ) {
 209+ return false;
 210+ }
 211+ wfProfileIn( $fname );
231212
 213+ if ( !is_array( $wgProxyList ) ) {
 214+ # Load from the specified file
 215+ $wgProxyList = array_map( 'trim', file( $wgProxyList ) );
 216+ }
232217
233 -
 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+}
234232 ?>
Index: trunk/phase3/includes/ExternalStoreDB.php
@@ -6,9 +6,7 @@
77 * DB accessable external objects
88 *
99 */
10 -require_once( 'LoadBalancer.php' );
1110
12 -
1311 /** @package MediaWiki */
1412
1513 /**
Index: trunk/phase3/includes/Credits.php
@@ -24,164 +24,165 @@
2525 /**
2626 * This is largely cadged from PageHistory::history
2727 */
28 -function showCreditsPage($article) {
29 - global $wgOut;
 28+class Credits {
 29+ function showCreditsPage($article) {
 30+ global $wgOut;
3031
31 - $fname = 'showCreditsPage';
 32+ $fname = 'Credits::showCreditsPage';
3233
33 - wfProfileIn( $fname );
 34+ wfProfileIn( $fname );
3435
35 - $wgOut->setPageTitle( $article->mTitle->getPrefixedText() );
36 - $wgOut->setSubtitle( wfMsg( 'creditspage' ) );
37 - $wgOut->setArticleFlag( false );
38 - $wgOut->setArticleRelated( true );
39 - $wgOut->setRobotpolicy( 'noindex,nofollow' );
 36+ $wgOut->setPageTitle( $article->mTitle->getPrefixedText() );
 37+ $wgOut->setSubtitle( wfMsg( 'creditspage' ) );
 38+ $wgOut->setArticleFlag( false );
 39+ $wgOut->setArticleRelated( true );
 40+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
4041
41 - if( $article->mTitle->getArticleID() == 0 ) {
42 - $s = wfMsg( 'nocredits' );
43 - } else {
44 - $s = getCredits($article, -1);
45 - }
 42+ if( $article->mTitle->getArticleID() == 0 ) {
 43+ $s = wfMsg( 'nocredits' );
 44+ } else {
 45+ $s = Credits::getCredits($article, -1);
 46+ }
4647
47 - $wgOut->addHTML( $s );
 48+ $wgOut->addHTML( $s );
4849
49 - wfProfileOut( $fname );
50 -}
 50+ wfProfileOut( $fname );
 51+ }
5152
52 -function getCredits($article, $cnt, $showIfMax=true) {
53 - $fname = 'getCredits';
54 - wfProfileIn( $fname );
55 - $s = '';
 53+ function getCredits($article, $cnt, $showIfMax=true) {
 54+ $fname = 'Credits::getCredits';
 55+ wfProfileIn( $fname );
 56+ $s = '';
5657
57 - if (isset($cnt) && $cnt != 0) {
58 - $s = getAuthorCredits($article);
59 - if ($cnt > 1 || $cnt < 0) {
60 - $s .= ' ' . getContributorCredits($article, $cnt - 1, $showIfMax);
 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+ }
6163 }
 64+
 65+ wfProfileOut( $fname );
 66+ return $s;
6267 }
6368
64 - wfProfileOut( $fname );
65 - return $s;
66 -}
 69+ /**
 70+ *
 71+ */
 72+ function getAuthorCredits($article) {
 73+ global $wgLang, $wgAllowRealName;
6774
68 -/**
69 - *
70 - */
71 -function getAuthorCredits($article) {
72 - global $wgLang, $wgAllowRealName;
 75+ $last_author = $article->getUser();
7376
74 - $last_author = $article->getUser();
 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);
7582
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);
 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+ }
8189
82 - if (!empty($real_name)) {
83 - $author_credit = creditLink($user_name, $real_name);
 90+ $timestamp = $article->getTimestamp();
 91+ if ($timestamp) {
 92+ $d = $wgLang->timeanddate($article->getTimestamp(), true);
8493 } else {
85 - $author_credit = wfMsg('siteuser', creditLink($user_name));
 94+ $d = '';
8695 }
 96+ return wfMsg('lastmodifiedby', $d, $author_credit);
8797 }
8898
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 -}
 99+ /**
 100+ *
 101+ */
 102+ function getContributorCredits($article, $cnt, $showIfMax) {
97103
98 -/**
99 - *
100 - */
101 -function getContributorCredits($article, $cnt, $showIfMax) {
 104+ global $wgLang, $wgAllowRealName;
102105
103 - global $wgLang, $wgAllowRealName;
 106+ $contributors = $article->getContributors();
104107
105 - $contributors = $article->getContributors();
 108+ $others_link = '';
106109
107 - $others_link = '';
 110+ # Hmm... too many to fit!
108111
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);
 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+ }
117119 }
118 - }
119120
120 - $real_names = array();
121 - $user_names = array();
 121+ $real_names = array();
 122+ $user_names = array();
122123
123 - $anon = '';
 124+ $anon = '';
124125
125 - # Sift for real versus user names
 126+ # Sift for real versus user names
126127
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]);
 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+ }
131135 } else {
132 - $user_names[] = creditLink($user_parts[1]);
 136+ $anon = wfMsg('anonymous');
133137 }
134 - } else {
135 - $anon = wfMsg('anonymous');
136138 }
137 - }
138139
139 - # Two strings: real names, and user names
 140+ # Two strings: real names, and user names
140141
141 - $real = $wgLang->listToText($real_names);
142 - $user = $wgLang->listToText($user_names);
 142+ $real = $wgLang->listToText($real_names);
 143+ $user = $wgLang->listToText($user_names);
143144
144 - # "ThisSite user(s) A, B and C"
 145+ # "ThisSite user(s) A, B and C"
145146
146 - if (!empty($user)) {
147 - $user = wfMsg('siteusers', $user);
148 - }
 147+ if (!empty($user)) {
 148+ $user = wfMsg('siteusers', $user);
 149+ }
149150
150 - # This is the big list, all mooshed together. We sift for blank strings
 151+ # This is the big list, all mooshed together. We sift for blank strings
151152
152 - $fulllist = array();
 153+ $fulllist = array();
153154
154 - foreach (array($real, $user, $anon, $others_link) as $s) {
155 - if (!empty($s)) {
156 - array_push($fulllist, $s);
 155+ foreach (array($real, $user, $anon, $others_link) as $s) {
 156+ if (!empty($s)) {
 157+ array_push($fulllist, $s);
 158+ }
157159 }
158 - }
159160
160 - # Make the list into text...
 161+ # Make the list into text...
161162
162 - $creds = $wgLang->listToText($fulllist);
 163+ $creds = $wgLang->listToText($fulllist);
163164
164 - # "Based on work by ..."
 165+ # "Based on work by ..."
165166
166 - return (empty($creds)) ? '' : wfMsg('othercontribs', $creds);
167 -}
 167+ return (empty($creds)) ? '' : wfMsg('othercontribs', $creds);
 168+ }
168169
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 -}
 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+ }
178179
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');
 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+ }
186188 }
187 -
188189 ?>
Index: trunk/phase3/includes/Database.php
@@ -5,11 +5,6 @@
66 * @package MediaWiki
77 */
88
9 -/**
10 - * Depends on the CacheManager
11 - */
12 -require_once( 'CacheManager.php' );
13 -
149 /** See Database::makeList() */
1510 define( 'LIST_COMMA', 0 );
1611 define( 'LIST_AND', 1 );
Index: trunk/phase3/includes/SearchUpdate.php
@@ -37,7 +37,6 @@
3838 $fname = 'SearchUpdate::doUpdate';
3939 wfProfileIn( $fname );
4040
41 - require_once( 'SearchEngine.php' );
4241 $search = SearchEngine::create();
4342 $lc = $search->legalSearchChars() . '&#;';
4443
Index: trunk/phase3/includes/AjaxFunctions.php
@@ -3,8 +3,6 @@
44 if( !defined( 'MEDIAWIKI' ) )
55 die( -1 );
66
7 -require_once('WebRequest.php');
8 -
97 /**
108 * Function converts an Javascript escaped string back into a string with
119 * specified charset (default is UTF-8).
Index: trunk/phase3/includes/LogPage.php
@@ -83,7 +83,6 @@
8484 $rcComment .= ': ' . $this->comment;
8585 }
8686
87 - require_once( 'RecentChange.php' );
8887 RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
8988 $this->type, $this->action, $this->target, $this->comment, $this->params );
9089 }
Index: trunk/phase3/includes/Title.php
@@ -5,9 +5,6 @@
66 * @package MediaWiki
77 */
88
9 -/** */
10 -require_once( 'normal/UtfNormal.php' );
11 -
129 $wgTitleInterwikiCache = array();
1310 $wgTitleCache = array();
1411
@@ -334,7 +331,6 @@
335332 */
336333 /* static */ function indexTitle( $ns, $title ) {
337334 global $wgContLang;
338 - require_once( 'SearchEngine.php' );
339335
340336 $lc = SearchEngine::legalSearchChars() . '&#;';
341337 $t = $wgContLang->stripForSearch( $title );
@@ -1162,8 +1158,7 @@
11631159 * Check that the corresponding skin exists
11641160 */
11651161 function isValidCssJsSubpage() {
1166 - global $wgValidSkinNames;
1167 - return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), $wgValidSkinNames ) );
 1162+ return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), Skin::getSkinNames() ) );
11681163 }
11691164 /**
11701165 * Trim down a .css or .js subpage title to get the corresponding skin name
Index: trunk/phase3/includes/Image.php
@@ -12,9 +12,6 @@
1313 * extension=extensions/php_exif.dll
1414 */
1515
16 -if ($wgShowEXIF)
17 - require_once('Exif.php');
18 -
1916 /**
2017 * Bump this number when serialized cache records may be incompatible.
2118 */
Index: trunk/phase3/includes/Profiling.php
@@ -278,7 +278,6 @@
279279 }
280280 }
281281 $prof .= "\nTotal: $total\n\n";
282 -
283282 return $prof;
284283 }
285284
@@ -322,7 +321,6 @@
323322 } else {
324323 $pfhost = '';
325324 }
326 -
327325 $sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, "."pf_time=pf_time + {$timeSum} ".
328326 "WHERE pf_name='{$encname}' AND pf_server='{$pfhost}'";
329327 $dbw->query($sql);
Index: trunk/phase3/includes/Wiki.php
@@ -176,10 +176,8 @@
177177
178178 switch( $title->getNamespace() ) {
179179 case NS_IMAGE:
180 - require_once( 'includes/ImagePage.php' );
181180 return new ImagePage( $title );
182181 case NS_CATEGORY:
183 - require_once( 'includes/CategoryPage.php' );
184182 return new CategoryPage( $title );
185183 default:
186184 return new Article( $title );
@@ -284,8 +282,6 @@
285283 $n = intval( $wgJobRunRate );
286284 }
287285
288 - require_once( 'JobQueue.php' );
289 -
290286 while ( $n-- && false != ($job = Job::pop())) {
291287 $output = $job->toString() . "\n";
292288 if ( !$job->run() ) {
@@ -359,8 +355,7 @@
360356 }
361357 break;
362358 case 'credits':
363 - require_once( 'includes/Credits.php' );
364 - showCreditsPage( $article );
 359+ Credits::showCreditsPage( $article );
365360 break;
366361 case 'submit':
367362 if( !$this->getVal( 'CommandLineMode' ) && !$request->checkSessionCookie() ) {
@@ -375,11 +370,9 @@
376371 $oldid = $request->getVal( 'oldid' );
377372 if( !$this->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal ||
378373 $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
379 - require_once( 'includes/EditPage.php' );
380374 $editor = new EditPage( $article );
381375 $editor->submit();
382376 } elseif( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
383 - require_once( 'includes/ExternalEdit.php' );
384377 $mode = $request->getVal( 'mode' );
385378 $extedit = new ExternalEdit( $article, $mode );
386379 $extedit->edit();
@@ -389,12 +382,10 @@
390383 if( $_SERVER['REQUEST_URI'] == $title->getInternalURL( 'action=history' ) ) {
391384 $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
392385 }
393 - require_once( 'includes/PageHistory.php' );
394386 $history = new PageHistory( $article );
395387 $history->history();
396388 break;
397389 case 'raw':
398 - require_once( 'includes/RawPage.php' );
399390 $raw = new RawPage( $article );
400391 $raw->view();
401392 break;
Index: trunk/phase3/includes/HttpFunctions.php
@@ -3,88 +3,89 @@
44 * Various HTTP related functions
55 */
66
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;
 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;
1415
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 - }
 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+ }
2324
24 - if ( $timeout == 'default' ) {
25 - $timeout = $wgHTTPTimeout;
26 - }
27 - curl_setopt( $c, CURLOPT_TIMEOUT, $timeout );
28 - curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" );
 25+ if ( $timeout == 'default' ) {
 26+ $timeout = $wgHTTPTimeout;
 27+ }
 28+ curl_setopt( $c, CURLOPT_TIMEOUT, $timeout );
 29+ curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" );
2930
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 - }
 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+ }
3839
39 - ob_start();
40 - curl_exec( $c );
41 - $text = ob_get_contents();
42 - ob_end_clean();
 40+ ob_start();
 41+ curl_exec( $c );
 42+ $text = ob_get_contents();
 43+ ob_end_clean();
4344
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;
 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 );
4756 }
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 );
 57+ return $text;
5558 }
56 - return $text;
57 -}
5859
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 - }
 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+ }
6768
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;
 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+ }
8287 }
83 - if ( $wgConf->isLocalVHost( $domain ) ) {
84 - return true;
85 - }
8688 }
 89+ return false;
8790 }
88 - return false;
8991 }
90 -
9192 ?>
Index: trunk/phase3/includes/ParserXML.php
@@ -5,9 +5,6 @@
66 * @subpackage Experimental
77 */
88
9 -/** */
10 -require_once ('Parser.php');
11 -
129 /**
1310 * This should one day become the XML->(X)HTML parser
1411 * Based on work by Jan Hidders and Magnus Manske
Index: trunk/phase3/includes/ImagePage.php
@@ -9,8 +9,6 @@
1010 if( !defined( 'MEDIAWIKI' ) )
1111 die( -1 );
1212
13 -require_once( 'Image.php' );
14 -
1513 /**
1614 * Special handling for image description pages
1715 * @package MediaWiki
@@ -309,9 +307,8 @@
310308 $wgOut->addHTML($sharedtext);
311309
312310 if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
313 - require_once("HttpFunctions.php");
314311 $ur = ini_set('allow_url_fopen', true);
315 - $text = wfGetHTTP($url . '?action=render');
 312+ $text = HttpFunctions::getHTTP($url . '?action=render');
316313 ini_set('allow_url_fopen', $ur);
317314 if ($text)
318315 $this->mExtraDescription = $text;
@@ -674,7 +671,6 @@
675672 }
676673
677674 function blockedIPpage() {
678 - require_once( 'EditPage.php' );
679675 $edit = new EditPage( $this );
680676 return $edit->blockedIPpage();
681677 }
Index: trunk/phase3/includes/SearchMySQL4.php
@@ -23,8 +23,6 @@
2424 * @subpackage Search
2525 */
2626
27 -require_once( 'SearchMySQL.php' );
28 -
2927 /**
3028 * @package MediaWiki
3129 * @subpackage Search
Index: trunk/phase3/includes/LinksUpdate.php
@@ -119,7 +119,6 @@
120120 if ( $this->mRecursive ) {
121121 $tlto = $this->mTitle->getTemplateLinksTo();
122122 if ( count( $tlto ) ) {
123 - require_once( 'JobQueue.php' );
124123 Job::queueLinksJobs( $tlto );
125124 }
126125 }
@@ -155,7 +154,6 @@
156155 if ( $this->mRecursive ) {
157156 $tlto = $this->mTitle->getTemplateLinksTo();
158157 if ( count( $tlto ) ) {
159 - require_once( 'JobQueue.php' );
160158 Job::queueLinksJobs( $tlto );
161159 }
162160 }
Index: trunk/phase3/includes/SpecialVersion.php
@@ -190,7 +190,7 @@
191191 * @return string
192192 */
193193 function IPInfo() {
194 - $ip = str_replace( '--', ' - ', htmlspecialchars( wfGetIP() ) );
 194+ $ip = str_replace( '--', ' - ', htmlspecialchars( ProxyTools::getIP() ) );
195195 return "<!-- visited from $ip -->\n" .
196196 "<span style='display:none'>visited from $ip</span>";
197197 }
Index: trunk/phase3/includes/Block.php
@@ -169,7 +169,7 @@
170170 {
171171 $fname = 'Block::loadRange';
172172
173 - $iaddr = wfIP2Hex( $address );
 173+ $iaddr = ProxyTools::IP2Hex( $address );
174174 if ( $iaddr === false ) {
175175 # Invalid address
176176 return false;
@@ -207,7 +207,7 @@
208208 * Determine if a given integer IPv4 address is in a given CIDR network
209209 */
210210 function isAddressInRange( $addr, $range ) {
211 - list( $network, $bits ) = wfParseCIDR( $range );
 211+ list( $network, $bits ) = ProxyTools::parseCIDR( $range );
212212 if ( $network !== false && $addr >> ( 32 - $bits ) == $network >> ( 32 - $bits ) ) {
213213 return true;
214214 } else {
@@ -241,7 +241,7 @@
242242 $this->mRangeStart = '';
243243 $this->mRangeEnd = '';
244244 if ( $this->mUser == 0 ) {
245 - list( $network, $bits ) = wfParseCIDR( $this->mAddress );
 245+ list( $network, $bits ) = ProxyTools::parseCIDR( $this->mAddress );
246246 if ( $network !== false ) {
247247 $this->mRangeStart = sprintf( '%08X', $network );
248248 $this->mRangeEnd = sprintf( '%08X', $network + (1 << (32 - $bits)) - 1 );
@@ -431,7 +431,7 @@
432432 $parts = explode( '/', $range );
433433 if ( count( $parts ) == 2 ) {
434434 $shift = 32 - $parts[1];
435 - $ipint = wfIP2Unsigned( $parts[0] );
 435+ $ipint = ProxyTools::IP2Unsigned( $parts[0] );
436436 $ipint = $ipint >> $shift << $shift;
437437 $newip = long2ip( $ipint );
438438 $range = "$newip/{$parts[1]}";
Index: trunk/phase3/includes/OutputPage.php
@@ -5,9 +5,6 @@
66 * @package MediaWiki
77 */
88
9 -if ( $wgUseTeX )
10 - require_once 'Math.php';
11 -
129 /**
1310 * @todo document
1411 * @package MediaWiki
@@ -650,7 +647,7 @@
651648
652649 $id = $wgUser->blockedBy();
653650 $reason = $wgUser->blockedFor();
654 - $ip = wfGetIP();
 651+ $ip = ProxyTools::getIP();
655652
656653 if ( is_numeric( $id ) ) {
657654 $name = User::whoIs( $id );
Index: trunk/phase3/includes/SkinTemplate.php
@@ -343,8 +343,7 @@
344344 $this->credits = false;
345345
346346 if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
347 - require_once("Credits.php");
348 - $this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
 347+ $this->credits = Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
349348 } else {
350349 $tpl->set('lastmod', $this->lastModified());
351350 }
Index: trunk/phase3/includes/ChangesList.php
@@ -7,7 +7,6 @@
88 * - recent changes
99 */
1010
11 -require_once("RecentChange.php");
1211 /**
1312 * @todo document
1413 * @package MediaWiki
Index: trunk/phase3/includes/SpecialUserlogin.php
@@ -210,7 +210,7 @@
211211 return false;
212212 }
213213
214 - $ip = wfGetIP();
 214+ $ip = ProxyTools::getIP();
215215 if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) &&
216216 $wgUser->inSorbsBlacklist( $ip ) )
217217 {
@@ -416,7 +416,7 @@
417417
418418 $u->saveSettings();
419419
420 - $ip = wfGetIP();
 420+ $ip = ProxyTools::getIP();
421421 if ( '' == $ip ) { $ip = '(Unknown)'; }
422422
423423 $m = wfMsg( 'passwordremindertext', $ip, $u->getName(), $np, $wgServer . $wgScript );
Index: trunk/phase3/includes/Article.php
@@ -4,12 +4,6 @@
55 * @package MediaWiki
66 */
77
8 -/**
9 - * Need the CacheManager to be loaded
10 - */
11 -require_once( 'CacheManager.php' );
12 -require_once( 'Revision.php' );
13 -
148 $wgArticleCurContentFields = false;
159 $wgArticleOldContentFields = false;
1610
@@ -762,7 +756,6 @@
763757 # diff page instead of the article.
764758
765759 if ( !is_null( $diff ) ) {
766 - require_once( 'DifferenceEngine.php' );
767760 $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
768761
769762 $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid );
@@ -1233,7 +1226,6 @@
12341227
12351228 Article::onArticleCreate( $this->mTitle );
12361229 if(!$suppressRC) {
1237 - require_once( 'RecentChange.php' );
12381230 $rcid = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, 'default',
12391231 '', strlen( $text ), $revisionId );
12401232 # Mark as patrolled if the user can and has the option set
@@ -1440,7 +1432,6 @@
14411433 $dbw->rollback();
14421434 } else {
14431435 # Update recentchanges and purge cache and whatnot
1444 - require_once( 'RecentChange.php' );
14451436 $bot = (int)($wgUser->isBot() || $forceBot);
14461437 $rcid = RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary,
14471438 $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
@@ -1564,7 +1555,6 @@
15651556 $rcid = $wgRequest->getVal( 'rcid' );
15661557 if ( !is_null ( $rcid ) ) {
15671558 if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, false ) ) ) {
1568 - require_once( 'RecentChange.php' );
15691559 RecentChange::markPatrolled( $rcid );
15701560 wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
15711561 $wgOut->setPagetitle( wfMsg( 'markedaspatrolled' ) );
@@ -1679,7 +1669,6 @@
16801670 * action=protect handler
16811671 */
16821672 function protect() {
1683 - require_once 'ProtectionForm.php';
16841673 $form = new ProtectionForm( $this );
16851674 $form->show();
16861675 }
Index: trunk/phase3/includes/WebRequest.php
@@ -117,7 +117,6 @@
118118 $data = $wgContLang->checkTitleEncoding( $data );
119119 }
120120 }
121 - require_once( 'normal/UtfNormal.php' );
122121 $data = $this->normalizeUnicode( $data );
123122 return $data;
124123 } else {
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -27,8 +27,6 @@
2828
2929
3030 require_once( 'DatabaseFunctions.php' );
31 -require_once( 'UpdateClasses.php' );
32 -require_once( 'LogPage.php' );
3331 require_once( 'normal/UtfNormalUtil.php' );
3432 require_once( 'XmlFunctions.php' );
3533
@@ -1508,11 +1506,6 @@
15091507 return $wgMimeMagic;
15101508 }
15111509
1512 - if (!class_exists("MimeMagic")) {
1513 - #include on demand
1514 - require_once("MimeMagic.php");
1515 - }
1516 -
15171510 $wgMimeMagic= new MimeMagic();
15181511
15191512 return $wgMimeMagic;
@@ -1861,4 +1854,27 @@
18621855 }
18631856 }
18641857
 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+
18651881 ?>
Index: trunk/phase3/includes/DatabaseOracle.php
@@ -6,11 +6,6 @@
77 * @package MediaWiki
88 */
99
10 -/**
11 - * Depends on database
12 - */
13 -require_once( 'Database.php' );
14 -
1510 class OracleBlob extends DBObject {
1611 function isLOB() {
1712 return true;
Index: trunk/phase3/includes/AutoLoader.php
@@ -0,0 +1,219 @@
 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+ require($classes[$class_name]);
 218+}
 219+
 220+?>
\ No newline at end of file

Status & tagging log