From: Kunal Mehta Date: Sun, 3 Aug 2014 23:01:38 +0000 (-0700) Subject: SpecialListFiles: Use Config instead of globals X-Git-Tag: 1.31.0-rc.0~14609^2 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=458a7b32d5d2031edd6c11f69b13e33a4d174199;p=lhc%2Fweb%2Fwiklou.git SpecialListFiles: Use Config instead of globals Change-Id: Id311c3009ce885b632897b6a0b85efc7ba445b9d --- diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index 2ce45acfd0..c62c1de781 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -86,8 +86,6 @@ class ImageListPager extends TablePager { function __construct( IContextSource $context, $userName = null, $search = '', $including = false, $showAll = false ) { - global $wgMiserMode; - $this->mIncluding = $including; $this->mShowAll = $showAll; @@ -98,7 +96,7 @@ class ImageListPager extends TablePager { } } - if ( $search !== '' && !$wgMiserMode ) { + if ( $search !== '' && !$this->getConfig()->get( 'MiserMode' ) ) { $this->mSearch = $search; $nt = Title::newFromURL( $this->mSearch ); @@ -164,7 +162,6 @@ class ImageListPager extends TablePager { */ function getFieldNames() { if ( !$this->mFieldNames ) { - global $wgMiserMode; $this->mFieldNames = array( 'img_timestamp' => $this->msg( 'listfiles_date' )->text(), 'img_name' => $this->msg( 'listfiles_name' )->text(), @@ -178,7 +175,7 @@ class ImageListPager extends TablePager { // img_description down here, in order so that its still after the username field. $this->mFieldNames['img_description'] = $this->msg( 'listfiles_description' )->text(); - if ( !$wgMiserMode && !$this->mShowAll ) { + if ( !$this->getConfig()->get( 'MiserMode' ) && !$this->mShowAll ) { $this->mFieldNames['count'] = $this->msg( 'listfiles_count' )->text(); } if ( $this->mShowAll ) { @@ -190,7 +187,6 @@ class ImageListPager extends TablePager { } function isFieldSortable( $field ) { - global $wgMiserMode; if ( $this->mIncluding ) { return false; } @@ -202,14 +198,14 @@ class ImageListPager extends TablePager { * In particular that means we cannot sort by timestamp when not filtering * by user and including old images in the results. Which is sad. */ - if ( $wgMiserMode && !is_null( $this->mUserName ) ) { + if ( $this->getConfig()->get( 'MiserMode' ) && !is_null( $this->mUserName ) ) { // If we're sorting by user, the index only supports sorting by time. if ( $field === 'img_timestamp' ) { return true; } else { return false; } - } elseif ( $wgMiserMode && $this->mShowAll /* && mUserName === null */ ) { + } elseif ( $this->getConfig()->get( 'MiserMode' ) && $this->mShowAll /* && mUserName === null */ ) { // no oi_timestamp index, so only alphabetical sorting in this case. if ( $field === 'img_name' ) { return true; @@ -392,8 +388,7 @@ class ImageListPager extends TablePager { } function getDefaultSort() { - global $wgMiserMode; - if ( $this->mShowAll && $wgMiserMode && is_null( $this->mUserName ) ) { + if ( $this->mShowAll && $this->getConfig()->get( 'MiserMode' ) && is_null( $this->mUserName ) ) { // Unfortunately no index on oi_timestamp. return 'img_name'; } else { @@ -504,10 +499,9 @@ class ImageListPager extends TablePager { } function getForm() { - global $wgScript, $wgMiserMode; $inputForm = array(); $inputForm['table_pager_limit_label'] = $this->getLimitSelect( array( 'tabindex' => 1 ) ); - if ( !$wgMiserMode ) { + if ( !$this->getConfig()->get( 'MiserMode' ) ) { $inputForm['listfiles_search_for'] = Html::input( 'ilsearch', $this->mSearch, @@ -533,7 +527,7 @@ class ImageListPager extends TablePager { ) ); return Html::openElement( 'form', - array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) + array( 'method' => 'get', 'action' => wfScript(), 'id' => 'mw-listfiles-form' ) ) . Xml::fieldset( $this->msg( 'listfiles' )->text() ) . Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .