Don't create new Revision and Title object if we can use the ones that we already...
[lhc/web/wiklou.git] / includes / PageQueryPage.php
index 53b7765..dc5e971 100644 (file)
@@ -3,24 +3,24 @@
 /**
  * Variant of QueryPage which formats the result as a simple link to the page
  *
- * @package MediaWiki
- * @addtogroup SpecialPage
+ * @ingroup SpecialPage
  */
-class PageQueryPage extends QueryPage {
+abstract class PageQueryPage extends QueryPage {
 
        /**
         * Format the result as a simple link to the page
         *
-        * @param Skin $skin
-        * @param object $row Result row
+        * @param $skin Skin
+        * @param $row Object: result row
         * @return string
         */
        public function formatResult( $skin, $row ) {
                global $wgContLang;
                $title = Title::makeTitleSafe( $row->namespace, $row->title );
-               return $skin->makeKnownLinkObj( $title,
-                       htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
+               $text = $row->title;
+               if ( $title instanceof Title ) {
+                       $text = $wgContLang->convert( $title->getPrefixedText() );
+               }
+               return Linker::linkKnown( $title, htmlspecialchars( $text ) );
        }
 }
-
-