Move some global statements to top of function
authorKevin Israel <pleasestand@live.com>
Thu, 30 Apr 2015 17:48:52 +0000 (13:48 -0400)
committerLegoktm <legoktm.wikipedia@gmail.com>
Wed, 6 May 2015 20:19:32 +0000 (20:19 +0000)
These were flagged by mediawiki/tools/code-utils/check-vars.php
because they were located inside a switch statement, or inside an
if statement and used outside the statement. All other warnings
from that script are bogus, mostly because the script has no
support for PHP 5.3 namespaces.

Change-Id: If93bae4434b5c28845125095f6a22d6788a76efc

includes/logging/LogFormatter.php
includes/logging/LogPager.php

index 9c2fdd3..119492b 100644 (file)
@@ -193,6 +193,8 @@ class LogFormatter {
         * @return string Text
         */
        public function getIRCActionText() {
+               global $wgContLang;
+
                $this->plaintext = true;
                $this->irctext = true;
 
@@ -338,7 +340,6 @@ class LogFormatter {
                        case 'block':
                                switch ( $entry->getSubtype() ) {
                                        case 'block':
-                                               global $wgContLang;
                                                // Keep compatibility with extensions by checking for
                                                // new key (5::duration/6::flags) or old key (0/optional 1)
                                                if ( $entry->isLegacy() ) {
@@ -358,7 +359,6 @@ class LogFormatter {
                                                        ->rawParams( $target )->inContentLanguage()->escaped();
                                                break;
                                        case 'reblock':
-                                               global $wgContLang;
                                                $duration = $wgContLang->translateBlockExpiry( $parameters['5::duration'] );
                                                $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'], $wgContLang );
                                                $text = wfMessage( 'reblock-logentry' )
index bf489ab..c4ce7b3 100644 (file)
@@ -192,7 +192,7 @@ class LogPager extends ReverseChronologicalPager {
         * @return void
         */
        private function limitTitle( $page, $pattern ) {
-               global $wgMiserMode;
+               global $wgMiserMode, $wgUserrightsInterwikiDelimiter;
 
                if ( $page instanceof Title ) {
                        $title = $page;
@@ -209,7 +209,6 @@ class LogPager extends ReverseChronologicalPager {
 
                $doUserRightsLogLike = false;
                if ( $this->types == array( 'rights' ) ) {
-                       global $wgUserrightsInterwikiDelimiter;
                        $parts = explode( $wgUserrightsInterwikiDelimiter, $title->getDBKey() );
                        if ( count( $parts ) == 2 ) {
                                list( $name, $database ) = array_map( 'trim', $parts );