mirror of
https://github.com/friendica/friendica
synced 2025-02-02 02:19:47 +00:00
4 spaces to tab
This commit is contained in:
parent
0906c3532c
commit
a224308d42
1 changed files with 36 additions and 36 deletions
|
@ -377,46 +377,46 @@ class PostUpdate
|
||||||
|
|
||||||
// Post-update script of PR 5596
|
// Post-update script of PR 5596
|
||||||
function fixGenderStrings() {
|
function fixGenderStrings() {
|
||||||
$allGenders = DBA::select('contact', ['id', 'gender']);
|
$allGenders = DBA::select('contact', ['id', 'gender']);
|
||||||
$allLangs = L10n::getAvailableLanguages();
|
$allLangs = L10n::getAvailableLanguages();
|
||||||
$success = 0;
|
$success = 0;
|
||||||
$fail = 0;
|
$fail = 0;
|
||||||
foreach($allGenders as $key=>$gender) {
|
foreach($allGenders as $key=>$gender) {
|
||||||
foreach($allLangs as $key=>$lang) {
|
foreach($allLangs as $key=>$lang) {
|
||||||
|
|
||||||
$a = new \stdClass();
|
$a = new \stdClass();
|
||||||
$a->strings = [];
|
$a->strings = [];
|
||||||
|
|
||||||
// First we get the the localizations
|
// First we get the the localizations
|
||||||
if (file_exists("view/lang/$lang/strings.php")) {
|
if (file_exists("view/lang/$lang/strings.php")) {
|
||||||
include "view/lang/$lang/strings.php";
|
include "view/lang/$lang/strings.php";
|
||||||
}
|
}
|
||||||
if (file_exists("addon/morechoice/lang/$lang/strings.php")) {
|
if (file_exists("addon/morechoice/lang/$lang/strings.php")) {
|
||||||
include "addon/morechoice/lang/$lang/strings.php";
|
include "addon/morechoice/lang/$lang/strings.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
$localizedStrings = $a->strings;
|
$localizedStrings = $a->strings;
|
||||||
unset($a);
|
unset($a);
|
||||||
|
|
||||||
$key = array_search($gender['gender'], $localizedStrings);
|
$key = array_search($gender['gender'], $localizedStrings);
|
||||||
if($key !== false) {
|
if($key !== false) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// defaulting to empty string
|
// defaulting to empty string
|
||||||
$key = '';
|
$key = '';
|
||||||
}
|
}
|
||||||
DBA::update('contact', ['gender' => $key], ['id' => $gender['id']]);
|
DBA::update('contact', ['gender' => $key], ['id' => $gender['id']]);
|
||||||
logger::log('Updated contact ' . $gender['id'] . ' to gender ' . $key . ' (was: ' . $gender['gender'] . ')');
|
logger::log('Updated contact ' . $gender['id'] . ' to gender ' . $key . ' (was: ' . $gender['gender'] . ')');
|
||||||
|
|
||||||
if ($key == '') {
|
if ($key == '') {
|
||||||
$fail++;
|
$fail++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$success++;
|
$success++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::log("Gender fix completed. Success: $success. Fail: $fail");
|
Logger::log("Gender fix completed. Success: $success. Fail: $fail");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue