// Also clear language cache in AdminTranslationsController

This commit is contained in:
Rémi Gaillard committed 2013-03-26 18:23:17 +01:00
1 parent a5f5ebb1d8
commit db1a2fccf9
1 file changed
+20 -10
@@ -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;
if (Validate::isLanguageFileName($filename))
{
if (!Language::checkAndAddLanguage($iso_code))
$conf = 20;
else
{
// Reset cache
Language::loadLanguages();
AdminTranslationsController::checkAndAddMailsFiles($iso_code, $files_list); AdminTranslationsController::checkAndAddMailsFiles($iso_code, $files_list);
$this->checkAndAddThemesFiles($files_list, $themes_selected); $this->checkAndAddThemesFiles($files_list, $themes_selected);
$tab_errors = AdminTranslationsController::addNewTabs($iso_code, $files_list); $tab_errors = AdminTranslationsController::addNewTabs($iso_code, $files_list);
if (count($tab_errors)) if (count($tab_errors))
{ {
$this->errors += $tab_errors; $this->errors += $tab_errors;
return false; return false;
} }
if (Validate::isLanguageFileName($filename)) }
{
if (!Language::checkAndAddLanguage($iso_code))
$conf = 20;
} }
$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 (count($tab_errors))
$this->errors += $tab_errors;
else
{
if (!Language::checkAndAddLanguage($arr_import_lang[0])) if (!Language::checkAndAddLanguage($arr_import_lang[0]))
$conf = 20; $conf = 20;
else
{
// Reset cache
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);