Merge "Sunsetting viewPrevNext"
[lhc/web/wiklou.git] / includes / specials / pagers / ContribsPager.php
index ca13f3d..10fcfc6 100644 (file)
@@ -154,20 +154,33 @@ class ContribsPager extends RangeChronologicalPager {
                return $query;
        }
 
+       /**
+        * Wrap the navigation bar in a p element with identifying class.
+        * In future we may want to change the `p` tag to a `div` and upstream
+        * this to the parent class.
+        *
+        * @return string HTML
+        */
+       function getNavigationBar() {
+               return Html::rawElement( 'p', [ 'class' => 'mw-pager-navigation-bar' ],
+                       parent::getNavigationBar()
+               );
+       }
+
        /**
         * This method basically executes the exact same code as the parent class, though with
         * a hook added, to allow extensions to add additional queries.
         *
         * @param string $offset Index offset, inclusive
         * @param int $limit Exact query limit
-        * @param bool $descending Query direction, false for ascending, true for descending
+        * @param bool $order IndexPager::QUERY_ASCENDING or IndexPager::QUERY_DESCENDING
         * @return IResultWrapper
         */
-       function reallyDoQuery( $offset, $limit, $descending ) {
+       function reallyDoQuery( $offset, $limit, $order ) {
                list( $tables, $fields, $conds, $fname, $options, $join_conds ) = $this->buildQueryInfo(
                        $offset,
                        $limit,
-                       $descending
+                       $order
                );
 
                /*
@@ -193,7 +206,7 @@ class ContribsPager extends RangeChronologicalPager {
                ) ];
                Hooks::run(
                        'ContribsPager::reallyDoQuery',
-                       [ &$data, $this, $offset, $limit, $descending ]
+                       [ &$data, $this, $offset, $limit, $order ]
                );
 
                $result = [];
@@ -207,7 +220,7 @@ class ContribsPager extends RangeChronologicalPager {
                }
 
                // sort results
-               if ( $descending ) {
+               if ( $order === self::QUERY_ASCENDING ) {
                        ksort( $result );
                } else {
                        krsort( $result );
@@ -421,6 +434,41 @@ class ContribsPager extends RangeChronologicalPager {
                return 'rev_timestamp';
        }
 
+       /**
+        * @return false|string
+        */
+       public function getTagFilter() {
+               return $this->tagFilter;
+       }
+
+       /**
+        * @return string
+        */
+       public function getContribs() {
+               return $this->contribs;
+       }
+
+       /**
+        * @return string
+        */
+       public function getTarget() {
+               return $this->target;
+       }
+
+       /**
+        * @return bool
+        */
+       public function isNewOnly() {
+               return $this->newOnly;
+       }
+
+       /**
+        * @return int|string
+        */
+       public function getNamespace() {
+               return $this->namespace;
+       }
+
        /**
         * @return string[]
         */
@@ -598,20 +646,7 @@ class ContribsPager extends RangeChronologicalPager {
 
                        $lang = $this->getLanguage();
                        $comment = $lang->getDirMark() . Linker::revComment( $rev, false, true, false );
-                       $date = $lang->userTimeAndDate( $row->rev_timestamp, $user );
-                       if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) {
-                               $d = $linkRenderer->makeKnownLink(
-                                       $page,
-                                       $date,
-                                       [ 'class' => 'mw-changeslist-date' ],
-                                       [ 'oldid' => intval( $row->rev_id ) ]
-                               );
-                       } else {
-                               $d = htmlspecialchars( $date );
-                       }
-                       if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
-                               $d = '<span class="history-deleted">' . $d . '</span>';
-                       }
+                       $d = ChangesList::revDateLink( $rev, $user, $lang, $page );
 
                        # Show user names for /newbies as there may be different users.
                        # Note that only unprivileged users have rows with hidden user names excluded.