[BUGFIX] Mirror selection is not respected
authorXavier Perseguers <typo3@perseguers.ch>
Sun, 3 Jul 2011 12:50:16 +0000 (14:50 +0200)
committerXavier Perseguers <typo3@perseguers.ch>
Sun, 3 Jul 2011 12:53:17 +0000 (14:53 +0200)
When a specific mirror is selected in Extension Manager,
the method used to return it fails.

Change-Id: Ica7309eed3ead0a76fc1adb993d2dc47c9437ba1
Resolves: #27755
Releases: 4.6, 4.5
Reviewed-on: http://review.typo3.org/3019
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/em/classes/index.php

index fa0b10c..b3b917d 100644 (file)
@@ -1183,7 +1183,7 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
        }
 
        /**
-        * Returns the base URL for the slected or a random mirror.
+        * Returns the base URL for the selected or a random mirror.
         *
         * @return      string          The URL for the selected or a random mirror
         */
@@ -1205,7 +1205,14 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
                        $url = 'http://' . $mirrors[$rand]['host'] . $mirrors[$rand]['path'];
                }
                else {
-                       $url = 'http://' . $mirrors[$this->MOD_SETTINGS['selectedMirror']]['host'] . $mirrors[$this->MOD_SETTINGS['selectedMirror']]['path'];
+                       $selectedMirror = NULL;
+                       foreach ($mirrors as $mirror) {
+                               if ($mirror['host'] === $this->MOD_SETTINGS['selectedMirror']) {
+                                       $selectedMirror = $mirror;
+                                       break;
+                               }
+                       }
+                       $url = 'http://' . $selectedMirror['host'] . $selectedMirror['path'];
                }
 
                return $url;