Merge "Revert "Forward port of https://www.mediawiki.org/wiki/Special:Code/MediaWiki...
[lhc/web/wiklou.git] / includes / LinksUpdate.php
index 0002096..716e7d8 100644 (file)
@@ -26,6 +26,7 @@ class LinksUpdate {
         */
        var $mId,            //!< Page ID of the article linked from
                $mTitle,         //!< Title object of the article linked from
+               $mParserOutput,  //!< Parser output
                $mLinks,         //!< Map of title strings to IDs for the links in the document
                $mImages,        //!< DB keys of the images used, in the array key only
                $mTemplates,     //!< Map of title strings to IDs for the template references, including broken ones
@@ -56,8 +57,8 @@ class LinksUpdate {
                $this->mDb = wfGetDB( DB_MASTER );
 
                if ( !is_object( $title ) ) {
-                       throw new MWException( "The calling convention to LinksUpdate::LinksUpdate() has changed. " .
-                               "Please see Article::editUpdates() for an invocation example.\n" );
+                       throw new MWException( "The calling convention to LinksUpdate::__construct() has changed. " .
+                               "Please see WikiPage::doEditUpdates() for an invocation example.\n" );
                }
                $this->mTitle = $title;
                $this->mId = $title->getArticleID();
@@ -456,11 +457,13 @@ class LinksUpdate {
                $arr = array();
                $diffs = array_diff_key( $this->mExternals, $existing );
                foreach( $diffs as $url => $dummy ) {
-                       $arr[] = array(
-                               'el_from'   => $this->mId,
-                               'el_to'     => $url,
-                               'el_index'  => wfMakeUrlIndex( $url ),
-                       );
+                       foreach( wfMakeUrlIndexes( $url ) as $index ) {
+                               $arr[] = array(
+                                       'el_from'   => $this->mId,
+                                       'el_to'     => $url,
+                                       'el_index'  => $index,
+                               );
+                       }
                }
                return $arr;
        }
@@ -808,6 +811,15 @@ class LinksUpdate {
                return $this->mTitle;
        }
 
+       /**
+        * Returns parser output
+        * @since 1.19
+        * @return ParserOutput
+        */
+       public function getParserOutput() {
+               return $this->mParserOutput;
+       }
+
        /**
         * Return the list of images used as generated by the parser
         * @return array