From: Brion Vibber Date: Thu, 1 Jun 2006 08:19:02 +0000 (+0000) Subject: Revert to r14512; domas introduced massive breakage with incomplete experimental... X-Git-Tag: 1.31.0-rc.0~56937 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=0a26267688048c5f3db2aa6fad47b6b06ac0c5a4;p=lhc%2Fweb%2Fwiklou.git Revert to r14512; domas introduced massive breakage with incomplete experimental changes. They will be recommitted when they work. :) --- diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php index f5af30b37e..ae0d3e3470 100644 --- a/includes/AjaxDispatcher.php +++ b/includes/AjaxDispatcher.php @@ -1,5 +1,18 @@ setPageTitle( $this->mTitle->getPrefixedText() ); $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid ); @@ -1226,6 +1233,7 @@ class Article { Article::onArticleCreate( $this->mTitle ); if(!$suppressRC) { + require_once( 'RecentChange.php' ); $rcid = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, 'default', '', strlen( $text ), $revisionId ); # Mark as patrolled if the user can and has the option set @@ -1432,6 +1440,7 @@ class Article { $dbw->rollback(); } else { # Update recentchanges and purge cache and whatnot + require_once( 'RecentChange.php' ); $bot = (int)($wgUser->isBot() || $forceBot); $rcid = RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary, $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize, @@ -1555,6 +1564,7 @@ class Article { $rcid = $wgRequest->getVal( 'rcid' ); if ( !is_null ( $rcid ) ) { if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, false ) ) ) { + require_once( 'RecentChange.php' ); RecentChange::markPatrolled( $rcid ); wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) ); $wgOut->setPagetitle( wfMsg( 'markedaspatrolled' ) ); @@ -1669,6 +1679,7 @@ class Article { * action=protect handler */ function protect() { + require_once 'ProtectionForm.php'; $form = new ProtectionForm( $this ); $form->show(); } diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php deleted file mode 100644 index 62ef4a26eb..0000000000 --- a/includes/AutoLoader.php +++ /dev/null @@ -1,223 +0,0 @@ - 'AjaxDispatcher.php', - 'AjaxCachePolicy' => 'AjaxFunctions.php', - 'Article' => 'Article.php', - 'AuthPlugin' => 'AuthPlugin.php', - 'BagOStuff' => 'BagOStuff.php', - 'HashBagOStuff' => 'BagOStuff.php', - 'SqlBagOStuff' => 'BagOStuff.php', - 'MediaWikiBagOStuff' => 'BagOStuff.php', - 'TurckBagOStuff' => 'BagOStuff.php', - 'APCBagOStuff' => 'BagOStuff.php', - 'eAccelBagOStuff' => 'BagOStuff.php', - 'Block' => 'Block.php', - 'CacheManager' => 'CacheManager.php', - 'CategoryPage' => 'CategoryPage.php', - 'Categoryfinder' => 'Categoryfinder.php', - 'RCCacheEntry' => 'ChangesList.php', - 'ChangesList' => 'ChangesList.php', - 'OldChangesList' => 'ChangesList.php', - 'EnhancedChangesList' => 'ChangesList.php', - 'DBObject' => 'Database.php', - 'Database' => 'Database.php', - 'DatabaseMysql' => 'Database.php', - 'ResultWrapper' => 'Database.php', - 'OracleBlob' => 'DatabaseOracle.php', - 'DatabaseOracle' => 'DatabaseOracle.php', - 'DatabasePgsql' => 'DatabasePostgreSQL.php', - 'DatabasePostgreSQL' => 'DatabasePostgreSQL.php', - 'DateFormatter' => 'DateFormatter.php', - 'DifferenceEngine' => 'DifferenceEngine.php', - '_DiffOp' => 'DifferenceEngine.php', - '_DiffOp_Copy' => 'DifferenceEngine.php', - '_DiffOp_Delete' => 'DifferenceEngine.php', - '_DiffOp_Add' => 'DifferenceEngine.php', - '_DiffOp_Change' => 'DifferenceEngine.php', - '_DiffEngine' => 'DifferenceEngine.php', - 'Diff' => 'DifferenceEngine.php', - 'MappedDiff' => 'DifferenceEngine.php', - 'DiffFormatter' => 'DifferenceEngine.php', - '_HWLDF_WordAccumulator' => 'DifferenceEngine.php', - 'WordLevelDiff' => 'DifferenceEngine.php', - 'TableDiffFormatter' => 'DifferenceEngine.php', - 'EditPage' => 'EditPage.php', - 'Exif' => 'Exif.php', - 'FormatExif' => 'Exif.php', - 'WikiExporter' => 'Export.php', - 'XmlDumpWriter' => 'Export.php', - 'DumpOutput' => 'Export.php', - 'DumpFileOutput' => 'Export.php', - 'DumpPipeOutput' => 'Export.php', - 'DumpGZipOutput' => 'Export.php', - 'DumpBZip2Output' => 'Export.php', - 'Dump7ZipOutput' => 'Export.php', - 'DumpFilter' => 'Export.php', - 'DumpNotalkFilter' => 'Export.php', - 'DumpNamespaceFilter' => 'Export.php', - 'DumpLatestFilter' => 'Export.php', - 'DumpMultiWriter' => 'Export.php', - 'ExternalEdit' => 'ExternalEdit.php', - 'ExternalStore' => 'ExternalStore.php', - 'ExternalStoreDB' => 'ExternalStoreDB.php', - 'ExternalStoreHttp' => 'ExternalStoreHttp.php', - 'FakeTitle' => 'FakeTitle.php', - 'FeedItem' => 'Feed.php', - 'ChannelFeed' => 'Feed.php', - 'RSSFeed' => 'Feed.php', - 'AtomFeed' => 'Feed.php', - 'ReplacerCallback' => 'GlobalFunctions.php', - 'Group' => 'Group.php', - 'HTMLForm' => 'HTMLForm.php', - 'HistoryBlob' => 'HistoryBlob.php', - 'ConcatenatedGzipHistoryBlob' => 'HistoryBlob.php', - 'HistoryBlobStub' => 'HistoryBlob.php', - 'HistoryBlobCurStub' => 'HistoryBlob.php', - 'Image' => 'Image.php', - 'ThumbnailImage' => 'Image.php', - 'ImageGallery' => 'ImageGallery.php', - 'ImagePage' => 'ImagePage.php', - 'ImageHistoryList' => 'ImagePage.php', - 'ImageRemote' => 'ImageRemote.php', - 'Job' => 'JobQueue.php', - 'Licenses' => 'Licenses.php', - 'License' => 'Licenses.php', - 'LinkBatch' => 'LinkBatch.php', - 'LinkCache' => 'LinkCache.php', - 'LinkFilter' => 'LinkFilter.php', - 'Linker' => 'Linker.php', - 'LinksUpdate' => 'LinksUpdate.php', - 'LoadBalancer' => 'LoadBalancer.php', - 'LogPage' => 'LogPage.php', - 'MacBinary' => 'MacBinary.php', - 'MagicWord' => 'MagicWord.php', - 'MathRenderer' => 'Math.php', - 'MessageCache' => 'MessageCache.php', - 'MimeMagic' => 'MimeMagic.php', - 'Namespace' => 'Namespace.php', - 'FakeMemCachedClient' => 'ObjectCache.php', - 'ObjectCacheManager' => 'ObjectCache.php', - 'MemCachedClientforWiki' => 'ObjectCache.php', - 'OutputPage' => 'OutputPage.php', - 'PageHistory' => 'PageHistory.php', - 'Parser' => 'Parser.php', - 'ParserOutput' => 'Parser.php', - 'ParserOptions' => 'Parser.php', - 'ParserCache' => 'ParserCache.php', - 'element' => 'ParserXML.php', - 'xml2php' => 'ParserXML.php', - 'ParserXML' => 'ParserXML.php', - 'ProfilerSimple' => 'ProfilerSimple.php', - 'ProfilerSimpleUDP' => 'ProfilerSimpleUDP.php', - 'Profiler' => 'Profiling.php', - 'ProxyTools' => 'ProxyTools.php', - 'ProtectionForm' => 'ProtectionForm.php', - 'QueryPage' => 'QueryPage.php', - 'PageQueryPage' => 'QueryPage.php', - 'RawPage' => 'RawPage.php', - 'RecentChange' => 'RecentChange.php', - 'Revision' => 'Revision.php', - 'Sanitizer' => 'Sanitizer.php', - 'SearchEngine' => 'SearchEngine.php', - 'SearchResultSet' => 'SearchEngine.php', - 'SearchResult' => 'SearchEngine.php', - 'SearchEngineDummy' => 'SearchEngine.php', - 'SearchMySQL' => 'SearchMySQL.php', - 'MySQLSearchResultSet' => 'SearchMySQL.php', - 'SearchMySQL4' => 'SearchMySQL4.php', - 'SearchTsearch2' => 'SearchTsearch2.php', - 'SearchUpdate' => 'SearchUpdate.php', - 'SearchUpdateMyISAM' => 'SearchUpdate.php', - 'SiteConfiguration' => 'SiteConfiguration.php', - 'SiteStatsUpdate' => 'SiteStatsUpdate.php', - 'Skin' => 'Skin.php', - 'MediaWiki_I18N' => 'SkinTemplate.php', - 'SkinTemplate' => 'SkinTemplate.php', - 'QuickTemplate' => 'SkinTemplate.php', - 'SpecialAllpages' => 'SpecialAllpages.php', - 'AncientPagesPage' => 'SpecialAncientpages.php', - 'IPBlockForm' => 'SpecialBlockip.php', - 'BookSourceList' => 'SpecialBooksources.php', - 'BrokenRedirectsPage' => 'SpecialBrokenRedirects.php', - 'CategoriesPage' => 'SpecialCategories.php', - 'EmailConfirmation' => 'SpecialConfirmemail.php', - 'contribs_finder' => 'SpecialContributions.php', - 'DeadendPagesPage' => 'SpecialDeadendpages.php', - 'DisambiguationsPage' => 'SpecialDisambiguations.php', - 'DoubleRedirectsPage' => 'SpecialDoubleRedirects.php', - 'EmailUserForm' => 'SpecialEmailuser.php', - 'GroupsForm' => 'SpecialGroups.php', - 'WikiRevision' => 'SpecialImport.php', - 'WikiImporter' => 'SpecialImport.php', - 'ImportStringSource' => 'SpecialImport.php', - 'ImportStreamSource' => 'SpecialImport.php', - 'IPUnblockForm' => 'SpecialIpblocklist.php', - 'ListredirectsPage' => 'SpecialListredirects.php', - 'ListUsersPage' => 'SpecialListusers.php', - 'DBLockForm' => 'SpecialLockdb.php', - 'LogReader' => 'SpecialLog.php', - 'LogViewer' => 'SpecialLog.php', - 'LonelyPagesPage' => 'SpecialLonelypages.php', - 'LongPagesPage' => 'SpecialLongpages.php', - 'MIMEsearchPage' => 'SpecialMIMEsearch.php', - 'MostcategoriesPage' => 'SpecialMostcategories.php', - 'MostimagesPage' => 'SpecialMostimages.php', - 'MostlinkedPage' => 'SpecialMostlinked.php', - 'MostlinkedCategoriesPage' => 'SpecialMostlinkedcategories.php', - 'MostrevisionsPage' => 'SpecialMostrevisions.php', - 'MovePageForm' => 'SpecialMovepage.php', - 'NewPagesPage' => 'SpecialNewpages.php', - 'SpecialPage' => 'SpecialPage.php', - 'UnlistedSpecialPage' => 'SpecialPage.php', - 'IncludableSpecialPage' => 'SpecialPage.php', - 'PopularPagesPage' => 'SpecialPopularpages.php', - 'PreferencesForm' => 'SpecialPreferences.php', - 'SpecialPrefixindex' => 'SpecialPrefixindex.php', - 'RevisionDeleteForm' => 'SpecialRevisiondelete.php', - 'RevisionDeleter' => 'SpecialRevisiondelete.php', - 'SpecialSearch' => 'SpecialSearch.php', - 'ShortPagesPage' => 'SpecialShortpages.php', - 'UncategorizedCategoriesPage' => 'SpecialUncategorizedcategories.php', - 'UncategorizedPagesPage' => 'SpecialUncategorizedpages.php', - 'PageArchive' => 'SpecialUndelete.php', - 'UndeleteForm' => 'SpecialUndelete.php', - 'DBUnlockForm' => 'SpecialUnlockdb.php', - 'UnusedCategoriesPage' => 'SpecialUnusedcategories.php', - 'UnusedimagesPage' => 'SpecialUnusedimages.php', - 'UnusedtemplatesPage' => 'SpecialUnusedtemplates.php', - 'UnwatchedpagesPage' => 'SpecialUnwatchedpages.php', - 'UploadForm' => 'SpecialUpload.php', - 'UploadFormMogile' => 'SpecialUploadMogile.php', - 'LoginForm' => 'SpecialUserlogin.php', - 'UserrightsForm' => 'SpecialUserrights.php', - 'SpecialVersion' => 'SpecialVersion.php', - 'WantedCategoriesPage' => 'SpecialWantedcategories.php', - 'WantedPagesPage' => 'SpecialWantedpages.php', - 'WhatLinksHerePage' => 'SpecialWhatlinkshere.php', - 'SquidUpdate' => 'SquidUpdate.php', - 'Title' => 'Title.php', - 'User' => 'User.php', - 'MailAddress' => 'UserMailer.php', - 'EmailNotification' => 'UserMailer.php', - 'WatchedItem' => 'WatchedItem.php', - 'WebRequest' => 'WebRequest.php', - 'FauxRequest' => 'WebRequest.php', - 'MediaWiki' => 'Wiki.php', - 'WikiError' => 'WikiError.php', - 'WikiErrorMsg' => 'WikiError.php', - 'WikiXmlError' => 'WikiError.php', - 'ZhClient' => 'ZhClient.php', - 'memcached' => 'memcached-client.php', - 'UtfNormal' => 'normal/UtfNormal.php' - ); - if (array_key_exists($class_name, $classes)) { - require($classes[$class_name]); - } else { - return false; - } -} - -?> \ No newline at end of file diff --git a/includes/Block.php b/includes/Block.php index c2f8ea3d83..42969b606c 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -169,7 +169,7 @@ class Block { $fname = 'Block::loadRange'; - $iaddr = ProxyTools::IP2Hex( $address ); + $iaddr = wfIP2Hex( $address ); if ( $iaddr === false ) { # Invalid address return false; @@ -207,7 +207,7 @@ class Block * Determine if a given integer IPv4 address is in a given CIDR network */ function isAddressInRange( $addr, $range ) { - list( $network, $bits ) = ProxyTools::parseCIDR( $range ); + list( $network, $bits ) = wfParseCIDR( $range ); if ( $network !== false && $addr >> ( 32 - $bits ) == $network >> ( 32 - $bits ) ) { return true; } else { @@ -241,7 +241,7 @@ class Block $this->mRangeStart = ''; $this->mRangeEnd = ''; if ( $this->mUser == 0 ) { - list( $network, $bits ) = ProxyTools::parseCIDR( $this->mAddress ); + list( $network, $bits ) = wfParseCIDR( $this->mAddress ); if ( $network !== false ) { $this->mRangeStart = sprintf( '%08X', $network ); $this->mRangeEnd = sprintf( '%08X', $network + (1 << (32 - $bits)) - 1 ); @@ -431,7 +431,7 @@ class Block $parts = explode( '/', $range ); if ( count( $parts ) == 2 ) { $shift = 32 - $parts[1]; - $ipint = ProxyTools::IP2Unsigned( $parts[0] ); + $ipint = wfIP2Unsigned( $parts[0] ); $ipint = $ipint >> $shift << $shift; $newip = long2ip( $ipint ); $range = "$newip/{$parts[1]}"; diff --git a/includes/CacheManager.php b/includes/CacheManager.php index b9e307f44f..0d116f72ad 100644 --- a/includes/CacheManager.php +++ b/includes/CacheManager.php @@ -5,6 +5,11 @@ * @subpackage Cache */ +/** + * We need the title class + */ +require_once( 'Title.php' ); + /** * Handles talking to the file cache, putting stuff in and taking it back out. * Mostly called from Article.php, also from DatabaseFunctions.php for the diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 6d85e3761f..d574ddade2 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -10,6 +10,9 @@ if( !defined( 'MEDIAWIKI' ) ) die( -1 ); global $wgCategoryMagicGallery; +if( $wgCategoryMagicGallery ) + /** */ + require_once('ImageGallery.php'); /** * @package MediaWiki diff --git a/includes/ChangesList.php b/includes/ChangesList.php index a34b496683..59c410fe98 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -7,6 +7,7 @@ * - recent changes */ +require_once("RecentChange.php"); /** * @todo document * @package MediaWiki diff --git a/includes/Credits.php b/includes/Credits.php index 672168736d..ff33de74ce 100644 --- a/includes/Credits.php +++ b/includes/Credits.php @@ -24,165 +24,164 @@ /** * This is largely cadged from PageHistory::history */ -class Credits { - function showCreditsPage($article) { - global $wgOut; +function showCreditsPage($article) { + global $wgOut; - $fname = 'Credits::showCreditsPage'; + $fname = 'showCreditsPage'; - wfProfileIn( $fname ); + wfProfileIn( $fname ); - $wgOut->setPageTitle( $article->mTitle->getPrefixedText() ); - $wgOut->setSubtitle( wfMsg( 'creditspage' ) ); - $wgOut->setArticleFlag( false ); - $wgOut->setArticleRelated( true ); - $wgOut->setRobotpolicy( 'noindex,nofollow' ); - - if( $article->mTitle->getArticleID() == 0 ) { - $s = wfMsg( 'nocredits' ); - } else { - $s = Credits::getCredits($article, -1); - } + $wgOut->setPageTitle( $article->mTitle->getPrefixedText() ); + $wgOut->setSubtitle( wfMsg( 'creditspage' ) ); + $wgOut->setArticleFlag( false ); + $wgOut->setArticleRelated( true ); + $wgOut->setRobotpolicy( 'noindex,nofollow' ); + + if( $article->mTitle->getArticleID() == 0 ) { + $s = wfMsg( 'nocredits' ); + } else { + $s = getCredits($article, -1); + } - $wgOut->addHTML( $s ); + $wgOut->addHTML( $s ); - wfProfileOut( $fname ); - } + wfProfileOut( $fname ); +} - function getCredits($article, $cnt, $showIfMax=true) { - $fname = 'Credits::getCredits'; - wfProfileIn( $fname ); - $s = ''; +function getCredits($article, $cnt, $showIfMax=true) { + $fname = 'getCredits'; + wfProfileIn( $fname ); + $s = ''; - if (isset($cnt) && $cnt != 0) { - $s = Credits::getAuthorCredits($article); - if ($cnt > 1 || $cnt < 0) { - $s .= ' ' . Credits::getContributorCredits($article, $cnt - 1, $showIfMax); - } + if (isset($cnt) && $cnt != 0) { + $s = getAuthorCredits($article); + if ($cnt > 1 || $cnt < 0) { + $s .= ' ' . getContributorCredits($article, $cnt - 1, $showIfMax); } - - wfProfileOut( $fname ); - return $s; } - /** - * - */ - function getAuthorCredits($article) { - global $wgLang, $wgAllowRealName; + wfProfileOut( $fname ); + return $s; +} - $last_author = $article->getUser(); +/** + * + */ +function getAuthorCredits($article) { + global $wgLang, $wgAllowRealName; - if ($last_author == 0) { - $author_credit = wfMsg('anonymous'); - } else { - if($wgAllowRealName) { $real_name = User::whoIsReal($last_author); } - $user_name = User::whoIs($last_author); + $last_author = $article->getUser(); - if (!empty($real_name)) { - $author_credit = Credits::creditLink($user_name, $real_name); - } else { - $author_credit = wfMsg('siteuser', Credits::creditLink($user_name)); - } - } + if ($last_author == 0) { + $author_credit = wfMsg('anonymous'); + } else { + if($wgAllowRealName) { $real_name = User::whoIsReal($last_author); } + $user_name = User::whoIs($last_author); - $timestamp = $article->getTimestamp(); - if ($timestamp) { - $d = $wgLang->timeanddate($article->getTimestamp(), true); + if (!empty($real_name)) { + $author_credit = creditLink($user_name, $real_name); } else { - $d = ''; + $author_credit = wfMsg('siteuser', creditLink($user_name)); } - return wfMsg('lastmodifiedby', $d, $author_credit); } - /** - * - */ - function getContributorCredits($article, $cnt, $showIfMax) { + $timestamp = $article->getTimestamp(); + if ($timestamp) { + $d = $wgLang->timeanddate($article->getTimestamp(), true); + } else { + $d = ''; + } + return wfMsg('lastmodifiedby', $d, $author_credit); +} - global $wgLang, $wgAllowRealName; +/** + * + */ +function getContributorCredits($article, $cnt, $showIfMax) { - $contributors = $article->getContributors(); + global $wgLang, $wgAllowRealName; - $others_link = ''; + $contributors = $article->getContributors(); - # Hmm... too many to fit! + $others_link = ''; - if ($cnt > 0 && count($contributors) > $cnt) { - $others_link = Credits::creditOthersLink($article); - if (!$showIfMax) { - return wfMsg('othercontribs', $others_link); - } else { - $contributors = array_slice($contributors, 0, $cnt); - } + # Hmm... too many to fit! + + if ($cnt > 0 && count($contributors) > $cnt) { + $others_link = creditOthersLink($article); + if (!$showIfMax) { + return wfMsg('othercontribs', $others_link); + } else { + $contributors = array_slice($contributors, 0, $cnt); } + } - $real_names = array(); - $user_names = array(); + $real_names = array(); + $user_names = array(); - $anon = ''; + $anon = ''; - # Sift for real versus user names + # Sift for real versus user names - foreach ($contributors as $user_parts) { - if ($user_parts[0] != 0) { - if ($wgAllowRealName && !empty($user_parts[2])) { - $real_names[] = Credits::creditLink($user_parts[1], $user_parts[2]); - } else { - $user_names[] = Credits::creditLink($user_parts[1]); - } + foreach ($contributors as $user_parts) { + if ($user_parts[0] != 0) { + if ($wgAllowRealName && !empty($user_parts[2])) { + $real_names[] = creditLink($user_parts[1], $user_parts[2]); } else { - $anon = wfMsg('anonymous'); + $user_names[] = creditLink($user_parts[1]); } + } else { + $anon = wfMsg('anonymous'); } + } - # Two strings: real names, and user names + # Two strings: real names, and user names - $real = $wgLang->listToText($real_names); - $user = $wgLang->listToText($user_names); + $real = $wgLang->listToText($real_names); + $user = $wgLang->listToText($user_names); - # "ThisSite user(s) A, B and C" + # "ThisSite user(s) A, B and C" - if (!empty($user)) { - $user = wfMsg('siteusers', $user); - } + if (!empty($user)) { + $user = wfMsg('siteusers', $user); + } - # This is the big list, all mooshed together. We sift for blank strings + # This is the big list, all mooshed together. We sift for blank strings - $fulllist = array(); + $fulllist = array(); - foreach (array($real, $user, $anon, $others_link) as $s) { - if (!empty($s)) { - array_push($fulllist, $s); - } + foreach (array($real, $user, $anon, $others_link) as $s) { + if (!empty($s)) { + array_push($fulllist, $s); } + } - # Make the list into text... + # Make the list into text... - $creds = $wgLang->listToText($fulllist); + $creds = $wgLang->listToText($fulllist); - # "Based on work by ..." + # "Based on work by ..." - return (empty($creds)) ? '' : wfMsg('othercontribs', $creds); - } + return (empty($creds)) ? '' : wfMsg('othercontribs', $creds); +} - /** - * - */ - function creditLink($user_name, $link_text = '') { - global $wgUser, $wgContLang; - $skin = $wgUser->getSkin(); - return $skin->makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name, - htmlspecialchars( (empty($link_text)) ? $user_name : $link_text )); - } +/** + * + */ +function creditLink($user_name, $link_text = '') { + global $wgUser, $wgContLang; + $skin = $wgUser->getSkin(); + return $skin->makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name, + htmlspecialchars( (empty($link_text)) ? $user_name : $link_text )); +} - /** - * - */ - function creditOthersLink($article) { - global $wgUser; - $skin = $wgUser->getSkin(); - return $skin->makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits'); - } +/** + * + */ +function creditOthersLink($article) { + global $wgUser; + $skin = $wgUser->getSkin(); + return $skin->makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits'); } + ?> diff --git a/includes/Database.php b/includes/Database.php index 904e2bd3b1..2bdf610baa 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -5,6 +5,11 @@ * @package MediaWiki */ +/** + * Depends on the CacheManager + */ +require_once( 'CacheManager.php' ); + /** See Database::makeList() */ define( 'LIST_COMMA', 0 ); define( 'LIST_AND', 1 ); diff --git a/includes/DatabaseOracle.php b/includes/DatabaseOracle.php index 396b1c14e6..226bb4d6bd 100644 --- a/includes/DatabaseOracle.php +++ b/includes/DatabaseOracle.php @@ -6,6 +6,11 @@ * @package MediaWiki */ +/** + * Depends on database + */ +require_once( 'Database.php' ); + class OracleBlob extends DBObject { function isLOB() { return true; diff --git a/includes/DatabasePostgreSQL.php b/includes/DatabasePostgreSQL.php index 442ec35e79..130a247a85 100644 --- a/includes/DatabasePostgreSQL.php +++ b/includes/DatabasePostgreSQL.php @@ -13,6 +13,11 @@ * @package MediaWiki */ +/** + * Depends on database + */ +require_once( 'Database.php' ); + /** * * @package MediaWiki diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index 900d5031b2..58fdc76627 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -5,6 +5,9 @@ * @subpackage DifferenceEngine */ +/** */ +require_once( 'Revision.php' ); + define( 'MAX_DIFF_LINE', 10000 ); define( 'MAX_DIFF_XREF_LENGTH', 10000 ); diff --git a/includes/EditPage.php b/includes/EditPage.php index 28b4084aba..341427b63a 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -725,7 +725,7 @@ class EditPage { $this->summary = ''; if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI ) $this->textbox1 = wfMsgWeirdKey ( $this->mArticle->mTitle->getText() ) ; - ProxyTools::proxyCheck(); + wfProxyCheck(); } /** @@ -1118,6 +1118,7 @@ END $wgOut->addHTML( "\n" ); if ( $this->isConflict ) { + require_once( "DifferenceEngine.php" ); $wgOut->addWikiText( '==' . wfMsg( "yourdiff" ) . '==' ); $de = new DifferenceEngine( $this->mTitle ); @@ -1617,6 +1618,7 @@ END * @return string HTML */ function getDiff() { + require_once( 'DifferenceEngine.php' ); $oldtext = $this->mArticle->fetchContent(); $newtext = $this->mArticle->replaceSection( $this->section, $this->textbox1, $this->summary, $this->edittime ); diff --git a/includes/Export.php b/includes/Export.php index 244bbd3b84..d0253eb7ae 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -22,6 +22,9 @@ * @subpackage SpecialPage */ +/** */ +require_once( 'Revision.php' ); + define( 'MW_EXPORT_FULL', 0 ); define( 'MW_EXPORT_CURRENT', 1 ); diff --git a/includes/ExternalStoreDB.php b/includes/ExternalStoreDB.php index 70713d0107..f610df8053 100644 --- a/includes/ExternalStoreDB.php +++ b/includes/ExternalStoreDB.php @@ -6,6 +6,8 @@ * DB accessable external objects * */ +require_once( 'LoadBalancer.php' ); + /** @package MediaWiki */ diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index ee48231420..f8ef126ace 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -27,6 +27,8 @@ $wgTotalEdits = -1; require_once( 'DatabaseFunctions.php' ); +require_once( 'UpdateClasses.php' ); +require_once( 'LogPage.php' ); require_once( 'normal/UtfNormalUtil.php' ); require_once( 'XmlFunctions.php' ); @@ -1506,6 +1508,11 @@ function &wfGetMimeMagic() { return $wgMimeMagic; } + if (!class_exists("MimeMagic")) { + #include on demand + require_once("MimeMagic.php"); + } + $wgMimeMagic= new MimeMagic(); return $wgMimeMagic; @@ -1854,27 +1861,4 @@ class ReplacerCallback { } } -/***** DEPRECATED INTERFACES *******/ -function wfGetForwardedFor() { return ProxyTools::getForwardedFor(); } -function wfGetIP() { return ProxyTools::getIP(); } -function wfIP2Unsigned($ip) { return ProxyTools::IP2Unsigned($ip); } -function wfIP2Hex($ip) { return ProxyTools::IP2Hex($ip); } -function wfIsIPPublic($ip) { return ProxyTools::isIPPublic($ip); } -function wfProxyCheck() { return ProxyTools::proxyCheck(); } -function wfParseCIDR($range) { return ProxyTools::parseCIDR($range); } -function wfIsLocallyBlockedProxy($ip) { return ProxyTools::isLocallyBlockedProxy($ip); } - -function wfGetCache($type) { return ObjectCacheManager::getCache($type); } -function wfGetMainCache() { return ObjectCacheManager::getMainCache(); } -function wfGetMessageCacheStorage() { return ObjectCacheManager::getMessageCache(); } -function wfGetParserCacheStorage() { return ObjectCacheManager::getParserCache(); } - -function renderMath($tex) { return MathRenderer::renderMath($tex); } - -function showCreditsPage($article) { return Credits::showCreditsPage($article); } -function getCredits($article, $cnt, $showIfMax=true) { return Credits::getCredits($article,$cnt,$showIfMax); } - -function wfGetHTTP( $url, $timeout = 'default' ) { return HttpFunctions::getHTTP($url,$timeout); } -function wfIsLocalURL( $url ) { return HttpFunctions::isLocalURL($url); } - ?> diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 8679660183..4dee4da5d1 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -167,6 +167,17 @@ class ConcatenatedGzipHistoryBlob extends HistoryBlob } } + +/** + * One-step cache variable to hold base blobs; operations that + * pull multiple revisions may often pull multiple times from + * the same blob. By keeping the last-used one open, we avoid + * redundant unserialization and decompression overhead. + */ +global $wgBlobCache; +$wgBlobCache = array(); + + /** * @package MediaWiki */ @@ -204,15 +215,6 @@ class HistoryBlobStub { function getText() { $fname = 'HistoryBlob::getText'; global $wgBlobCache; - /** - * One-step cache variable to hold base blobs; operations that - * pull multiple revisions may often pull multiple times from - * the same blob. By keeping the last-used one open, we avoid - * redundant unserialization and decompression overhead. - */ - if (!is_array($wgBlobCache)) { - $wgBlobCache = array(); - } if( isset( $wgBlobCache[$this->mOldId] ) ) { $obj = $wgBlobCache[$this->mOldId]; } else { @@ -229,6 +231,7 @@ class HistoryBlobStub { wfProfileOut( $fname ); return false; } + require_once('ExternalStore.php'); $row->old_text=ExternalStore::fetchFromUrl($url); } diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index f748640412..fd2e87eebd 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -3,89 +3,88 @@ * Various HTTP related functions */ -class HttpFunctions { - /** - * Get the contents of a file by HTTP - * - * if $timeout is 'default', $wgHTTPTimeout is used - */ - function getHTTP( $url, $timeout = 'default' ) { - global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle; +/** + * Get the contents of a file by HTTP + * + * if $timeout is 'default', $wgHTTPTimeout is used + */ +function wfGetHTTP( $url, $timeout = 'default' ) { + global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle; - # Use curl if available - if ( function_exists( 'curl_init' ) ) { - $c = curl_init( $url ); - if ( HttpFunctions::isLocalURL( $url ) ) { - curl_setopt( $c, CURLOPT_PROXY, 'localhost:80' ); - } else if ($wgHTTPProxy) { - curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy); - } + # Use curl if available + if ( function_exists( 'curl_init' ) ) { + $c = curl_init( $url ); + if ( wfIsLocalURL( $url ) ) { + curl_setopt( $c, CURLOPT_PROXY, 'localhost:80' ); + } else if ($wgHTTPProxy) { + curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy); + } - if ( $timeout == 'default' ) { - $timeout = $wgHTTPTimeout; - } - curl_setopt( $c, CURLOPT_TIMEOUT, $timeout ); - curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" ); + if ( $timeout == 'default' ) { + $timeout = $wgHTTPTimeout; + } + curl_setopt( $c, CURLOPT_TIMEOUT, $timeout ); + curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" ); - # Set the referer to $wgTitle, even in command-line mode - # This is useful for interwiki transclusion, where the foreign - # server wants to know what the referring page is. - # $_SERVER['REQUEST_URI'] gives a less reliable indication of the - # referring page. - if ( is_object( $wgTitle ) ) { - curl_setopt( $c, CURLOPT_REFERER, $wgTitle->getFullURL() ); - } + # Set the referer to $wgTitle, even in command-line mode + # This is useful for interwiki transclusion, where the foreign + # server wants to know what the referring page is. + # $_SERVER['REQUEST_URI'] gives a less reliable indication of the + # referring page. + if ( is_object( $wgTitle ) ) { + curl_setopt( $c, CURLOPT_REFERER, $wgTitle->getFullURL() ); + } - ob_start(); - curl_exec( $c ); - $text = ob_get_contents(); - ob_end_clean(); + ob_start(); + curl_exec( $c ); + $text = ob_get_contents(); + ob_end_clean(); - # Don't return the text of error messages, return false on error - if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) { - $text = false; - } - curl_close( $c ); - } else { - # Otherwise use file_get_contents, or its compatibility function from GlobalFunctions.php - # This may take 3 minutes to time out, and doesn't have local fetch capabilities - $url_fopen = ini_set( 'allow_url_fopen', 1 ); - $text = file_get_contents( $url ); - ini_set( 'allow_url_fopen', $url_fopen ); + # Don't return the text of error messages, return false on error + if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) { + $text = false; } - return $text; + curl_close( $c ); + } else { + # Otherwise use file_get_contents, or its compatibility function from GlobalFunctions.php + # This may take 3 minutes to time out, and doesn't have local fetch capabilities + $url_fopen = ini_set( 'allow_url_fopen', 1 ); + $text = file_get_contents( $url ); + ini_set( 'allow_url_fopen', $url_fopen ); } + return $text; +} - /** - * Check if the URL can be served by localhost - */ - function isLocalURL( $url ) { - global $wgCommandLineMode, $wgConf; - if ( $wgCommandLineMode ) { - return false; - } +/** + * Check if the URL can be served by localhost + */ +function wfIsLocalURL( $url ) { + global $wgCommandLineMode, $wgConf; + if ( $wgCommandLineMode ) { + return false; + } - // Extract host part - $matches = array(); - if ( preg_match( '!^http://([\w.-]+)[/:].*$!', $url, $matches ) ) { - $host = $matches[1]; - // Split up dotwise - $domainParts = explode( '.', $host ); - // Check if this domain or any superdomain is listed in $wgConf as a local virtual host - $domainParts = array_reverse( $domainParts ); - for ( $i = 0; $i < count( $domainParts ); $i++ ) { - $domainPart = $domainParts[$i]; - if ( $i == 0 ) { - $domain = $domainPart; - } else { - $domain = $domainPart . '.' . $domain; - } - if ( $wgConf->isLocalVHost( $domain ) ) { - return true; - } + // Extract host part + $matches = array(); + if ( preg_match( '!^http://([\w.-]+)[/:].*$!', $url, $matches ) ) { + $host = $matches[1]; + // Split up dotwise + $domainParts = explode( '.', $host ); + // Check if this domain or any superdomain is listed in $wgConf as a local virtual host + $domainParts = array_reverse( $domainParts ); + for ( $i = 0; $i < count( $domainParts ); $i++ ) { + $domainPart = $domainParts[$i]; + if ( $i == 0 ) { + $domain = $domainPart; + } else { + $domain = $domainPart . '.' . $domain; + } + if ( $wgConf->isLocalVHost( $domain ) ) { + return true; } } - return false; } + return false; } + ?> diff --git a/includes/Image.php b/includes/Image.php index 8e6cf43273..b21964224d 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -12,6 +12,9 @@ * extension=extensions/php_exif.dll */ +if ($wgShowEXIF) + require_once('Exif.php'); + /** * Bump this number when serialized cache records may be incompatible. */ diff --git a/includes/ImagePage.php b/includes/ImagePage.php index e9ed19153e..9b91c8785e 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -9,6 +9,8 @@ if( !defined( 'MEDIAWIKI' ) ) die( -1 ); +require_once( 'Image.php' ); + /** * Special handling for image description pages * @package MediaWiki @@ -307,8 +309,9 @@ END $wgOut->addHTML($sharedtext); if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) { + require_once("HttpFunctions.php"); $ur = ini_set('allow_url_fopen', true); - $text = HttpFunctions::getHTTP($url . '?action=render'); + $text = wfGetHTTP($url . '?action=render'); ini_set('allow_url_fopen', $ur); if ($text) $this->mExtraDescription = $text; @@ -671,6 +674,7 @@ END } function blockedIPpage() { + require_once( 'EditPage.php' ); $edit = new EditPage( $this ); return $edit->blockedIPpage(); } diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index 54728582dd..bd09502e79 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -119,6 +119,7 @@ class LinksUpdate { if ( $this->mRecursive ) { $tlto = $this->mTitle->getTemplateLinksTo(); if ( count( $tlto ) ) { + require_once( 'JobQueue.php' ); Job::queueLinksJobs( $tlto ); } } @@ -154,6 +155,7 @@ class LinksUpdate { if ( $this->mRecursive ) { $tlto = $this->mTitle->getTemplateLinksTo(); if ( count( $tlto ) ) { + require_once( 'JobQueue.php' ); Job::queueLinksJobs( $tlto ); } } diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index 3e6cd7ec15..6cf743b9e3 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -7,6 +7,7 @@ /** * Depends on the database object */ +require_once( 'Database.php' ); # Valid database indexes # Operation-based indexes @@ -439,14 +440,12 @@ class LoadBalancer { } extract( $server ); - # Get class for this database type - if ($type != 'mysql' ) { - $class = 'Database' . ucfirst( $type ); - } else { - $class = 'Database'; + $class = 'Database' . ucfirst( $type ); + if ( !class_exists( $class ) ) { + require_once( "$class.php" ); } - + # Create object $db = new $class( $host, $user, $password, $dbname, 1, $flags ); $db->setLBInfo( $server ); diff --git a/includes/LogPage.php b/includes/LogPage.php index 753c1dc47b..c3b236762a 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -83,6 +83,7 @@ class LogPage { $rcComment .= ': ' . $this->comment; } + require_once( 'RecentChange.php' ); RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '', $this->type, $this->action, $this->target, $this->comment, $this->params ); } diff --git a/includes/Math.php b/includes/Math.php index d47a4299fe..e40abdf1af 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -248,13 +248,15 @@ class MathRenderer { wfDebug( "TeX: getHashPath, hash is: $this->hash, path is: $path\n" ); return $path; } - - static function renderMath ( $tex ) { - global $wgUser; - $math = new MathRenderer( $tex ); - $math->setOutputMode( $wgUser->getOption('math')); - return $math->render(); - } + + +} + +function renderMath( $tex ) { + global $wgUser; + $math = new MathRenderer( $tex ); + $math->setOutputMode( $wgUser->getOption('math')); + return $math->render(); } ?> diff --git a/includes/MessageCache.php b/includes/MessageCache.php index 083e220570..8e54af91c4 100644 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -5,6 +5,9 @@ * @subpackage Cache */ +/** */ +require_once( 'Revision.php' ); + /** * */ diff --git a/includes/ObjectCache.php b/includes/ObjectCache.php index d851f3ab2a..fe7417d2c1 100644 --- a/includes/ObjectCache.php +++ b/includes/ObjectCache.php @@ -33,91 +33,93 @@ class FakeMemCachedClient { global $wgCaches; $wgCaches = array(); -class ObjectCacheManager { - /* @static */ - function getCache( $inputType ) { - global $wgCaches, $wgMemCachedServers, $wgMemCachedDebug, $wgMemCachedPersistent; - $cache = false; +/** @todo document */ +function &wfGetCache( $inputType ) { + global $wgCaches, $wgMemCachedServers, $wgMemCachedDebug, $wgMemCachedPersistent; + $cache = false; - if ( $inputType == CACHE_ANYTHING ) { - reset( $wgCaches ); - $type = key( $wgCaches ); - if ( $type === false || $type === CACHE_NONE ) { - $type = CACHE_DB; - } - } else { - $type = $inputType; + if ( $inputType == CACHE_ANYTHING ) { + reset( $wgCaches ); + $type = key( $wgCaches ); + if ( $type === false || $type === CACHE_NONE ) { + $type = CACHE_DB; } + } else { + $type = $inputType; + } - if ( $type == CACHE_MEMCACHED ) { - if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ){ - $wgCaches[CACHE_DB] = new MemCachedClientforWiki( - array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) ); - $cache =& $wgCaches[CACHE_DB]; - $cache->set_servers( $wgMemCachedServers ); - $cache->set_debug( $wgMemCachedDebug ); - } - } elseif ( $type == CACHE_ACCEL ) { - if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) { - if ( function_exists( 'eaccelerator_get' ) ) { - $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff; - } elseif ( function_exists( 'apc_fetch') ) { - $wgCaches[CACHE_ACCEL] = new APCBagOStuff; - } elseif ( function_exists( 'mmcache_get' ) ) { - $wgCaches[CACHE_ACCEL] = new TurckBagOStuff; - } else { - $wgCaches[CACHE_ACCEL] = false; + if ( $type == CACHE_MEMCACHED ) { + if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ){ + require_once( 'memcached-client.php' ); + + if (!class_exists("MemcachedClientforWiki")) { + class MemCachedClientforWiki extends memcached { + function _debugprint( $text ) { + wfDebug( "memcached: $text\n" ); + } } } - if ( $wgCaches[CACHE_ACCEL] !== false ) { - $cache =& $wgCaches[CACHE_ACCEL]; - } - } - if ( $type == CACHE_DB || ( $inputType == CACHE_ANYTHING && $cache === false ) ) { - if ( !array_key_exists( CACHE_DB, $wgCaches ) ) { - $wgCaches[CACHE_DB] = new MediaWikiBagOStuff('objectcache'); - } + $wgCaches[CACHE_DB] = new MemCachedClientforWiki( + array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) ); $cache =& $wgCaches[CACHE_DB]; + $cache->set_servers( $wgMemCachedServers ); + $cache->set_debug( $wgMemCachedDebug ); } - - if ( $cache === false ) { - if ( !array_key_exists( CACHE_NONE, $wgCaches ) ) { - $wgCaches[CACHE_NONE] = new FakeMemCachedClient; + } elseif ( $type == CACHE_ACCEL ) { + if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) { + if ( function_exists( 'eaccelerator_get' ) ) { + require_once( 'BagOStuff.php' ); + $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff; + } elseif ( function_exists( 'apc_fetch') ) { + require_once( 'BagOStuff.php' ); + $wgCaches[CACHE_ACCEL] = new APCBagOStuff; + } elseif ( function_exists( 'mmcache_get' ) ) { + require_once( 'BagOStuff.php' ); + $wgCaches[CACHE_ACCEL] = new TurckBagOStuff; + } else { + $wgCaches[CACHE_ACCEL] = false; } - $cache =& $wgCaches[CACHE_NONE]; } - - return $cache; - } - - /** @static */ - function &getMainCache() { - global $wgMainCacheType; - $ret =& ObjectCacheManager::getCache( $wgMainCacheType ); - return $ret; + if ( $wgCaches[CACHE_ACCEL] !== false ) { + $cache =& $wgCaches[CACHE_ACCEL]; + } } - /** @static */ - function &getMessageCache() { - global $wgMessageCacheType; - $ret =& ObjectCacheManager::getCache( $wgMessageCacheType ); - return $ret; + if ( $type == CACHE_DB || ( $inputType == CACHE_ANYTHING && $cache === false ) ) { + if ( !array_key_exists( CACHE_DB, $wgCaches ) ) { + require_once( 'BagOStuff.php' ); + $wgCaches[CACHE_DB] = new MediaWikiBagOStuff('objectcache'); + } + $cache =& $wgCaches[CACHE_DB]; } - - /** @static */ - function &getParserCache() { - global $wgParserCacheType; - $ret =& ObjectCacheManager::getCache( $wgParserCacheType ); - return $ret; + + if ( $cache === false ) { + if ( !array_key_exists( CACHE_NONE, $wgCaches ) ) { + $wgCaches[CACHE_NONE] = new FakeMemCachedClient; + } + $cache =& $wgCaches[CACHE_NONE]; } - + + return $cache; } -class MemCachedClientforWiki extends memcached { - function _debugprint( $text ) { - wfDebug( "memcached: $text\n" ); - } +function &wfGetMainCache() { + global $wgMainCacheType; + $ret =& wfGetCache( $wgMainCacheType ); + return $ret; +} + +function &wfGetMessageCacheStorage() { + global $wgMessageCacheType; + $ret =& wfGetCache( $wgMessageCacheType ); + return $ret; +} + +function &wfGetParserCacheStorage() { + global $wgParserCacheType; + $ret =& wfGetCache( $wgParserCacheType ); + return $ret; } ?> diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 451acb2438..c155d380c4 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -5,6 +5,9 @@ if ( ! defined( 'MEDIAWIKI' ) ) * @package MediaWiki */ +if ( $wgUseTeX ) + require_once 'Math.php'; + /** * @todo document * @package MediaWiki @@ -647,7 +650,7 @@ class OutputPage { $id = $wgUser->blockedBy(); $reason = $wgUser->blockedFor(); - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); if ( is_numeric( $id ) ) { $name = User::whoIs( $id ); diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 2c69a3e4e6..2e70e4d902 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -576,6 +576,9 @@ class PageHistory { * @param string $type */ function feed( $type ) { + require_once 'Feed.php'; + require_once 'SpecialRecentchanges.php'; + global $wgFeedClasses; if( !isset( $wgFeedClasses[$type] ) ) { global $wgOut; diff --git a/includes/Parser.php b/includes/Parser.php index 8e6fd965e1..2bfa48273c 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -6,6 +6,11 @@ * @subpackage Parser */ +/** */ +require_once( 'Sanitizer.php' ); +require_once( 'HttpFunctions.php' ); +require_once( 'ImageGallery.php' ); + /** * Update this version number when the ParserOutput format * changes in an incompatible way, so the parser cache @@ -447,7 +452,7 @@ class Parser $output = wfEscapeHTMLTagsOnly( $content ); break; case 'math': - $output = MathRenderer::renderMath( $content ); + $output = renderMath( $content ); break; case 'pre': // Backwards-compatibility hack @@ -2967,7 +2972,7 @@ class Parser } } - $text = HttpFunctions::getHTTP($url); + $text = wfGetHTTP($url); if (!$text) return wfMsg('scarytranscludefailed', $url); diff --git a/includes/ParserXML.php b/includes/ParserXML.php index b5dae85fb3..e7b64f6e92 100644 --- a/includes/ParserXML.php +++ b/includes/ParserXML.php @@ -5,6 +5,9 @@ * @subpackage Experimental */ +/** */ +require_once ('Parser.php'); + /** * This should one day become the XML->(X)HTML parser * Based on work by Jan Hidders and Magnus Manske diff --git a/includes/Profiling.php b/includes/Profiling.php index 531e336d37..edecc4f32f 100644 --- a/includes/Profiling.php +++ b/includes/Profiling.php @@ -278,6 +278,7 @@ class Profiler { } } $prof .= "\nTotal: $total\n\n"; + return $prof; } @@ -321,6 +322,7 @@ class Profiler { } else { $pfhost = ''; } + $sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, "."pf_time=pf_time + {$timeSum} ". "WHERE pf_name='{$encname}' AND pf_server='{$pfhost}'"; $dbw->query($sql); diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index 350078d2fe..bed79c1003 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -4,228 +4,230 @@ * @package MediaWiki */ -class ProxyTools { - function getForwardedFor() { - if( function_exists( 'apache_request_headers' ) ) { - // More reliable than $_SERVER due to case and -/_ folding - $set = apache_request_headers(); - $index = 'X-Forwarded-For'; - } else { - // Subject to spoofing with headers like X_Forwarded_For - $set = $_SERVER; - $index = 'HTTP_X_FORWARDED_FOR'; - } - if( isset( $set[$index] ) ) { - return $set[$index]; - } else { - return null; - } +function wfGetForwardedFor() { + if( function_exists( 'apache_request_headers' ) ) { + // More reliable than $_SERVER due to case and -/_ folding + $set = apache_request_headers(); + $index = 'X-Forwarded-For'; + } else { + // Subject to spoofing with headers like X_Forwarded_For + $set = $_SERVER; + $index = 'HTTP_X_FORWARDED_FOR'; } + if( isset( $set[$index] ) ) { + return $set[$index]; + } else { + return null; + } +} - /** Work out the IP address based on various globals */ - function getIP() { - global $wgSquidServers, $wgSquidServersNoPurge, $wgIP; +/** Work out the IP address based on various globals */ +function wfGetIP() { + global $wgSquidServers, $wgSquidServersNoPurge, $wgIP; - # Return cached result - if ( !empty( $wgIP ) ) { - return $wgIP; - } + # Return cached result + if ( !empty( $wgIP ) ) { + return $wgIP; + } - /* collect the originating ips */ - # Client connecting to this webserver - if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { - $ipchain = array( $_SERVER['REMOTE_ADDR'] ); - } else { - # Running on CLI? - $ipchain = array( '127.0.0.1' ); - } - $ip = $ipchain[0]; - - # Get list of trusted proxies - # Flipped for quicker access - $trustedProxies = array_flip( array_merge( $wgSquidServers, $wgSquidServersNoPurge ) ); - if ( count( $trustedProxies ) ) { - # Append XFF on to $ipchain - $forwardedFor = ProxyTools::getForwardedFor(); - if ( isset( $forwardedFor ) ) { - $xff = array_map( 'trim', explode( ',', $forwardedFor ) ); - $xff = array_reverse( $xff ); - $ipchain = array_merge( $ipchain, $xff ); - } - # Step through XFF list and find the last address in the list which is a trusted server - # Set $ip to the IP address given by that trusted server, unless the address is not sensible (e.g. private) - foreach ( $ipchain as $i => $curIP ) { - if ( array_key_exists( $curIP, $trustedProxies ) ) { - if ( isset( $ipchain[$i + 1] ) && ProxyTools::isIPPublic( $ipchain[$i + 1] ) ) { - $ip = $ipchain[$i + 1]; - } - } else { - break; + /* collect the originating ips */ + # Client connecting to this webserver + if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { + $ipchain = array( $_SERVER['REMOTE_ADDR'] ); + } else { + # Running on CLI? + $ipchain = array( '127.0.0.1' ); + } + $ip = $ipchain[0]; + + # Get list of trusted proxies + # Flipped for quicker access + $trustedProxies = array_flip( array_merge( $wgSquidServers, $wgSquidServersNoPurge ) ); + if ( count( $trustedProxies ) ) { + # Append XFF on to $ipchain + $forwardedFor = wfGetForwardedFor(); + if ( isset( $forwardedFor ) ) { + $xff = array_map( 'trim', explode( ',', $forwardedFor ) ); + $xff = array_reverse( $xff ); + $ipchain = array_merge( $ipchain, $xff ); + } + # Step through XFF list and find the last address in the list which is a trusted server + # Set $ip to the IP address given by that trusted server, unless the address is not sensible (e.g. private) + foreach ( $ipchain as $i => $curIP ) { + if ( array_key_exists( $curIP, $trustedProxies ) ) { + if ( isset( $ipchain[$i + 1] ) && wfIsIPPublic( $ipchain[$i + 1] ) ) { + $ip = $ipchain[$i + 1]; } + } else { + break; } } + } - wfDebug( "IP: $ip\n" ); - $wgIP = $ip; - return $ip; - } - - /** - * Given an IP address in dotted-quad notation, returns an unsigned integer. - * Like ip2long() except that it actually works and has a consistent error return value. - */ - function IP2Unsigned( $ip ) { - $n = ip2long( $ip ); - if ( $n == -1 || $n === false ) { # Return value on error depends on PHP version - $n = false; - } elseif ( $n < 0 ) { - $n += pow( 2, 32 ); - } - return $n; + wfDebug( "IP: $ip\n" ); + $wgIP = $ip; + return $ip; +} + +/** + * Given an IP address in dotted-quad notation, returns an unsigned integer. + * Like ip2long() except that it actually works and has a consistent error return value. + */ +function wfIP2Unsigned( $ip ) { + $n = ip2long( $ip ); + if ( $n == -1 || $n === false ) { # Return value on error depends on PHP version + $n = false; + } elseif ( $n < 0 ) { + $n += pow( 2, 32 ); } + return $n; +} - /** - * Return a zero-padded hexadecimal representation of an IP address - */ - function IP2Hex( $ip ) { - $n = ProxyTools::IP2Unsigned( $ip ); - if ( $n !== false ) { - $n = sprintf( '%08X', $n ); - } - return $n; +/** + * Return a zero-padded hexadecimal representation of an IP address + */ +function wfIP2Hex( $ip ) { + $n = wfIP2Unsigned( $ip ); + if ( $n !== false ) { + $n = sprintf( '%08X', $n ); } + return $n; +} - /** - * Determine if an IP address really is an IP address, and if it is public, - * i.e. not RFC 1918 or similar - */ - function isIPPublic( $ip ) { - $n = ProxyTools::IP2Unsigned( $ip ); - if ( !$n ) { - return false; - } +/** + * Determine if an IP address really is an IP address, and if it is public, + * i.e. not RFC 1918 or similar + */ +function wfIsIPPublic( $ip ) { + $n = wfIP2Unsigned( $ip ); + if ( !$n ) { + return false; + } - // ip2long accepts incomplete addresses, as well as some addresses - // followed by garbage characters. Check that it's really valid. - if( $ip != long2ip( $n ) ) { - return false; - } + // ip2long accepts incomplete addresses, as well as some addresses + // followed by garbage characters. Check that it's really valid. + if( $ip != long2ip( $n ) ) { + return false; + } - static $privateRanges = false; - if ( !$privateRanges ) { - $privateRanges = array( - array( '10.0.0.0', '10.255.255.255' ), # RFC 1918 (private) - array( '172.16.0.0', '172.31.255.255' ), # " - array( '192.168.0.0', '192.168.255.255' ), # " - array( '0.0.0.0', '0.255.255.255' ), # this network - array( '127.0.0.0', '127.255.255.255' ), # loopback - ); - } + static $privateRanges = false; + if ( !$privateRanges ) { + $privateRanges = array( + array( '10.0.0.0', '10.255.255.255' ), # RFC 1918 (private) + array( '172.16.0.0', '172.31.255.255' ), # " + array( '192.168.0.0', '192.168.255.255' ), # " + array( '0.0.0.0', '0.255.255.255' ), # this network + array( '127.0.0.0', '127.255.255.255' ), # loopback + ); + } - foreach ( $privateRanges as $r ) { - $start = ProxyTools::IP2Unsigned( $r[0] ); - $end = ProxyTools::IP2Unsigned( $r[1] ); - if ( $n >= $start && $n <= $end ) { - return false; - } + foreach ( $privateRanges as $r ) { + $start = wfIP2Unsigned( $r[0] ); + $end = wfIP2Unsigned( $r[1] ); + if ( $n >= $start && $n <= $end ) { + return false; } - return true; } + return true; +} - /** - * Forks processes to scan the originating IP for an open proxy server - * MemCached can be used to skip IPs that have already been scanned - */ - function proxyCheck() { - global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath; - global $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry; - global $wgProxyKey; +/** + * Forks processes to scan the originating IP for an open proxy server + * MemCached can be used to skip IPs that have already been scanned + */ +function wfProxyCheck() { + global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath; + global $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry; + global $wgProxyKey; - if ( !$wgBlockOpenProxies ) { - return; - } + if ( !$wgBlockOpenProxies ) { + return; + } - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); - # Get MemCached key - $skip = false; - if ( $wgUseMemCached ) { - $mcKey = "$wgDBname:proxy:ip:$ip"; - $mcValue = $wgMemc->get( $mcKey ); - if ( $mcValue ) { - $skip = true; - } + # Get MemCached key + $skip = false; + if ( $wgUseMemCached ) { + $mcKey = "$wgDBname:proxy:ip:$ip"; + $mcValue = $wgMemc->get( $mcKey ); + if ( $mcValue ) { + $skip = true; } + } - # Fork the processes - if ( !$skip ) { - $title = Title::makeTitle( NS_SPECIAL, 'Blockme' ); - $iphash = md5( $ip . $wgProxyKey ); - $url = $title->getFullURL( 'ip='.$iphash ); - - foreach ( $wgProxyPorts as $port ) { - $params = implode( ' ', array( - escapeshellarg( $wgProxyScriptPath ), - escapeshellarg( $ip ), - escapeshellarg( $port ), - escapeshellarg( $url ) - )); - exec( "php $params &>/dev/null &" ); - } - # Set MemCached key - if ( $wgUseMemCached ) { - $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry ); - } + # Fork the processes + if ( !$skip ) { + $title = Title::makeTitle( NS_SPECIAL, 'Blockme' ); + $iphash = md5( $ip . $wgProxyKey ); + $url = $title->getFullURL( 'ip='.$iphash ); + + foreach ( $wgProxyPorts as $port ) { + $params = implode( ' ', array( + escapeshellarg( $wgProxyScriptPath ), + escapeshellarg( $ip ), + escapeshellarg( $port ), + escapeshellarg( $url ) + )); + exec( "php $params &>/dev/null &" ); + } + # Set MemCached key + if ( $wgUseMemCached ) { + $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry ); } } +} - /** - * Convert a network specification in CIDR notation to an integer network and a number of bits - */ - function parseCIDR( $range ) { - $parts = explode( '/', $range, 2 ); - if ( count( $parts ) != 2 ) { - return array( false, false ); - } - $network = ProxyTools::IP2Unsigned( $parts[0] ); - if ( $network !== false && is_numeric( $parts[1] ) && $parts[1] >= 0 && $parts[1] <= 32 ) { - $bits = $parts[1]; - } else { - $network = false; - $bits = false; - } - return array( $network, $bits ); +/** + * Convert a network specification in CIDR notation to an integer network and a number of bits + */ +function wfParseCIDR( $range ) { + $parts = explode( '/', $range, 2 ); + if ( count( $parts ) != 2 ) { + return array( false, false ); + } + $network = wfIP2Unsigned( $parts[0] ); + if ( $network !== false && is_numeric( $parts[1] ) && $parts[1] >= 0 && $parts[1] <= 32 ) { + $bits = $parts[1]; + } else { + $network = false; + $bits = false; } + return array( $network, $bits ); +} - /** - * Check if an IP address is in the local proxy list - */ - function isLocallyBlockedProxy( $ip ) { - global $wgProxyList; - $fname = 'ProxyTools::isLocallyBlockedProxy'; +/** + * Check if an IP address is in the local proxy list + */ +function wfIsLocallyBlockedProxy( $ip ) { + global $wgProxyList; + $fname = 'wfIsLocallyBlockedProxy'; - if ( !$wgProxyList ) { - return false; - } - wfProfileIn( $fname ); + if ( !$wgProxyList ) { + return false; + } + wfProfileIn( $fname ); - if ( !is_array( $wgProxyList ) ) { - # Load from the specified file - $wgProxyList = array_map( 'trim', file( $wgProxyList ) ); - } + if ( !is_array( $wgProxyList ) ) { + # Load from the specified file + $wgProxyList = array_map( 'trim', file( $wgProxyList ) ); + } - if ( !is_array( $wgProxyList ) ) { - $ret = false; - } elseif ( array_search( $ip, $wgProxyList ) !== false ) { - $ret = true; - } elseif ( array_key_exists( $ip, $wgProxyList ) ) { - # Old-style flipped proxy list - $ret = true; - } else { - $ret = false; - } - wfProfileOut( $fname ); - return $ret; + if ( !is_array( $wgProxyList ) ) { + $ret = false; + } elseif ( array_search( $ip, $wgProxyList ) !== false ) { + $ret = true; + } elseif ( array_key_exists( $ip, $wgProxyList ) ) { + # Old-style flipped proxy list + $ret = true; + } else { + $ret = false; } + wfProfileOut( $fname ); + return $ret; } + + + + ?> diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 515e458a3b..7848c53cbc 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -4,6 +4,11 @@ * @package MediaWiki */ +/** + * + */ +require_once 'Feed.php'; + /** * List of query page classes and their associated special pages, for periodic update purposes */ diff --git a/includes/RawPage.php b/includes/RawPage.php index 252ab3206f..5685385cc6 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -10,6 +10,9 @@ * @package MediaWiki */ +/** */ +require_once( 'Revision.php' ); + /** * @todo document * @package MediaWiki diff --git a/includes/RecentChange.php b/includes/RecentChange.php index d550513d0b..cae6d76978 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -205,7 +205,7 @@ class RecentChange } if ( !$ip ) { - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); if ( !$ip ) { $ip = ''; } @@ -249,7 +249,7 @@ class RecentChange $ip='', $size = 0, $newId = 0 ) { if ( !$ip ) { - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); if ( !$ip ) { $ip = ''; } @@ -294,7 +294,7 @@ class RecentChange /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false ) { if ( !$ip ) { - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); if ( !$ip ) { $ip = ''; } @@ -344,7 +344,7 @@ class RecentChange $type, $action, $target, $logComment, $params ) { if ( !$ip ) { - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); if ( !$ip ) { $ip = ''; } diff --git a/includes/Revision.php b/includes/Revision.php index 9aaa93c15c..e9083a7742 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -4,6 +4,10 @@ * @todo document */ +/** */ +require_once( 'Database.php' ); +require_once( 'Article.php' ); + /** @+ */ define( 'MW_REV_DELETED_TEXT', 1 ); define( 'MW_REV_DELETED_COMMENT', 2 ); @@ -510,6 +514,7 @@ class Revision { wfProfileOut( $fname ); return false; } + require_once('ExternalStore.php'); $text=ExternalStore::fetchFromURL($url); } @@ -599,6 +604,7 @@ class Revision { } else { $store = $wgDefaultExternalStore; } + require_once('ExternalStore.php'); // Store and get the URL $data = ExternalStore::insert( $store, $data ); if ( !$data ) { diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index 0175210782..2ef70451ec 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -195,8 +195,10 @@ class SearchEngine { $class = $wgSearchType; } elseif( $wgDBtype == 'mysql' ) { $class = 'SearchMySQL4'; + require_once( 'SearchMySQL4.php' ); } else if ( $wgDBtype == 'PostgreSQL' ) { $class = 'SearchTsearch2'; + require_once( 'SearchTsearch2.php' ); } else { $class = 'SearchEngineDummy'; } diff --git a/includes/SearchMySQL.php b/includes/SearchMySQL.php index 80bddbddeb..6683cbe04c 100644 --- a/includes/SearchMySQL.php +++ b/includes/SearchMySQL.php @@ -24,6 +24,9 @@ * @subpackage Search */ +/** */ +require_once( 'SearchEngine.php' ); + /** @package MediaWiki */ class SearchMySQL extends SearchEngine { /** diff --git a/includes/SearchMySQL4.php b/includes/SearchMySQL4.php index dcc1f685c1..59f1bbee6c 100644 --- a/includes/SearchMySQL4.php +++ b/includes/SearchMySQL4.php @@ -23,6 +23,8 @@ * @subpackage Search */ +require_once( 'SearchMySQL.php' ); + /** * @package MediaWiki * @subpackage Search diff --git a/includes/SearchTsearch2.php b/includes/SearchTsearch2.php index 767979cd40..3c0f13281a 100644 --- a/includes/SearchTsearch2.php +++ b/includes/SearchTsearch2.php @@ -23,6 +23,9 @@ * @subpackage Search */ +/** */ +require_once( 'SearchEngine.php' ); + /** * @todo document * @package MediaWiki diff --git a/includes/SearchUpdate.php b/includes/SearchUpdate.php index 37981a67d7..1f222b3952 100644 --- a/includes/SearchUpdate.php +++ b/includes/SearchUpdate.php @@ -37,6 +37,7 @@ class SearchUpdate { $fname = 'SearchUpdate::doUpdate'; wfProfileIn( $fname ); + require_once( 'SearchEngine.php' ); $search = SearchEngine::create(); $lc = $search->legalSearchChars() . '&#;'; diff --git a/includes/Setup.php b/includes/Setup.php index dedf6a44a2..4c4328dd40 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -22,14 +22,13 @@ if ( !isset( $wgVersion ) ) { die( -1 ); } -require('AutoLoader.php'); - if( !isset( $wgProfiling ) ) $wgProfiling = false; if ( function_exists( 'wfProfileIn' ) ) { /* nada, everything should be done already */ } elseif ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) { + require_once( 'Profiling.php' ); $wgProfiling = true; if ($wgProfilerType == "") { $wgProfiler = new Profiler(); @@ -49,8 +48,29 @@ wfProfileIn( $fname.'-includes' ); require_once( 'GlobalFunctions.php' ); require_once( 'Hooks.php' ); require_once( 'Namespace.php' ); +require_once( 'User.php' ); +require_once( 'Skin.php' ); +require_once( 'OutputPage.php' ); +require_once( 'LinkCache.php' ); +require_once( 'LinkBatch.php' ); +require_once( 'Title.php' ); +require_once( 'Article.php' ); require_once( 'MagicWord.php' ); - +require_once( 'Block.php' ); +require_once( 'MessageCache.php' ); +require_once( 'Parser.php' ); +require_once( 'ParserCache.php' ); +require_once( 'WebRequest.php' ); +require_once( 'LoadBalancer.php' ); +require_once( 'HistoryBlob.php' ); +require_once( 'ProxyTools.php' ); +require_once( 'ObjectCache.php' ); +require_once( 'WikiError.php' ); +require_once( 'SpecialPage.php' ); + +if ( $wgUseDynamicDates ) { + require_once( 'DateFormatter.php' ); +} wfProfileOut( $fname.'-includes' ); wfProfileIn( $fname.'-misc1' ); @@ -88,9 +108,9 @@ $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist; wfProfileOut( $fname.'-misc1' ); wfProfileIn( $fname.'-memcached' ); -$wgMemc =& ObjectCacheManager::getMainCache(); -$messageMemc =& ObjectCacheManager::getMessageCache(); -$parserMemc =& ObjectCacheManager::getParserCache(); +$wgMemc =& wfGetMainCache(); +$messageMemc =& wfGetMessageCacheStorage(); +$parserMemc =& wfGetParserCacheStorage(); wfDebug( 'Main cache: ' . get_class( $wgMemc ) . "\nMessage cache: " . get_class( $messageMemc ) . @@ -188,6 +208,7 @@ foreach ( $wgSkinExtensionFunctions as $func ) { } if( !is_object( $wgAuth ) ) { + require_once( 'AuthPlugin.php' ); $wgAuth = new AuthPlugin(); } @@ -275,6 +296,7 @@ $wgMagicWords = array(); $wgMwRedir =& MagicWord::get( MAG_REDIRECT ); if ( $wgUseXMLparser ) { + require_once( 'ParserXML.php' ); $wgParser = new ParserXML(); } else { $wgParser = new Parser(); diff --git a/includes/Skin.php b/includes/Skin.php index dc0a998416..5bf36abec4 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -8,11 +8,28 @@ if ( ! defined( 'MEDIAWIKI' ) ) * @subpackage Skins */ +# See skin.txt +require_once( 'Linker.php' ); +require_once( 'Image.php' ); + # Get a list of available skins # Build using the regular expression '^(.*).php$' # Array keys are all lower case, array value keep the case used by filename # +$skinDir = dir( $wgStyleDirectory ); + +# while code from www.php.net +while (false !== ($file = $skinDir->read())) { + // Skip non-PHP files, hidden files, and '.dep' includes + if(preg_match('/^([^.]*)\.php$/',$file, $matches)) { + $aSkin = $matches[1]; + $wgValidSkinNames[strtolower($aSkin)] = $aSkin; + } +} +$skinDir->close(); +unset($matches); + /** * The main skin class that provide methods and properties for all other skins. * This base class is also the "Standard" skin. @@ -38,35 +55,9 @@ class Skin extends Linker { */ function getSkinNames() { global $wgValidSkinNames; - if (!is_array($wgValidSkinNames)) { - Skin::initializeSkinNames(); - } return $wgValidSkinNames; } - /** - * Initializes set of available skins. - * @return array of strings - skin names - * @static - */ - - function initializeSkinNames() { - global $wgStyleDirectory, $wgValidSkinNames; - $skinDir = dir( $wgStyleDirectory ); - - # while code from www.php.net - while (false !== ($file = $skinDir->read())) { - // Skip non-PHP files, hidden files, and '.dep' includes - if(preg_match('/^([^.]*)\.php$/',$file, $matches)) { - $aSkin = $matches[1]; - $wgValidSkinNames[strtolower($aSkin)] = $aSkin; - } - } - $skinDir->close(); - unset($matches); - - } - /** * Normalize a skin preference value to a form that can be loaded. * If a skin can't be found, it will fall back to the configured @@ -754,7 +745,7 @@ END; $s = ''; if ( $wgUser->isAnon() ) { if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) { - $n = ProxyTools::getIP(); + $n = wfGetIP(); $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), $wgLang->getNsText( NS_TALK ) ); @@ -905,7 +896,8 @@ END; } if (isset($wgMaxCredits) && $wgMaxCredits != 0) { - $s .= ' ' . Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); + require_once('Credits.php'); + $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); } else { $s .= $this->lastModified(); } @@ -1023,6 +1015,7 @@ END; */ function specialPagesList() { global $wgUser, $wgContLang, $wgServer, $wgRedirectScript, $wgAvailableRights; + require_once('SpecialPage.php'); $a = array(); $pages = SpecialPage::getPages(); diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index c86b67ec2f..f054153ada 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -343,7 +343,8 @@ class SkinTemplate extends Skin { $this->credits = false; if (isset($wgMaxCredits) && $wgMaxCredits != 0) { - $this->credits = Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); + require_once("Credits.php"); + $this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); } else { $tpl->set('lastmod', $this->lastModified()); } diff --git a/includes/SpecialBlockme.php b/includes/SpecialBlockme.php index c3524e4b50..b452b14738 100644 --- a/includes/SpecialBlockme.php +++ b/includes/SpecialBlockme.php @@ -12,7 +12,7 @@ function wfSpecialBlockme() { global $wgBlockOpenProxies, $wgOut, $wgProxyKey; - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $ip . $wgProxyKey ) ) { $wgOut->addWikiText( wfMsg( "disabled" ) ); diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index bd2829dc1a..7c5465459f 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -15,10 +15,6 @@ * @subpackage SpecialPage */ -/** - * @todo put all global specialpages stuff into class - */ -global $wgSpecialPages, $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication; /** * @access private diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 69a68132c8..bccbc6e4b5 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -444,7 +444,7 @@ class PreferencesForm { * @access private */ function mainPrefsForm( $status , $message = '' ) { - global $wgUser, $wgOut, $wgLang, $wgContLang; + global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames; global $wgAllowRealName, $wgImageLimits, $wgThumbLimits; global $wgDisableLangConversion; global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits; @@ -723,7 +723,7 @@ class PreferencesForm { $previewtext = wfMsg('skinpreview'); # Only show members of $wgValidSkinNames rather than # $skinNames (skins is all skin names from Language.php) - foreach (Skin::getSkinNames() as $skinkey => $skinname ) { + foreach ($wgValidSkinNames as $skinkey => $skinname ) { if ( in_array( $skinkey, $wgSkipSkins ) ) { continue; } diff --git a/includes/SpecialRecentchanges.php b/includes/SpecialRecentchanges.php index 48470a7232..74c6ebf4e6 100644 --- a/includes/SpecialRecentchanges.php +++ b/includes/SpecialRecentchanges.php @@ -5,6 +5,13 @@ * @subpackage SpecialPage */ +/** + * + */ +require_once( 'Feed.php' ); +require_once( 'ChangesList.php' ); +require_once( 'Revision.php' ); + /** * Constructor */ diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index e61f485394..84b732f7b9 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -9,6 +9,8 @@ * */ require_once 'Image.php'; +require_once 'MacBinary.php'; +require_once 'Licenses.php'; /** * Entry point */ diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 2d3838812e..03a4185385 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -210,7 +210,7 @@ class LoginForm { return false; } - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) && $wgUser->inSorbsBlacklist( $ip ) ) { @@ -416,7 +416,7 @@ class LoginForm { $u->saveSettings(); - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); if ( '' == $ip ) { $ip = '(Unknown)'; } $m = wfMsg( 'passwordremindertext', $ip, $u->getName(), $np, $wgServer . $wgScript ); diff --git a/includes/SpecialVersion.php b/includes/SpecialVersion.php index c941e2badd..5f7e857f3f 100644 --- a/includes/SpecialVersion.php +++ b/includes/SpecialVersion.php @@ -190,7 +190,7 @@ class SpecialVersion { * @return string */ function IPInfo() { - $ip = str_replace( '--', ' - ', htmlspecialchars( ProxyTools::getIP() ) ); + $ip = str_replace( '--', ' - ', htmlspecialchars( wfGetIP() ) ); return "\n" . "visited from $ip"; } diff --git a/includes/Title.php b/includes/Title.php index 730c11b2e4..1e87fd8a8d 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -5,7 +5,8 @@ * @package MediaWiki */ -global $wgTitleInterwikiCache, $wgTitleCache; +/** */ +require_once( 'normal/UtfNormal.php' ); $wgTitleInterwikiCache = array(); $wgTitleCache = array(); @@ -333,6 +334,7 @@ class Title { */ /* static */ function indexTitle( $ns, $title ) { global $wgContLang; + require_once( 'SearchEngine.php' ); $lc = SearchEngine::legalSearchChars() . '&#;'; $t = $wgContLang->stripForSearch( $title ); @@ -1160,7 +1162,8 @@ class Title { * Check that the corresponding skin exists */ function isValidCssJsSubpage() { - return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), Skin::getSkinNames() ) ); + global $wgValidSkinNames; + return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), $wgValidSkinNames ) ); } /** * Trim down a .css or .js subpage title to get the corresponding skin name diff --git a/includes/UpdateClasses.php b/includes/UpdateClasses.php index d3c2b032ba..e6da731db3 100644 --- a/includes/UpdateClasses.php +++ b/includes/UpdateClasses.php @@ -5,4 +5,13 @@ * @package MediaWiki */ +/** + * + */ + +require_once( 'SiteStatsUpdate.php' ); +require_once( 'LinksUpdate.php' ); +require_once( 'SearchUpdate.php' ); +require_once( 'SquidUpdate.php' ); + ?> \ No newline at end of file diff --git a/includes/User.php b/includes/User.php index a9ab11830b..15d469a5a8 100644 --- a/includes/User.php +++ b/includes/User.php @@ -5,6 +5,11 @@ * @package MediaWiki */ +/** + * + */ +require_once( 'WatchedItem.php' ); + # Number of characters in user_token field define( 'USER_TOKEN_LENGTH', 32 ); @@ -428,7 +433,7 @@ class User { wfDebug( "$fname: checking...\n" ); $this->mBlockedby = 0; - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); # User/IP blocking $block = new Block(); @@ -449,7 +454,7 @@ class User { if ( !$this->isAllowed('proxyunbannable') && !in_array( $ip, $wgProxyWhitelist ) ) { # Local list - if ( ProxyTools::isLocallyBlockedProxy( $ip ) ) { + if ( wfIsLocallyBlockedProxy( $ip ) ) { $this->mBlockedby = wfMsg( 'proxyblocker' ); $this->mBlockreason = wfMsg( 'proxyblockreason' ); } @@ -533,7 +538,7 @@ class User { $limits = $wgRateLimits[$action]; $keys = array(); $id = $this->getId(); - $ip = ProxyTools::getIP(); + $ip = wfGetIP(); if( isset( $limits['anon'] ) && $id == 0 ) { $keys["$wgDBname:limiter:$action:anon"] = $limits['anon']; @@ -785,7 +790,7 @@ class User { function getName() { $this->loadFromDatabase(); if ( $this->mName === false ) { - $this->mName = ProxyTools::getIP(); + $this->mName = wfGetIP(); } return $this->mName; } @@ -1521,7 +1526,7 @@ class User { } # Check if this IP address is already blocked - $ipblock = Block::newFromDB( ProxyTools::getIP() ); + $ipblock = Block::newFromDB( wfGetIP() ); if ( $ipblock->isValid() ) { # If the user is already blocked. Then check if the autoblock would # excede the user block. If it would excede, then do nothing, else @@ -1536,8 +1541,8 @@ class User { } # Make a new block object with the desired properties - wfDebug( "Autoblocking {$this->mName}@" . ProxyTools::getIP() . "\n" ); - $ipblock->mAddress = ProxyTools::getIP(); + wfDebug( "Autoblocking {$this->mName}@" . wfGetIP() . "\n" ); + $ipblock->mAddress = wfGetIP(); $ipblock->mUser = 0; $ipblock->mBy = $userblock->mBy; $ipblock->mReason = wfMsg( 'autoblocker', $this->getName(), $userblock->mReason ); @@ -1757,7 +1762,7 @@ class User { $url = $this->confirmationTokenUrl( $expiration ); return $this->sendMail( wfMsg( 'confirmemail_subject' ), wfMsg( 'confirmemail_body', - ProxyTools::getIP(), + wfGetIP(), $this->getName(), $url, $wgContLang->timeanddate( $expiration, false ) ) ); diff --git a/includes/WebRequest.php b/includes/WebRequest.php index efae012faa..736e215fdd 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -117,6 +117,7 @@ class WebRequest { $data = $wgContLang->checkTitleEncoding( $data ); } } + require_once( 'normal/UtfNormal.php' ); $data = $this->normalizeUnicode( $data ); return $data; } else { diff --git a/includes/Wiki.php b/includes/Wiki.php index a134552e3f..187dc06f92 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -176,8 +176,10 @@ class MediaWiki { switch( $title->getNamespace() ) { case NS_IMAGE: + require_once( 'includes/ImagePage.php' ); return new ImagePage( $title ); case NS_CATEGORY: + require_once( 'includes/CategoryPage.php' ); return new CategoryPage( $title ); default: return new Article( $title ); @@ -282,6 +284,8 @@ class MediaWiki { $n = intval( $wgJobRunRate ); } + require_once( 'JobQueue.php' ); + while ( $n-- && false != ($job = Job::pop())) { $output = $job->toString() . "\n"; if ( !$job->run() ) { @@ -355,7 +359,8 @@ class MediaWiki { } break; case 'credits': - Credits::showCreditsPage( $article ); + require_once( 'includes/Credits.php' ); + showCreditsPage( $article ); break; case 'submit': if( !$this->getVal( 'CommandLineMode' ) && !$request->checkSessionCookie() ) { @@ -370,9 +375,11 @@ class MediaWiki { $oldid = $request->getVal( 'oldid' ); if( !$this->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal || $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) { + require_once( 'includes/EditPage.php' ); $editor = new EditPage( $article ); $editor->submit(); } elseif( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) { + require_once( 'includes/ExternalEdit.php' ); $mode = $request->getVal( 'mode' ); $extedit = new ExternalEdit( $article, $mode ); $extedit->edit(); @@ -382,10 +389,12 @@ class MediaWiki { if( $_SERVER['REQUEST_URI'] == $title->getInternalURL( 'action=history' ) ) { $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) ); } + require_once( 'includes/PageHistory.php' ); $history = new PageHistory( $article ); $history->history(); break; case 'raw': + require_once( 'includes/RawPage.php' ); $raw = new RawPage( $article ); $raw->view(); break;