Merge "Change loading order of Chinese conversion tables"
[lhc/web/wiklou.git] / includes / parser / LinkHolderArray.php
index c3925b3..5b6209e 100644 (file)
@@ -229,7 +229,6 @@ class LinkHolderArray {
         * @return string
         */
        public function makeHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
-               wfProfileIn( __METHOD__ );
                if ( !is_object( $nt ) ) {
                        # Fail gracefully
                        $retVal = "<!-- ERROR -->{$prefix}{$text}{$trail}";
@@ -259,7 +258,6 @@ class LinkHolderArray {
                        }
                        $this->size++;
                }
-               wfProfileOut( __METHOD__ );
                return $retVal;
        }
 
@@ -267,17 +265,13 @@ class LinkHolderArray {
         * Replace <!--LINK--> link placeholders with actual links, in the buffer
         *
         * @param string $text
-        * @return array Array of link CSS classes, indexed by PDBK.
         */
        public function replace( &$text ) {
-               wfProfileIn( __METHOD__ );
 
-               /** @todo FIXME: replaceInternal doesn't return a value */
-               $colours = $this->replaceInternal( $text );
+               $this->replaceInternal( $text );
                $this->replaceInterwiki( $text );
 
-               wfProfileOut( __METHOD__ );
-               return $colours;
+
        }
 
        /**
@@ -289,8 +283,7 @@ class LinkHolderArray {
                        return;
                }
 
-               wfProfileIn( __METHOD__ );
-               global $wgContLang;
+               global $wgContLang, $wgContentHandlerUseDB;
 
                $colours = array();
                $linkCache = LinkCache::singleton();
@@ -348,10 +341,16 @@ class LinkHolderArray {
                                );
                        }
 
+                       $fields = array( 'page_id', 'page_namespace', 'page_title',
+                               'page_is_redirect', 'page_len', 'page_latest' );
+
+                       if ( $wgContentHandlerUseDB ) {
+                               $fields[] = 'page_content_model';
+                       }
+
                        $res = $dbr->select(
                                'page',
-                               array( 'page_id', 'page_namespace', 'page_title',
-                                       'page_is_redirect', 'page_len', 'page_latest' ),
+                               $fields,
                                $dbr->makeList( $where, LIST_OR ),
                                __METHOD__
                        );
@@ -374,7 +373,7 @@ class LinkHolderArray {
                }
                if ( count( $linkcolour_ids ) ) {
                        //pass an array of page_ids to an extension
-                       wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
+                       Hooks::run( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
                }
                wfProfileOut( __METHOD__ . '-check' );
 
@@ -431,7 +430,6 @@ class LinkHolderArray {
                );
 
                wfProfileOut( __METHOD__ . '-replace' );
-               wfProfileOut( __METHOD__ );
        }
 
        /**
@@ -443,7 +441,6 @@ class LinkHolderArray {
                        return;
                }
 
-               wfProfileIn( __METHOD__ );
                # Make interwiki link HTML
                $output = $this->parent->getOutput();
                $replacePairs = array();
@@ -457,7 +454,6 @@ class LinkHolderArray {
                        '/<!--IWLINK (.*?)-->/',
                        $replacer->cb(),
                        $text );
-               wfProfileOut( __METHOD__ );
        }
 
        /**
@@ -465,7 +461,7 @@ class LinkHolderArray {
         * @param array $colours
         */
        protected function doVariants( &$colours ) {
-               global $wgContLang;
+               global $wgContLang, $wgContentHandlerUseDB;
                $linkBatch = new LinkBatch();
                $variantMap = array(); // maps $pdbkey_Variant => $keys (of link holders)
                $output = $this->parent->getOutput();
@@ -554,9 +550,15 @@ class LinkHolderArray {
                if ( !$linkBatch->isEmpty() ) {
                        // construct query
                        $dbr = wfGetDB( DB_SLAVE );
+                       $fields = array( 'page_id', 'page_namespace', 'page_title',
+                               'page_is_redirect', 'page_len', 'page_latest' );
+
+                       if ( $wgContentHandlerUseDB ) {
+                               $fields[] = 'page_content_model';
+                       }
+
                        $varRes = $dbr->select( 'page',
-                               array( 'page_id', 'page_namespace', 'page_title',
-                                       'page_is_redirect', 'page_len', 'page_latest' ),
+                               $fields,
                                $linkBatch->constructSet( 'page', $dbr ),
                                __METHOD__
                        );
@@ -605,7 +607,7 @@ class LinkHolderArray {
                                        }
                                }
                        }
-                       wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
+                       Hooks::run( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
 
                        // rebuild the categories in original order (if there are replacements)
                        if ( count( $varCategories ) > 0 ) {
@@ -632,14 +634,12 @@ class LinkHolderArray {
         * @return string
         */
        public function replaceText( $text ) {
-               wfProfileIn( __METHOD__ );
 
                $text = preg_replace_callback(
                        '/<!--(LINK|IWLINK) (.*?)-->/',
                        array( &$this, 'replaceTextCallback' ),
                        $text );
 
-               wfProfileOut( __METHOD__ );
                return $text;
        }