Warn if stateful ParserOutput transforms are used
[lhc/web/wiklou.git] / includes / parser / LinkHolderArray.php
index b34ac1f..bc5182c 100644 (file)
@@ -264,18 +264,16 @@ class LinkHolderArray {
        /**
         * Replace <!--LINK--> link placeholders with actual links, in the buffer
         *
-        * @param string $text
+        * @param string &$text
         */
        public function replace( &$text ) {
-
                $this->replaceInternal( $text );
                $this->replaceInterwiki( $text );
-
        }
 
        /**
         * Replace internal links
-        * @param string $text
+        * @param string &$text
         */
        protected function replaceInternal( &$text ) {
                if ( !$this->internals ) {
@@ -289,7 +287,7 @@ class LinkHolderArray {
                $output = $this->parent->getOutput();
                $linkRenderer = $this->parent->getLinkRenderer();
 
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
 
                # Sort by namespace
                ksort( $this->internals );
@@ -414,12 +412,11 @@ class LinkHolderArray {
                        $replacer->cb(),
                        $text
                );
-
        }
 
        /**
         * Replace interwiki links
-        * @param string $text
+        * @param string &$text
         */
        protected function replaceInterwiki( &$text ) {
                if ( empty( $this->interwikis ) ) {
@@ -447,7 +444,7 @@ class LinkHolderArray {
 
        /**
         * Modify $this->internals and $colours according to language variant linking rules
-        * @param array $colours
+        * @param array &$colours
         */
        protected function doVariants( &$colours ) {
                global $wgContLang;
@@ -534,7 +531,7 @@ class LinkHolderArray {
 
                if ( !$linkBatch->isEmpty() ) {
                        // construct query
-                       $dbr = wfGetDB( DB_SLAVE );
+                       $dbr = wfGetDB( DB_REPLICA );
                        $fields = array_merge(
                                LinkCache::getSelectFields(),
                                [ 'page_namespace', 'page_title' ]
@@ -614,10 +611,9 @@ class LinkHolderArray {
         * @return string
         */
        public function replaceText( $text ) {
-
                $text = preg_replace_callback(
                        '/<!--(LINK|IWLINK) (.*?)-->/',
-                       [ &$this, 'replaceTextCallback' ],
+                       [ $this, 'replaceTextCallback' ],
                        $text );
 
                return $text;