// Fix smarty cache after modules translation update
This commit is contained in:
@@ -801,6 +801,8 @@ class LanguageCore extends ObjectModel
|
||||
$files_list = $gz->listContent();
|
||||
if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
|
||||
$errors[] = Tools::displayError('Cannot decompress the translation file for the following language: ').(string)$iso;
|
||||
// Clear smarty modules cache
|
||||
Tools::clearCache();
|
||||
if (!Language::checkAndAddLanguage((string)$iso, $lang_pack, false, $params))
|
||||
$errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$iso;
|
||||
else
|
||||
|
||||
@@ -2117,7 +2117,7 @@ exit;
|
||||
*
|
||||
* @param Smarty $smarty
|
||||
*/
|
||||
public static function clearCache($smarty, $tpl = false, $cache_id = null, $compile_id = null)
|
||||
public static function clearCache($smarty = null, $tpl = false, $cache_id = null, $compile_id = null)
|
||||
{
|
||||
if (is_null($smarty))
|
||||
$smarty = Context::getContext()->smarty;
|
||||
|
||||
@@ -686,6 +686,9 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if (pathinfo($file2check['filename'], PATHINFO_BASENAME) == 'index.php' && file_put_contents(_PS_TRANSLATIONS_DIR_.'../'.$file2check['filename'], Tools::getDefaultIndexContent()))
|
||||
continue;
|
||||
|
||||
// Clear smarty modules cache
|
||||
Tools::clearCache();
|
||||
|
||||
if (Validate::isLanguageFileName($filename))
|
||||
{
|
||||
if (!Language::checkAndAddLanguage($iso_code))
|
||||
@@ -735,13 +738,14 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('The archive cannot be extracted.'). ' '.$error->message;
|
||||
else
|
||||
{
|
||||
|
||||
if (!Language::checkAndAddLanguage($arr_import_lang[0]))
|
||||
$conf = 20;
|
||||
else
|
||||
{
|
||||
// Reset cache
|
||||
Language::loadLanguages();
|
||||
// Clear smarty modules cache
|
||||
Tools::clearCache();
|
||||
|
||||
AdminTranslationsController::checkAndAddMailsFiles($arr_import_lang[0], $files_list);
|
||||
if ($tab_errors = AdminTranslationsController::addNewTabs($arr_import_lang[0], $files_list))
|
||||
@@ -1340,6 +1344,9 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
foreach ($arr_files as $value)
|
||||
$this->findAndWriteTranslationsIntoFile($value['file_name'], $value['files'], $value['theme'], $value['module'], $value['dir']);
|
||||
|
||||
// Clear modules cache
|
||||
Tools::clearCache();
|
||||
|
||||
// Redirect
|
||||
if (Tools::getValue('submitTranslationsModulesAndStay'))
|
||||
$this->redirect(true);
|
||||
|
||||
Reference in New Issue
Block a user