Avoid changing the global on special pages
authorumherirrender <umherirrender_de.wp@web.de>
Thu, 23 May 2013 17:31:56 +0000 (19:31 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Thu, 23 May 2013 17:31:56 +0000 (19:31 +0200)
Change-Id: I742845badd43cef68ba9f807030d8ea434961fd4

includes/specials/SpecialRecentchanges.php
includes/specials/SpecialUpload.php

index 0d6378c..1b406d1 100644 (file)
@@ -876,16 +876,19 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                }
 
                # Sort data for display and make sure it's unique after we've added user data.
-               $wgRCLinkLimits[] = $options['limit'];
-               $wgRCLinkDays[] = $options['days'];
-               sort( $wgRCLinkLimits );
-               sort( $wgRCLinkDays );
-               $wgRCLinkLimits = array_unique( $wgRCLinkLimits );
-               $wgRCLinkDays = array_unique( $wgRCLinkDays );
+               $linkLimits = $wgRCLinkLimits;
+               $linkLimits[] = $options['limit'];
+               sort( $linkLimits );
+               $linkLimits = array_unique( $linkLimits );
+
+               $linkDays = $wgRCLinkDays;
+               $linkDays[] = $options['days'];
+               sort( $linkDays );
+               $linkDays = array_unique( $linkDays );
 
                // limit links
                $cl = array();
-               foreach ( $wgRCLinkLimits as $value ) {
+               foreach ( $linkLimits as $value ) {
                        $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
                                array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
                }
@@ -893,7 +896,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
 
                // day links, reset 'from' to none
                $dl = array();
-               foreach ( $wgRCLinkDays as $value ) {
+               foreach ( $linkDays as $value ) {
                        $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
                                array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
                }
index ee737c6..98d0c9a 100644 (file)
@@ -456,7 +456,6 @@ class SpecialUpload extends SpecialPage {
         */
        public static function getInitialPageText( $comment = '', $license = '', $copyStatus = '', $source = '' ) {
                global $wgUseCopyrightUpload, $wgForceUIMsgAsContentMsg;
-               $wgForceUIMsgAsContentMsg = (array) $wgForceUIMsgAsContentMsg;
 
                $msg = array();
                /* These messages are transcluded into the actual text of the description page.
@@ -464,7 +463,7 @@ class SpecialUpload extends SpecialPage {
                 * instead of hardcoding it there in the uploader language.
                 */
                foreach ( array( 'license-header', 'filedesc', 'filestatus', 'filesource' ) as $msgName ) {
-                       if ( in_array( $msgName, $wgForceUIMsgAsContentMsg ) ) {
+                       if ( in_array( $msgName, (array)$wgForceUIMsgAsContentMsg ) ) {
                                $msg[$msgName] = "{{int:$msgName}}";
                        } else {
                                $msg[$msgName] = wfMessage( $msgName )->inContentLanguage()->text();