Restore some previous constructor calls
authorMatěj Suchánek <matejsuchanek97@gmail.com>
Tue, 27 Aug 2019 07:56:38 +0000 (09:56 +0200)
committerMatěj Suchánek <matejsuchanek97@gmail.com>
Tue, 27 Aug 2019 07:56:38 +0000 (09:56 +0200)
Follow-up to If07f10075a51fbbe9de24464cb6844faaad94780
and I082152b64141f1a9a4085bba23fe81a99ec8d886.

It will make getRequest use the provided context again.

Change-Id: I60b2598edcb0daed076876482e1e9d6cbf815eb2

includes/pager/TablePager.php
includes/specials/pagers/ImageListPager.php
includes/specials/pagers/UsersPager.php

index 36ed9aa..f611699 100644 (file)
@@ -35,6 +35,10 @@ abstract class TablePager extends IndexPager {
        protected $mCurrentRow;
 
        public function __construct( IContextSource $context = null, LinkRenderer $linkRenderer = null ) {
+               if ( $context ) {
+                       $this->setContext( $context );
+               }
+
                $this->mSort = $this->getRequest()->getText( 'sort' );
                if ( !array_key_exists( $this->mSort, $this->getFieldNames() )
                        || !$this->isFieldSortable( $this->mSort )
@@ -48,7 +52,7 @@ abstract class TablePager extends IndexPager {
                } /* Else leave it at whatever the class default is */
 
                // Parent constructor needs mSort set, so we call it last
-               parent::__construct( $context, $linkRenderer );
+               parent::__construct( null, $linkRenderer );
        }
 
        /**
index 6bdccd8..81b7808 100644 (file)
@@ -53,7 +53,7 @@ class ImageListPager extends TablePager {
        public function __construct( IContextSource $context, $userName = null, $search = '',
                $including = false, $showAll = false
        ) {
-               parent::__construct( $context );
+               $this->setContext( $context );
 
                $this->mIncluding = $including;
                $this->mShowAll = $showAll;
@@ -95,6 +95,8 @@ class ImageListPager extends TablePager {
                } else {
                        $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
                }
+
+               parent::__construct();
        }
 
        /**
index e27fb58..57b575b 100644 (file)
@@ -44,6 +44,10 @@ class UsersPager extends AlphabeticPager {
         * another page
         */
        public function __construct( IContextSource $context = null, $par = null, $including = null ) {
+               if ( $context ) {
+                       $this->setContext( $context );
+               }
+
                $request = $this->getRequest();
                $par = $par ?? '';
                $parms = explode( '/', $par );
@@ -83,7 +87,7 @@ class UsersPager extends AlphabeticPager {
                        }
                }
 
-               parent::__construct( $context );
+               parent::__construct();
        }
 
        /**