]> git.mxchange.org Git - friendica.git/commitdiff
4 spaces to tab
authorJeroen De Meerleer <me@jeroened.be>
Tue, 18 Dec 2018 13:49:13 +0000 (14:49 +0100)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Jan 2019 14:12:37 +0000 (09:12 -0500)
src/Database/PostUpdate.php

index 59b6964084862ef452c33f661de6faf40b0b1221..9a4c3640a35212045f222c6c0404836a76889767 100644 (file)
@@ -377,46 +377,46 @@ class PostUpdate
 
        // Post-update script of PR 5596
        function fixGenderStrings() {
-           $allGenders = DBA::select('contact', ['id', 'gender']);
-        $allLangs = L10n::getAvailableLanguages();
-        $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 (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 = '';
-            }
-            DBA::update('contact', ['gender' => $key], ['id' => $gender['id']]);
-            logger::log('Updated contact ' . $gender['id'] . ' to gender ' . $key . ' (was: ' . $gender['gender'] . ')');
-
-            if ($key == '') {
-                $fail++;
-            }
-            else {
-                $success++;
-            }
-        }
-
-           Logger::log("Gender fix completed. Success: $success. Fail: $fail");
-    }
+               $allGenders = DBA::select('contact', ['id', 'gender']);
+               $allLangs = L10n::getAvailableLanguages();
+               $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 (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 = '';
+                       }
+                       DBA::update('contact', ['gender' => $key], ['id' => $gender['id']]);
+                       logger::log('Updated contact ' . $gender['id'] . ' to gender ' . $key . ' (was: ' . $gender['gender'] . ')');
+
+                       if ($key == '') {
+                               $fail++;
+                       }
+                       else {
+                               $success++;
+                       }
+               }
+               
+               Logger::log("Gender fix completed. Success: $success. Fail: $fail");
+       }
 }