Merge "Use mergeMwGlobalArrayValue in AutoLoaderTest::setUp"
[lhc/web/wiklou.git] / includes / parser / CoreParserFunctions.php
index 983fc14..d9f1761 100644 (file)
@@ -44,7 +44,7 @@ class CoreParserFunctions {
                        'canonicalurle', 'formatnum', 'grammar', 'gender', 'plural',
                        'numberofpages', 'numberofusers', 'numberofactiveusers',
                        'numberofarticles', 'numberoffiles', 'numberofadmins',
-                       'numberingroup', 'numberofedits', 'numberofviews', 'language',
+                       'numberingroup', 'numberofedits', 'language',
                        'padleft', 'padright', 'anchorencode', 'defaultsort', 'filepath',
                        'pagesincategory', 'pagesize', 'protectionlevel',
                        'namespacee', 'namespacenumber', 'talkspace', 'talkspacee',
@@ -379,8 +379,7 @@ class CoreParserFunctions {
                $text = $parser->doQuotes( $text );
 
                // remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever
-               $text = preg_replace( '/' . preg_quote( $parser->uniqPrefix(), '/' ) . '.*?'
-                       . preg_quote( Parser::MARKER_SUFFIX, '/' ) . '/', '', $text );
+               $text = $parser->killMarkers( $text );
 
                // list of disallowed tags for DISPLAYTITLE
                // these will be escaped even though they are allowed in normal wiki text
@@ -489,10 +488,6 @@ class CoreParserFunctions {
        public static function numberofedits( $parser, $raw = null ) {
                return self::formatRaw( SiteStats::edits(), $raw );
        }
-       public static function numberofviews( $parser, $raw = null ) {
-               global $wgDisableCounters;
-               return !$wgDisableCounters ? self::formatRaw( SiteStats::views(), $raw ) : '';
-       }
        public static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
                return self::formatRaw( SiteStats::pagesInNs( intval( $namespace ) ), $raw );
        }
@@ -1000,11 +995,6 @@ class CoreParserFunctions {
         * @since 1.23
         */
        private static function getCachedRevisionObject( $parser, $title = null ) {
-               static $cache = null;
-               if ( !isset( $cache ) ) {
-                       $cache = new MapCacheLRU( 100 );
-               }
-
                if ( is_null( $title ) ) {
                        return null;
                }
@@ -1024,22 +1014,18 @@ class CoreParserFunctions {
                // Normalize name for cache
                $page = $title->getPrefixedDBkey();
 
-               if ( $cache->has( $page ) ) { // cache contains null values
-                       return $cache->get( $page );
+               if ( !( $parser->currentRevisionCache && $parser->currentRevisionCache->has( $page ) )
+                       && !$parser->incrementExpensiveFunctionCount() ) {
+                       return null;
                }
-               if ( $parser->incrementExpensiveFunctionCount() ) {
-                       $rev = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );
-                       $pageID = $rev ? $rev->getPage() : 0;
-                       $revID = $rev ? $rev->getId() : 0;
-                       $cache->set( $page, $rev ); // maybe null
+               $rev = $parser->fetchCurrentRevisionOfTitle( $title );
+               $pageID = $rev ? $rev->getPage() : 0;
+               $revID = $rev ? $rev->getId() : 0;
 
-                       // Register dependency in templatelinks
-                       $parser->getOutput()->addTemplate( $title, $pageID, $revID );
+               // Register dependency in templatelinks
+               $parser->getOutput()->addTemplate( $title, $pageID, $revID );
 
-                       return $rev;
-               }
-               $cache->set( $page, null );
-               return null;
+               return $rev;
        }
 
        /**