Fixed writing langs ids to InstOurLangs; made detected languages fall back to declared languages when they can't be detected
This commit is contained in:
parent
fa97078fe4
commit
6f296a1d27
1 changed files with 7 additions and 2 deletions
|
@ -656,7 +656,12 @@ if ($instanswered && isset($idata['languages']) && is_array($idata['languages'])
|
||||||
$idata['ourlanguages']=get_instance_langs($opts['hostname']);
|
$idata['ourlanguages']=get_instance_langs($opts['hostname']);
|
||||||
while (count($idata['ourlanguages'])>5)
|
while (count($idata['ourlanguages'])>5)
|
||||||
array_pop($idata['ourlanguages']);
|
array_pop($idata['ourlanguages']);
|
||||||
eecho(1,'«'.$opts['hostname'].'»: detected languages: '.implode(', ',$idata['ourlanguages']).N);
|
if (count($idata['ourlanguages'])>0) {
|
||||||
|
eecho(1,'«'.$opts['hostname'].'»: detected languages: '.implode(', ',$idata['ourlanguages']).N);
|
||||||
|
} else {
|
||||||
|
$idata['ourlanguages']=$idata['languages'];
|
||||||
|
eecho(1,'«'.$opts['hostname'].'»: detected languages: NONE; copied declared languages to detected languages.'.N);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$idata['ourlanguages']=$idata['languages'];
|
$idata['ourlanguages']=$idata['languages'];
|
||||||
eecho(1,'«'.$opts['hostname'].'»: copied declared languages to detected languages.'.N);
|
eecho(1,'«'.$opts['hostname'].'»: copied declared languages to detected languages.'.N);
|
||||||
|
@ -665,7 +670,7 @@ if ($instanswered && isset($idata['languages']) && is_array($idata['languages'])
|
||||||
myq($link,'DELETE FROM InstOurLangs WHERE InstID='.$instid,__LINE__);
|
myq($link,'DELETE FROM InstOurLangs WHERE InstID='.$instid,__LINE__);
|
||||||
$langids=getlangsidsarr($idata['languages'],$link,$opts['hostname'],$opts['dryrun'],__LINE__);
|
$langids=getlangsidsarr($idata['languages'],$link,$opts['hostname'],$opts['dryrun'],__LINE__);
|
||||||
$pos=0;
|
$pos=0;
|
||||||
foreach ($idata['ourlanguages'] as $lang) {
|
foreach ($langids as $langid) {
|
||||||
$pos++;
|
$pos++;
|
||||||
myq($link,'INSERT INTO InstOurLangs SET InstID='.$instid.', OurLangID='.$langid.', Pos='.$pos,__LINE__);
|
myq($link,'INSERT INTO InstOurLangs SET InstID='.$instid.', OurLangID='.$langid.', Pos='.$pos,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue