Daniel Werner has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/53771


Change subject: Got rid of some global $wgContLang usage in SpecialAllpages
......................................................................

Got rid of some global $wgContLang usage in SpecialAllpages

Using $this->getContext()->getLanguage() instead now. In 
SpecialAllpages::showline
the global is still being used and a comment added. It could be argued about 
whether
the content language or the user language should be used in that place.

Also added some missing documentation to Language::getNamespaces.

Change-Id: If511e2d9edb0f0092f3ca0ceadabd7fdb72f6c06
---
M includes/specials/SpecialAllpages.php
M languages/Language.php
2 files changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/71/53771/1

diff --git a/includes/specials/SpecialAllpages.php 
b/includes/specials/SpecialAllpages.php
index f9cb5cd..50aaaf1 100644
--- a/includes/specials/SpecialAllpages.php
+++ b/includes/specials/SpecialAllpages.php
@@ -71,7 +71,6 @@
         * @param string $par becomes "FOO" when called like 
Special:Allpages/FOO (default NULL)
         */
        function execute( $par ) {
-               global $wgContLang;
                $request = $this->getRequest();
                $out = $this->getOutput();
 
@@ -85,10 +84,10 @@
                $namespace = $request->getInt( 'namespace' );
                $hideredirects = $request->getBool( 'hideredirects', false );
 
-               $namespaces = $wgContLang->getNamespaces();
+               $namespaces = 
$this->getContext()->getLanguage()->getNamespaces();
 
                $out->setPageTitle(
-                       ( $namespace > 0 && in_array( $namespace, array_keys( 
$namespaces) ) ) ?
+                       ( $namespace > 0 && in_array( $namespace, array_keys( 
$namespaces ) ) ) ?
                        $this->msg( 'allinnamespace', str_replace( '_', ' ', 
$namespaces[$namespace] ) ) :
                        $this->msg( 'allarticles' )
                );
@@ -301,6 +300,7 @@
         * @return string
         */
        function showline( $inpoint, $outpoint, $namespace = NS_MAIN, 
$hideredirects ) {
+               // use content language since page titles are considered to use 
content language
                global $wgContLang;
                $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) 
);
                $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint 
) );
@@ -332,12 +332,11 @@
         * @param bool $hideredirects dont show redirects (default FALSE)
         */
        function showChunk( $namespace = NS_MAIN, $from = false, $to = false, 
$hideredirects = false ) {
-               global $wgContLang;
                $output = $this->getOutput();
 
                $fromList = $this->getNamespaceKeyAndText( $namespace, $from );
                $toList = $this->getNamespaceKeyAndText( $namespace, $to );
-               $namespaces = $wgContLang->getNamespaces();
+               $namespaces = 
$this->getContext()->getLanguage()->getNamespaces();
                $n = 0;
 
                if ( !$fromList || !$toList ) {
diff --git a/languages/Language.php b/languages/Language.php
index 01751db..c1d0f33 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -483,6 +483,9 @@
        }
 
        /**
+        * Returns an array of localised namespaces indexed by their numbers. 
If the namespace is not
+        * available in localised form, it will be included in English.
+        *
         * @return array
         */
        public function getNamespaces() {

-- 
To view, visit https://gerrit.wikimedia.org/r/53771
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If511e2d9edb0f0092f3ca0ceadabd7fdb72f6c06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Werner <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to