Skip to content

Commit

Permalink
CO: Clear both Symfony and Smarty cache after adding language
Browse files Browse the repository at this point in the history
  • Loading branch information
maximebiloe committed Dec 5, 2016
1 parent 5db1da5 commit 9274f74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions classes/Tools.php
Expand Up @@ -2805,6 +2805,18 @@ public static function clearSmartyCache()
Tools::clearCompile($smarty);
}

/**
* Clear both Smarty and Symfony cache
*/
public static function clearAllCache()
{
Tools::clearSmartyCache();

$sf2Refresh = new \PrestaShopBundle\Service\Cache\Refresh();
$sf2Refresh->addCacheClear(_PS_MODE_DEV_ ? 'dev' : 'prod');
$sf2Refresh->execute();
}

public static function clearColorListCache($id_product = false)
{
// Change template dir if called from the BackOffice
Expand Down
4 changes: 2 additions & 2 deletions controllers/admin/AdminTranslationsController.php
Expand Up @@ -878,7 +878,7 @@ public function submitAddLang()
if (Validate::isLangIsoCode($isoCode)) {
if ($success = Language::downloadAndInstallLanguagePack($isoCode, $version = _PS_VERSION_, $params = null, $install = true)) {
Language::loadLanguages();
Tools::clearCache();
Tools::clearAllCache();

// TODO: Update AdminTranslationsController::addNewTabs to install tabs translated

Expand Down Expand Up @@ -1506,7 +1506,7 @@ public function postProcess()
}

// Clear modules cache
Tools::clearCache();
Tools::clearAllCache();

// Redirect
if (Tools::getIsset('submitTranslationsModulesAndStay')) {
Expand Down

0 comments on commit 9274f74

Please sign in to comment.