]> git.mxchange.org Git - friendica.git/commitdiff
Seems I forgot about empty translated strings
authorJeroen De Meerleer <me@jeroened.be>
Thu, 20 Dec 2018 16:43:07 +0000 (17:43 +0100)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Jan 2019 14:13:08 +0000 (09:13 -0500)
update.php

index 449b139965366e37321f91f65363bb727b8e309e..460afe3e9a637fc0b30c20d002bb6c39443eea10 100644 (file)
@@ -265,37 +265,39 @@ function update_1293()
        $success = 0;
        $fail = 0;
        foreach ($allGenders as $key => $gender) {
-               foreach ($allLangs as $key => $lang) {
-
-                       $a = new \stdClass();
-                       $a->strings = [];
-
-                       // First we get the the localizations
-                       if (file_exists("view/lang/$lang/strings.php")) {
-                               include "view/lang/$lang/strings.php";
+               if ($gender['gender'] != '') {
+                       foreach ($allLangs as $key => $lang) {
+
+                               $a = new \stdClass();
+                               $a->strings = [];
+
+                               // First we get the the localizations
+                               if (file_exists("view/lang/$lang/strings.php")) {
+                                       include "view/lang/$lang/strings.php";
+                               }
+                               if (file_exists("addon/morechoice/lang/$lang/strings.php")) {
+                                       include "addon/morechoice/lang/$lang/strings.php";
+                               }
+
+                               $localizedStrings = $a->strings;
+                               unset($a);
+
+                               $key = array_search($gender['gender'], $localizedStrings);
+                               if ($key !== false) {
+                                       break;
+                               }
+
+                               // defaulting to empty string
+                               $key = '';
                        }
-                       if (file_exists("addon/morechoice/lang/$lang/strings.php")) {
-                               include "addon/morechoice/lang/$lang/strings.php";
-                       }
-
-                       $localizedStrings = $a->strings;
-                       unset($a);
 
-                       $key = array_search($gender['gender'], $localizedStrings);
-                       if ($key !== false) {
-                               break;
+                       if ($key == '') {
+                               $fail++;
+                       } else {
+                               DBA::update('contact', ['gender' => $key], ['id' => $gender['id']]);
+                               logger::log('Updated contact ' . $gender['id'] . ' to gender ' . $key . ' (was: ' . $gender['gender'] . ')');
+                               $success++;
                        }
-
-                       // defaulting to empty string
-                       $key = '';
-               }
-
-               if ($key == '') {
-                       $fail++;
-               } else {
-                       DBA::update('contact', ['gender' => $key], ['id' => $gender['id']]);
-                       logger::log('Updated contact ' . $gender['id'] . ' to gender ' . $key . ' (was: ' . $gender['gender'] . ')');
-                       $success++;
                }
        }