// Also clear language cache in AdminTranslationsController

This commit is contained in:
Rémi Gaillard
2013-03-26 18:23:17 +01:00
parent a5f5ebb1d8
commit db1a2fccf9
@@ -687,18 +687,25 @@ class AdminTranslationsControllerCore extends AdminController
if (pathinfo($file2check['filename'], PATHINFO_BASENAME) == 'index.php' && file_put_contents(_PS_TRANSLATIONS_DIR_.'../'.$file2check['filename'], Tools::getDefaultIndexContent())) if (pathinfo($file2check['filename'], PATHINFO_BASENAME) == 'index.php' && file_put_contents(_PS_TRANSLATIONS_DIR_.'../'.$file2check['filename'], Tools::getDefaultIndexContent()))
continue; continue;
AdminTranslationsController::checkAndAddMailsFiles($iso_code, $files_list);
$this->checkAndAddThemesFiles($files_list, $themes_selected);
$tab_errors = AdminTranslationsController::addNewTabs($iso_code, $files_list);
if (count($tab_errors))
{
$this->errors += $tab_errors;
return false;
}
if (Validate::isLanguageFileName($filename)) if (Validate::isLanguageFileName($filename))
{ {
if (!Language::checkAndAddLanguage($iso_code)) if (!Language::checkAndAddLanguage($iso_code))
$conf = 20; $conf = 20;
else
{
// Reset cache
Language::loadLanguages();
AdminTranslationsController::checkAndAddMailsFiles($iso_code, $files_list);
$this->checkAndAddThemesFiles($files_list, $themes_selected);
$tab_errors = AdminTranslationsController::addNewTabs($iso_code, $files_list);
if (count($tab_errors))
{
$this->errors += $tab_errors;
return false;
}
}
} }
$this->redirect(false, (isset($conf) ? $conf : '15')); $this->redirect(false, (isset($conf) ? $conf : '15'));
} }
@@ -729,14 +736,17 @@ class AdminTranslationsControllerCore extends AdminController
$this->errors[] = Tools::displayError('The archive cannot be extracted.'). ' '.$error->message; $this->errors[] = Tools::displayError('The archive cannot be extracted.'). ' '.$error->message;
else else
{ {
AdminTranslationsController::checkAndAddMailsFiles($arr_import_lang[0], $files_list);
$tab_errors = AdminTranslationsController::addNewTabs($arr_import_lang[0], $files_list); if (!Language::checkAndAddLanguage($arr_import_lang[0]))
if (count($tab_errors)) $conf = 20;
$this->errors += $tab_errors;
else else
{ {
if (!Language::checkAndAddLanguage($arr_import_lang[0])) // Reset cache
$conf = 20; Language::loadLanguages();
AdminTranslationsController::checkAndAddMailsFiles($arr_import_lang[0], $files_list);
if ($tab_errors = AdminTranslationsController::addNewTabs($arr_import_lang[0], $files_list))
$this->errors += $tab_errors;
} }
if (!unlink($file)) if (!unlink($file))
$this->errors[] = sprintf(Tools::displayError('Cannot delete the archive %s.'), $file); $this->errors[] = sprintf(Tools::displayError('Cannot delete the archive %s.'), $file);