Fix #1406 convert 'jp' to 'ja' in lang table

This commit is contained in:
Kijin Sung 2020-10-03 01:30:28 +09:00
parent 0177ee3abe
commit 338951f5c8
5 changed files with 67 additions and 4 deletions

View file

@ -104,6 +104,18 @@ class module extends ModuleObject
if(!$oDB->isColumnExists('action_forward', 'route_regexp')) return true;
if(!$oDB->isColumnExists('action_forward', 'route_config')) return true;
if(!$oDB->isColumnExists('action_forward', 'global_route')) return true;
// check additional indexes on lang table
if(!$oDB->isIndexExists('lang', 'idx_site_srl')) return true;
if(!$oDB->isIndexExists('lang', 'idx_name')) return true;
if(!$oDB->isIndexExists('lang', 'idx_lang_code')) return true;
// check deprecated lang code
$output = executeQuery('module.getLangCount', ['site_srl' => 0, 'lang_code' => 'jp']);
if ($output->data->count > 0)
{
return true;
}
}
/**
@ -173,6 +185,31 @@ class module extends ModuleObject
{
$oDB->addColumn('action_forward', 'global_route', 'char', 1, 'N', true);
}
// check additional indexes on lang table
if(!$oDB->isIndexExists('lang', 'idx_site_srl'))
{
$oDB->addIndex('lang', 'idx_site_srl', array('site_srl'), false);
}
if(!$oDB->isIndexExists('lang', 'idx_name'))
{
$oDB->addIndex('lang', 'idx_name', array('name'), false);
}
if(!$oDB->isIndexExists('lang', 'idx_lang_code'))
{
$oDB->addIndex('lang', 'idx_lang_code', array('lang_code'), false);
}
// check deprecated lang code
$output = executeQuery('module.getLangCount', ['site_srl' => 0, 'lang_code' => 'jp']);
if ($output->data->count > 0)
{
$output = executeQuery('module.updateLangCode', ['lang_code' => 'jp', 'new_lang_code' => 'ja']);
if (!$output->toBool())
{
return $output;
}
}
}
/**