* Some enhancements to live preview
[lhc/web/wiklou.git] / includes / AutoLoader.php
index ae9acbf..1365be9 100644 (file)
@@ -1,12 +1,17 @@
 <?php
 
 /* This defines autoloading handler for whole MediaWiki framework */
+
+ini_set('unserialize_callback_func', '__autoload' );
+
 function __autoload($className) {
        global $wgAutoloadClasses;
 
        static $localClasses = array(
                'AjaxDispatcher' => 'includes/AjaxDispatcher.php',
                'AjaxCachePolicy' => 'includes/AjaxFunctions.php',
+               'AjaxResponse' => 'includes/AjaxResponse.php',
+               'AlphabeticPager' => 'includes/Pager.php',
                'Article' => 'includes/Article.php',
                'AuthPlugin' => 'includes/AuthPlugin.php',
                'BagOStuff' => 'includes/BagOStuff.php',
@@ -16,20 +21,25 @@ function __autoload($className) {
                'TurckBagOStuff' => 'includes/BagOStuff.php',
                'APCBagOStuff' => 'includes/BagOStuff.php',
                'eAccelBagOStuff' => 'includes/BagOStuff.php',
+               'DBABagOStuff' => 'includes/BagOStuff.php',
                'Block' => 'includes/Block.php',
-               'CacheManager' => 'includes/CacheManager.php',
+               'HTMLFileCache' => 'includes/HTMLFileCache.php',
+               'DependencyWrapper' => 'includes/CacheDependency.php',
+               'FileDependency' => 'includes/CacheDependency.php',
+               'TitleDependency' => 'includes/CacheDependency.php',
+               'TitleListDependency' => 'includes/CacheDependency.php',
                'CategoryPage' => 'includes/CategoryPage.php',
+               'CategoryViewer' => 'includes/CategoryPage.php',
                'Categoryfinder' => 'includes/Categoryfinder.php',
                'RCCacheEntry' => 'includes/ChangesList.php',
                'ChangesList' => 'includes/ChangesList.php',
                'OldChangesList' => 'includes/ChangesList.php',
                'EnhancedChangesList' => 'includes/ChangesList.php',
+               'CoreParserFunctions' => 'includes/CoreParserFunctions.php',
                'DBObject' => 'includes/Database.php',
                'Database' => 'includes/Database.php',
                'DatabaseMysql' => 'includes/Database.php',
                'ResultWrapper' => 'includes/Database.php',
-               'OracleBlob' => 'includes/DatabaseOracle.php',
-               'DatabaseOracle' => 'includes/DatabaseOracle.php',
                'DatabasePostgres' => 'includes/DatabasePostgres.php',
                'DateFormatter' => 'includes/DateFormatter.php',
                'DifferenceEngine' => 'includes/DifferenceEngine.php',
@@ -75,7 +85,6 @@ function __autoload($className) {
                'FileStore' => 'includes/FileStore.php',
                'FSException' => 'includes/FileStore.php',
                'FSTransaction' => 'includes/FileStore.php',
-               'ReplacerCallback' => 'includes/GlobalFunctions.php',
                'HTMLForm' => 'includes/HTMLForm.php',
                'HistoryBlob' => 'includes/HistoryBlob.php',
                'ConcatenatedGzipHistoryBlob' => 'includes/HistoryBlob.php',
@@ -83,7 +92,9 @@ function __autoload($className) {
                'HistoryBlobCurStub' => 'includes/HistoryBlob.php',
                'HTMLCacheUpdate' => 'includes/HTMLCacheUpdate.php',
                'HTMLCacheUpdateJob' => 'includes/HTMLCacheUpdate.php',
+               'Http' => 'includes/HttpFunctions.php',
                'Image' => 'includes/Image.php',
+               'IP' => 'includes/IP.php',
                'ThumbnailImage' => 'includes/Image.php',
                'ImageGallery' => 'includes/ImageGallery.php',
                'ImagePage' => 'includes/ImagePage.php',
@@ -106,20 +117,18 @@ function __autoload($className) {
                'MimeMagic' => 'includes/MimeMagic.php',
                'Namespace' => 'includes/Namespace.php',
                'FakeMemCachedClient' => 'includes/ObjectCache.php',
-               'ObjectCacheManager' => 'includes/ObjectCache.php',
-               'MemCachedClientforWiki' => 'includes/ObjectCache.php',
                'OutputPage' => 'includes/OutputPage.php',
                'PageHistory' => 'includes/PageHistory.php',
+               'IndexPager' => 'includes/Pager.php',
+               'ReverseChronologicalPager' => 'includes/Pager.php',
+               'TablePager' => 'includes/Pager.php',
                'Parser' => 'includes/Parser.php',
-               'ParserOutput' => 'includes/Parser.php',
-               'ParserOptions' => 'includes/Parser.php',
+               'ParserOutput' => 'includes/ParserOutput.php',
+               'ParserOptions' => 'includes/ParserOptions.php',
                'ParserCache' => 'includes/ParserCache.php',
-               'element' => 'includes/ParserXML.php',
-               'xml2php' => 'includes/ParserXML.php',
-               'ParserXML' => 'includes/ParserXML.php',
                'ProfilerSimple' => 'includes/ProfilerSimple.php',
                'ProfilerSimpleUDP' => 'includes/ProfilerSimpleUDP.php',
-               'Profiler' => 'includes/Profiling.php',
+               'Profiler' => 'includes/Profiler.php',
                'ProxyTools' => 'includes/ProxyTools.php',
                'ProtectionForm' => 'includes/ProtectionForm.php',
                'QueryPage' => 'includes/QueryPage.php',
@@ -135,11 +144,12 @@ function __autoload($className) {
                'SearchMySQL' => 'includes/SearchMySQL.php',
                'MySQLSearchResultSet' => 'includes/SearchMySQL.php',
                'SearchMySQL4' => 'includes/SearchMySQL4.php',
-               'SearchTsearch2' => 'includes/SearchTsearch2.php',
+               'SearchPostgres' => 'includes/SearchPostgres.php',
                'SearchUpdate' => 'includes/SearchUpdate.php',
                'SearchUpdateMyISAM' => 'includes/SearchUpdate.php',
                'SiteConfiguration' => 'includes/SiteConfiguration.php',
-               'SiteStatsUpdate' => 'includes/SiteStatsUpdate.php',
+               'SiteStats' => 'includes/SiteStats.php',
+               'SiteStatsUpdate' => 'includes/SiteStats.php',
                'Skin' => 'includes/Skin.php',
                'MediaWiki_I18N' => 'includes/SkinTemplate.php',
                'SkinTemplate' => 'includes/SkinTemplate.php',
@@ -147,11 +157,10 @@ function __autoload($className) {
                'SpecialAllpages' => 'includes/SpecialAllpages.php',
                'AncientPagesPage' => 'includes/SpecialAncientpages.php',
                'IPBlockForm' => 'includes/SpecialBlockip.php',
-               'BookSourceList' => 'includes/SpecialBooksources.php',
+               'SpecialBookSources' => 'includes/SpecialBooksources.php',
                'BrokenRedirectsPage' => 'includes/SpecialBrokenRedirects.php',
-               'CategoriesPage' => 'includes/SpecialCategories.php',
                'EmailConfirmation' => 'includes/SpecialConfirmemail.php',
-               'ContribsFinder' => 'includes/SpecialContributions.php',
+               'ContributionsPage' => 'includes/SpecialContributions.php',
                'DeadendPagesPage' => 'includes/SpecialDeadendpages.php',
                'DisambiguationsPage' => 'includes/SpecialDisambiguations.php',
                'DoubleRedirectsPage' => 'includes/SpecialDoubleRedirects.php',
@@ -175,6 +184,7 @@ function __autoload($className) {
                'MostlinkedCategoriesPage' => 'includes/SpecialMostlinkedcategories.php',
                'MostrevisionsPage' => 'includes/SpecialMostrevisions.php',
                'MovePageForm' => 'includes/SpecialMovepage.php',
+               'NewbieContributionsPage' => 'includes/SpecialNewbieContributions.php',
                'NewPagesPage' => 'includes/SpecialNewpages.php',
                'SpecialPage' => 'includes/SpecialPage.php',
                'UnlistedSpecialPage' => 'includes/SpecialPage.php',
@@ -204,34 +214,94 @@ function __autoload($className) {
                'WantedPagesPage' => 'includes/SpecialWantedpages.php',
                'WhatLinksHerePage' => 'includes/SpecialWhatlinkshere.php',
                'SquidUpdate' => 'includes/SquidUpdate.php',
+               'ReplacementArray' => 'includes/StringUtils.php',
+               'Replacer' => 'includes/StringUtils.php',
+               'RegexlikeReplacer' => 'includes/StringUtils.php',
+               'DoubleReplacer' => 'includes/StringUtils.php',
+               'HashtableReplacer' => 'includes/StringUtils.php',
+               'StringUtils' => 'includes/StringUtils.php',
                'Title' => 'includes/Title.php',
                'User' => 'includes/User.php',
                'MailAddress' => 'includes/UserMailer.php',
                'EmailNotification' => 'includes/UserMailer.php',
                'WatchedItem' => 'includes/WatchedItem.php',
                'WebRequest' => 'includes/WebRequest.php',
+               'WebResponse' => 'includes/WebResponse.php',
                'FauxRequest' => 'includes/WebRequest.php',
                'MediaWiki' => 'includes/Wiki.php',
                'WikiError' => 'includes/WikiError.php',
                'WikiErrorMsg' => 'includes/WikiError.php',
                'WikiXmlError' => 'includes/WikiError.php',
+               'Xml' => 'includes/Xml.php',
                'ZhClient' => 'includes/ZhClient.php',
                'memcached' => 'includes/memcached-client.php',
-               'UtfNormal' => 'includes/normal/UtfNormal.php'
+               'UtfNormal' => 'includes/normal/UtfNormal.php',
+               'UsercreateTemplate' => 'includes/templates/Userlogin.php',
+               'UserloginTemplate' => 'includes/templates/Userlogin.php',
+               'Language' => 'languages/Language.php',
+               'PasswordResetForm' => 'includes/SpecialResetpass.php',
+               'PatrolLog' => 'includes/PatrolLog.php',
+
+               // API classes
+               'ApiBase' => 'includes/api/ApiBase.php',
+               'ApiFormatFeedWrapper' => 'includes/api/ApiFormatBase.php',
+               'ApiFeedWatchlist' => 'includes/api/ApiFeedWatchlist.php',
+               'ApiFormatBase' => 'includes/api/ApiFormatBase.php',
+               'Services_JSON' => 'includes/api/ApiFormatJson_json.php',
+               'ApiFormatJson' => 'includes/api/ApiFormatJson.php',
+               'ApiFormatPhp' => 'includes/api/ApiFormatPhp.php',
+               'ApiFormatWddx' => 'includes/api/ApiFormatWddx.php',
+               'ApiFormatXml' => 'includes/api/ApiFormatXml.php',
+               'Spyc' => 'includes/api/ApiFormatYaml_spyc.php',
+               'ApiFormatYaml' => 'includes/api/ApiFormatYaml.php',
+               'ApiHelp' => 'includes/api/ApiHelp.php',
+               'ApiLogin' => 'includes/api/ApiLogin.php',
+               'ApiMain' => 'includes/api/ApiMain.php',
+               'ApiOpenSearch' => 'includes/api/ApiOpenSearch.php',
+               'ApiPageSet' => 'includes/api/ApiPageSet.php',
+               'ApiQuery' => 'includes/api/ApiQuery.php',
+               'ApiQueryAllpages' => 'includes/api/ApiQueryAllpages.php',
+               'ApiQueryBase' => 'includes/api/ApiQueryBase.php',
+               'ApiQueryBacklinks' => 'includes/api/ApiQueryBacklinks.php',
+               'ApiQueryContributions' => 'includes/api/ApiQueryUserContributions.php',
+               'ApiQueryInfo' => 'includes/api/ApiQueryInfo.php',
+               'ApiQueryLogEvents' => 'includes/api/ApiQueryLogEvents.php',
+               'ApiQueryRecentChanges'=> 'includes/api/ApiQueryRecentChanges.php',
+               'ApiQueryRevisions' => 'includes/api/ApiQueryRevisions.php',
+               'ApiQuerySiteinfo' => 'includes/api/ApiQuerySiteinfo.php',
+               'ApiQueryWatchlist' => 'includes/api/ApiQueryWatchlist.php',
+               'ApiResult' => 'includes/api/ApiResult.php',
        );
+       
+       wfProfileIn( __METHOD__ );
        if ( isset( $localClasses[$className] ) ) {
                $filename = $localClasses[$className];
        } elseif ( isset( $wgAutoloadClasses[$className] ) ) {
                $filename = $wgAutoloadClasses[$className];
        } else {
-               return;
+               # Try a different capitalisation
+               # The case can sometimes be wrong when unserializing PHP 4 objects
+               $filename = false;
+               $lowerClass = strtolower( $className );
+               foreach ( $localClasses as $class2 => $file2 ) {
+                       if ( strtolower( $class2 ) == $lowerClass ) {
+                               $filename = $file2;
+                       }
+               }
+               if ( !$filename ) {
+                       # Give up
+                       wfProfileOut( __METHOD__ );
+                       return;
+               }
        }
 
        # Make an absolute path, this improves performance by avoiding some stat calls
-       if ( substr( $filename, 0, 1 ) == '/' || substr( $filename, 1, 1 ) == ':' ) {
+       if ( substr( $filename, 0, 1 ) != '/' && substr( $filename, 1, 1 ) != ':' ) {
+               global $IP;
                $filename = "$IP/$filename";
        }
        require( $filename );
+       wfProfileOut( __METHOD__ );
 }
 
 function wfLoadAllExtensions() {
@@ -243,10 +313,10 @@ function wfLoadAllExtensions() {
        # guaranteed by entering special pages via SpecialPage members such as 
        # executePath(), but here we have to take a more explicit measure.
        
-       require_once( 'SpecialPage.php' );
+       require_once( dirname(__FILE__) . '/SpecialPage.php' );
        
        foreach( $wgAutoloadClasses as $class => $file ) {
-               if ( ! class_exists( $class ) ) {
+               if( !( class_exists( $class ) || interface_exists( $class ) ) ) {
                        require( $file );
                }
        }