Seems I forgot about empty translated strings
This commit is contained in:
parent
c7d4838400
commit
09e44caf71
54
update.php
54
update.php
|
@ -265,37 +265,39 @@ function update_1293()
|
||||||
$success = 0;
|
$success = 0;
|
||||||
$fail = 0;
|
$fail = 0;
|
||||||
foreach ($allGenders as $key => $gender) {
|
foreach ($allGenders as $key => $gender) {
|
||||||
foreach ($allLangs as $key => $lang) {
|
if ($gender['gender'] != '') {
|
||||||
|
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;
|
||||||
|
unset($a);
|
||||||
|
|
||||||
|
$key = array_search($gender['gender'], $localizedStrings);
|
||||||
|
if ($key !== false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// defaulting to empty string
|
||||||
|
$key = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$localizedStrings = $a->strings;
|
if ($key == '') {
|
||||||
unset($a);
|
$fail++;
|
||||||
|
} else {
|
||||||
$key = array_search($gender['gender'], $localizedStrings);
|
DBA::update('contact', ['gender' => $key], ['id' => $gender['id']]);
|
||||||
if ($key !== false) {
|
logger::log('Updated contact ' . $gender['id'] . ' to gender ' . $key . ' (was: ' . $gender['gender'] . ')');
|
||||||
break;
|
$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++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user