SpecialPrefixindex formatting methods are now protected
authorAntoine Musso <hashar@free.fr>
Wed, 24 Jul 2013 10:08:52 +0000 (12:08 +0200)
committerAntoine Musso <hashar@free.fr>
Thu, 29 Aug 2013 14:42:33 +0000 (16:42 +0200)
namespacePrefixForm() and showPrefixChunk() accepted additional
arguments to slightly alter the form such as hiding redirects.  The
argument has been removed in favor of class property just like
stripprefix introduced earlier and the method have been made protected
since there is no point in calling them out of the special page scope.

Change-Id: I55728fd2634f8a935a033052dcce3c7247cb1aa3

RELEASE-NOTES-1.22
includes/specials/SpecialPrefixindex.php

index f0490d4..1f2b94f 100644 (file)
@@ -421,6 +421,9 @@ changes to languages because of Bugzilla reports.
   responsibility of classes implementing the RCFeedFormatter and RCFeedEngine
   interfaces to implement the formatting and delivery for recent change
   notifications.
+* SpecialPrefixindex methods namespacePrefixForm() and showPrefixChunk() have
+  been made protected. They were accepting form variance arguments, this is now
+  using properties in the SpecialPrefixindex class.
 
 == Compatibility ==
 
index f2efd0f..c4c5c99 100644 (file)
@@ -34,6 +34,8 @@ class SpecialPrefixindex extends SpecialAllpages {
         */
        protected $stripPrefix = false;
 
+       protected $hideRedirects = false;
+
        // Inherit $maxPerPage
 
        function __construct() {
@@ -59,7 +61,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                $prefix = $request->getVal( 'prefix', '' );
                $ns = $request->getIntOrNull( 'namespace' );
                $namespace = (int)$ns; // if no namespace given, use 0 (NS_MAIN).
-               $hideredirects = $request->getBool( 'hideredirects', false );
+               $this->hideRedirects = $request->getBool( 'hideredirects', $this->hideRedirects );
                $this->stripPrefix = $request->getBool( 'stripprefix', $this->stripPrefix );
 
                $namespaces = $wgContLang->getNamespaces();
@@ -82,9 +84,9 @@ class SpecialPrefixindex extends SpecialAllpages {
 
                // Bug 27864: if transcluded, show all pages instead of the form.
                if ( $this->including() || $showme != '' || $ns !== null ) {
-                       $this->showPrefixChunk( $namespace, $showme, $from, $hideredirects );
+                       $this->showPrefixChunk( $namespace, $showme, $from );
                } else {
-                       $out->addHTML( $this->namespacePrefixForm( $namespace, null, $hideredirects ) );
+                       $out->addHTML( $this->namespacePrefixForm( $namespace, null ) );
                }
        }
 
@@ -92,10 +94,9 @@ class SpecialPrefixindex extends SpecialAllpages {
         * HTML for the top form
         * @param $namespace Integer: a namespace constant (default NS_MAIN).
         * @param string $from dbKey we are starting listing at.
-        * @param bool $hideredirects hide redirects (default FALSE)
         * @return string
         */
-       function namespacePrefixForm( $namespace = NS_MAIN, $from = '', $hideredirects = false ) {
+       protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) {
                global $wgScript;
 
                $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) );
@@ -128,7 +129,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                                $this->msg( 'allpages-hide-redirects' )->text(),
                                'hideredirects',
                                'hideredirects',
-                               $hideredirects
+                               $this->hideRedirects
                        ) . ' ' .
                        Xml::checkLabel(
                                $this->msg( 'prefixindex-strip' )->text(),
@@ -151,9 +152,8 @@ class SpecialPrefixindex extends SpecialAllpages {
         * @param $namespace Integer, default NS_MAIN
         * @param $prefix String
         * @param string $from list all pages from this name (default FALSE)
-        * @param bool $hideredirects hide redirects (default FALSE)
         */
-       function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null, $hideredirects = false ) {
+       protected function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) {
                global $wgContLang;
 
                if ( $from === null ) {
@@ -184,7 +184,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                                'page_title >= ' . $dbr->addQuotes( $fromKey ),
                        );
 
-                       if ( $hideredirects ) {
+                       if ( $this->hideRedirects ) {
                                $conds['page_is_redirect'] = 0;
                        }
 
@@ -247,7 +247,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                if ( $this->including() ) {
                        $out2 = '';
                } else {
-                       $nsForm = $this->namespacePrefixForm( $namespace, $prefix, $hideredirects );
+                       $nsForm = $this->namespacePrefixForm( $namespace, $prefix );
                        $self = $this->getTitle();
                        $out2 = Xml::openElement( 'table', array( 'id' => 'mw-prefixindex-nav-table' ) ) .
                                '<tr>
@@ -262,7 +262,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                                $query = array(
                                        'from' => $s->page_title,
                                        'prefix' => $prefix,
-                                       'hideredirects' => $hideredirects,
+                                       'hideredirects' => $this->hideRedirects,
                                );
 
                                if ( $namespace || $prefix == '' ) {