Merge "Fix param type of search terms in search related classes"
[lhc/web/wiklou.git] / includes / specials / pagers / AllMessagesTablePager.php
index 26c2c50..6facda1 100644 (file)
@@ -66,9 +66,8 @@ class AllMessagesTablePager extends TablePager {
                // FIXME: Why does this need to be set to DIR_DESCENDING to produce ascending ordering?
                $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
 
-               $langObj = wfGetLangObj( $opts->getValue( 'lang' ) );
                $contLang = MediaWikiServices::getInstance()->getContentLanguage();
-               $this->lang = $langObj ?? $contLang;
+               $this->lang = wfGetLangObj( $opts->getValue( 'lang' ) );
 
                $this->langcode = $this->lang->getCode();
                $this->foreign = !$this->lang->equals( $contLang );
@@ -168,28 +167,29 @@ class AllMessagesTablePager extends TablePager {
        }
 
        /**
-        *  This function normally does a database query to get the results; we need
+        * This function normally does a database query to get the results; we need
         * to make a pretend result using a FakeResultWrapper.
         * @param string $offset
         * @param int $limit
-        * @param bool $descending
+        * @param bool $order
         * @return FakeResultWrapper
         */
-       function reallyDoQuery( $offset, $limit, $descending ) {
+       function reallyDoQuery( $offset, $limit, $order ) {
+               $asc = ( $order === self::QUERY_ASCENDING );
                $result = new FakeResultWrapper( [] );
 
-               $messageNames = $this->getAllMessages( $descending );
+               $messageNames = $this->getAllMessages( $order );
                $statuses = self::getCustomisedStatuses( $messageNames, $this->langcode, $this->foreign );
 
                $count = 0;
                foreach ( $messageNames as $key ) {
                        $customised = isset( $statuses['pages'][$key] );
                        if ( $customised !== $this->custom &&
-                               ( $descending && ( $key < $offset || !$offset ) || !$descending && $key > $offset ) &&
+                               ( $asc && ( $key < $offset || !$offset ) || !$asc && $key > $offset ) &&
                                ( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix === false )
                        ) {
-                               $actual = wfMessage( $key )->inLanguage( $this->langcode )->plain();
-                               $default = wfMessage( $key )->inLanguage( $this->langcode )->useDatabase( false )->plain();
+                               $actual = $this->msg( $key )->inLanguage( $this->lang )->plain();
+                               $default = $this->msg( $key )->inLanguage( $this->lang )->useDatabase( false )->plain();
                                $result->result[] = [
                                        'am_title' => $key,
                                        'am_actual' => $actual,
@@ -282,7 +282,10 @@ class AllMessagesTablePager extends TablePager {
                return '';
        }
 
-       /** @return string HTML */
+       /**
+        * @param stdClass $row
+        * @return string HTML
+        */
        function formatRow( $row ) {
                // Do all the normal stuff
                $s = parent::formatRow( $row );
@@ -307,7 +310,11 @@ class AllMessagesTablePager extends TablePager {
                return [];
        }
 
-       /** @return array HTML attributes */
+       /**
+        * @param string $field
+        * @param string $value
+        * @return array HTML attributes
+        */
        function getCellAttrs( $field, $value ) {
                $attr = [];
                if ( $field === 'am_title' ) {