Merge "RCLFilters: convert related changes tool to new UX"
[lhc/web/wiklou.git] / includes / specials / SpecialRecentchangeslinked.php
index a13af55..2eeeb0b 100644 (file)
@@ -30,6 +30,8 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges {
        /** @var bool|Title */
        protected $rclTargetTitle;
 
+       protected $rclTarget;
+
        function __construct() {
                parent::__construct( 'Recentchangeslinked' );
        }
@@ -44,6 +46,7 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges {
 
        public function parseParameters( $par, FormOptions $opts ) {
                $opts['target'] = $par;
+               $this->rclTarget = $par;
        }
 
        /**
@@ -62,8 +65,9 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges {
                $outputPage = $this->getOutput();
                $title = Title::newFromText( $target );
                if ( !$title || $title->isExternal() ) {
-                       $outputPage->addHTML( '<div class="errorbox">' . $this->msg( 'allpagesbadtitle' )
-                                       ->parse() . '</div>' );
+                       $outputPage->addHTML(
+                               Html::errorBox( $this->msg( 'allpagesbadtitle' )->parse() )
+                       );
 
                        return false;
                }
@@ -84,8 +88,10 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges {
                $ns = $title->getNamespace();
                $dbkey = $title->getDBkey();
 
-               $tables[] = 'recentchanges';
-               $select = array_merge( RecentChange::selectFields(), $select );
+               $rcQuery = RecentChange::getQueryInfo();
+               $tables = array_merge( $tables, $rcQuery['tables'] );
+               $select = array_merge( $rcQuery['fields'], $select );
+               $join_conds = array_merge( $join_conds, $rcQuery['joins'] );
 
                // left join with watchlist table to highlight watched rows
                $uid = $this->getUser()->getId();
@@ -290,4 +296,18 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges {
        public function prefixSearchSubpages( $search, $limit, $offset ) {
                return $this->prefixSearchString( $search, $limit, $offset );
        }
+
+       /**
+        * Get a self-referential title object
+        * with consideration to the given subpage.
+        *
+        * @param string|bool $subpage
+        * @return Title
+        * @since 1.23
+        */
+       public function getPageTitle( $subpage = false ) {
+               $subpage = $subpage ? $subpage : $this->rclTarget;
+
+               return parent::getPageTitle( $subpage );
+       }
 }