Sync up with Parsoid parserTests.
[lhc/web/wiklou.git] / includes / parser / LinkHolderArray.php
index c3925b3..6c15993 100644 (file)
@@ -267,17 +267,15 @@ 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;
+
        }
 
        /**
@@ -290,7 +288,7 @@ class LinkHolderArray {
                }
 
                wfProfileIn( __METHOD__ );
-               global $wgContLang;
+               global $wgContLang, $wgContentHandlerUseDB;
 
                $colours = array();
                $linkCache = LinkCache::singleton();
@@ -348,10 +346,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__
                        );
@@ -465,7 +469,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 +558,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__
                        );