Merge "Sync up with Parsoid parserTests."
[lhc/web/wiklou.git] / includes / content / WikiTextStructure.php
index d4ba8a1..9768d36 100644 (file)
@@ -58,50 +58,6 @@ class WikiTextStructure {
                $this->parserOutput = $parserOutput;
        }
 
-       /**
-        * Get categories in the text.
-        * @return string[]
-        */
-       public function categories() {
-               $categories = [];
-               foreach ( array_keys( $this->parserOutput->getCategories() ) as $key ) {
-                       $categories[] = Category::newFromName( $key )->getTitle()->getText();
-               }
-               return $categories;
-       }
-
-       /**
-        * Get outgoing links.
-        * @return string[]
-        */
-       public function outgoingLinks() {
-               $outgoingLinks = [];
-               foreach ( $this->parserOutput->getLinks() as $linkedNamespace => $namespaceLinks ) {
-                       foreach ( array_keys( $namespaceLinks ) as $linkedDbKey ) {
-                               $outgoingLinks[] =
-                                       Title::makeTitle( $linkedNamespace, $linkedDbKey )->getPrefixedDBkey();
-                       }
-               }
-               return $outgoingLinks;
-       }
-
-       /**
-        * Get templates in the text.
-        * @return string[]
-        */
-       public function templates() {
-               $templates = [];
-               foreach ( $this->parserOutput->getTemplates() as $tNS => $templatesInNS ) {
-                       foreach ( array_keys( $templatesInNS ) as $tDbKey ) {
-                               $templateTitle = Title::makeTitleSafe( $tNS, $tDbKey );
-                               if ( $templateTitle && $templateTitle->exists() ) {
-                                       $templates[] = $templateTitle->getPrefixedText();
-                               }
-                       }
-               }
-               return $templates;
-       }
-
        /**
         * Get headings on the page.
         * @return string[]
@@ -162,9 +118,12 @@ class WikiTextStructure {
        private function getIgnoredHeadings() {
                static $ignoredHeadings = null;
                if ( $ignoredHeadings === null ) {
-                       // FIXME: will be renamed in next patches to search-ignored-headings
-                       $source = wfMessage( 'cirrussearch-ignored-headings' )->inContentLanguage();
                        $ignoredHeadings = [];
+                       $source = wfMessage( 'search-ignored-headings' )->inContentLanguage();
+                       if ( $source->isBlank() ) {
+                               // Try old version too, just in case
+                               $source = wfMessage( 'cirrussearch-ignored-headings' )->inContentLanguage();
+                       }
                        if ( !$source->isDisabled() ) {
                                $lines = self::parseSettingsInMessage( $source->plain() );
                                $ignoredHeadings = $lines;               // Now we just have headings!