https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112301

Revision: 112301
Author:   tstarling
Date:     2012-02-24 05:16:37 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
MFT r112300: fallback infinite loops

Modified Paths:
--------------
    
branches/wmf/1.19wmf1/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
    branches/wmf/1.19wmf1/extensions/LandingCheck/SpecialLandingCheck.php
    branches/wmf/1.19wmf1/extensions/SecurePoll/includes/pages/Page.php

Property Changed:
----------------
    
branches/wmf/1.19wmf1/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
    branches/wmf/1.19wmf1/extensions/LandingCheck/SpecialLandingCheck.php
    branches/wmf/1.19wmf1/extensions/SecurePoll/includes/pages/Page.php

Modified: 
branches/wmf/1.19wmf1/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
===================================================================
--- 
branches/wmf/1.19wmf1/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
  2012-02-24 05:14:42 UTC (rev 112300)
+++ 
branches/wmf/1.19wmf1/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
  2012-02-24 05:16:37 UTC (rev 112301)
@@ -1694,12 +1694,14 @@
                
                switch ( $type ) {
                        case 'request':
-                               $count = 0;
-                               //Count's just there making sure we don't get 
stuck here. 
-                               while ( !in_array( $language, 
$this->getAvailableLanguages() ) && $count < 3 ){
-                                       // Get the fallback language
-                                       $language = Language::getFallbackFor( 
$language );
-                                       $count += 1;
+                               if ( !in_array( $language, 
$this->getAvailableLanguages() ) ) {
+                                       $fallbacks = Language::getFallbacksFor( 
$language );
+                                       foreach ( $fallbacks as $fallback ) {
+                                               if ( in_array( $fallback, 
$this->getAvailableLanguages() ) ) {
+                                                       $language = $fallback;
+                                                       break;
+                                               }
+                                       }
                                }
 
                                if ( !in_array( $language, 
$this->getAvailableLanguages() ) ){


Property changes on: 
branches/wmf/1.19wmf1/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
___________________________________________________________________
Added: svn:mergeinfo
   + 
/branches/JSTesting/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php:100352-107913
/branches/REL1_15/phase3/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php:51646
/branches/REL1_17/phase3/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php:81445,81448
/branches/new-installer/phase3/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php:43664-66004
/branches/sqlite/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php:58211-58321
/branches/wmf/1.18wmf1/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php:97508
/trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php:111043,111199,111218,111484,111575,111604,111659-111661,111668,111670,111688,111690,111698,111713,111715,111780,111796,111814,111947,112074,112153,112160,112166,112260,112282,112300
/trunk/phase3/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251

Modified: branches/wmf/1.19wmf1/extensions/LandingCheck/SpecialLandingCheck.php
===================================================================
--- branches/wmf/1.19wmf1/extensions/LandingCheck/SpecialLandingCheck.php       
2012-02-24 05:14:42 UTC (rev 112300)
+++ branches/wmf/1.19wmf1/extensions/LandingCheck/SpecialLandingCheck.php       
2012-02-24 05:16:37 UTC (rev 112301)
@@ -178,10 +178,9 @@
                                $landingPage . '/' . $language
                        );
                        // Add fallback languages
-                       $code = $language;
-                       while ( $code !== 'en' ) {
-                               $code = Language::getFallbackFor( $code );
-                               $targetTexts[] = $landingPage . '/' . $code;
+                       $fallbacks = Language::getFallbacksFor( $language );
+                       foreach ( $fallbacks as $fallback ) {
+                               $targetTexts[] = $landingPage . '/' . $fallback;
                        }
                }
                


Property changes on: 
branches/wmf/1.19wmf1/extensions/LandingCheck/SpecialLandingCheck.php
___________________________________________________________________
Added: svn:mergeinfo
   + 
/branches/JSTesting/extensions/LandingCheck/SpecialLandingCheck.php:100352-107913
/branches/REL1_15/phase3/extensions/LandingCheck/SpecialLandingCheck.php:51646
/branches/REL1_17/phase3/extensions/LandingCheck/SpecialLandingCheck.php:81445,81448
/branches/new-installer/phase3/extensions/LandingCheck/SpecialLandingCheck.php:43664-66004
/branches/sqlite/extensions/LandingCheck/SpecialLandingCheck.php:58211-58321
/branches/wmf/1.18wmf1/extensions/LandingCheck/SpecialLandingCheck.php:97508
/trunk/extensions/LandingCheck/SpecialLandingCheck.php:111043,111199,111218,111484,111575,111604,111659-111661,111668,111670,111688,111690,111698,111713,111715,111780,111796,111814,111947,112074,112153,112160,112166,112260,112282,112300
/trunk/phase3/extensions/LandingCheck/SpecialLandingCheck.php:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251

Modified: branches/wmf/1.19wmf1/extensions/SecurePoll/includes/pages/Page.php
===================================================================
--- branches/wmf/1.19wmf1/extensions/SecurePoll/includes/pages/Page.php 
2012-02-24 05:14:42 UTC (rev 112300)
+++ branches/wmf/1.19wmf1/extensions/SecurePoll/includes/pages/Page.php 
2012-02-24 05:16:37 UTC (rev 112301)
@@ -38,16 +38,14 @@
                }
                $wgLang = Language::factory( $userLang );
 
-               $languages = array( $userLang );
-               $fallback = $userLang;
-               while ( $fallback = Language::getFallbackFor( $fallback ) ) {
-                       $languages[] = $fallback;
+               $languages = array_merge(
+                       array( $userLang ),
+                       Language::getFallbacksFor( $userLang ) );
+
+               if ( !in_array( $election->getLanguage(), $languages ) ) {
+                       $languages[] = $election->getLanguage();
                }
-               if ( $fallback != $election->getLanguage() ) {
-                       $fallback = $election->getLanguage();
-                       $languages[] = $fallback;
-               }
-               if ( $fallback != 'en' ) {
+               if ( !in_array( 'en', $languages ) ) {
                        $languages[] = 'en';
                }
                $this->context->setLanguages( $languages );


Property changes on: 
branches/wmf/1.19wmf1/extensions/SecurePoll/includes/pages/Page.php
___________________________________________________________________
Added: svn:mergeinfo
   + 
/branches/JSTesting/extensions/SecurePoll/includes/pages/Page.php:100352-107913
/branches/REL1_15/phase3/extensions/SecurePoll/includes/pages/Page.php:51646
/branches/REL1_17/phase3/extensions/SecurePoll/includes/pages/Page.php:81445,81448
/branches/new-installer/phase3/extensions/SecurePoll/includes/pages/Page.php:43664-66004
/branches/sqlite/extensions/SecurePoll/includes/pages/Page.php:58211-58321
/branches/wmf/1.18wmf1/extensions/SecurePoll/includes/pages/Page.php:97508
/trunk/extensions/SecurePoll/includes/pages/Page.php:111043,111199,111218,111484,111575,111604,111659-111661,111668,111670,111688,111690,111698,111713,111715,111780,111796,111814,111947,112074,112153,112160,112166,112260,112282,112300
/trunk/phase3/extensions/SecurePoll/includes/pages/Page.php:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251


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

Reply via email to