[*] BO : Add clear smarty cache button
This commit is contained in:
1 parent
b1b636a911
commit
e8685b1430
4 files changed
+23
-13
No files matched your search
@@ -40,6 +40,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{$smarty.block.parent}
|
{$smarty.block.parent}
|
||||||
|
{if $input.type == 'radio' && $input.name == 'smarty_cache'}
|
||||||
|
<a href="{$current}&token={$token}&empty_smarty_cache=1" class="clear button" href="">{l s='Clear Smarty cache'}</a>
|
||||||
|
{/if}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="description"}
|
{block name="description"}
|
||||||
|
|||||||
@@ -704,6 +704,18 @@ class ToolsCore
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear smarty cache folders
|
||||||
|
*/
|
||||||
|
public static function clearSmartyCache()
|
||||||
|
{
|
||||||
|
foreach (array(_PS_CACHE_DIR_.'smarty/cache', _PS_CACHE_DIR_.'smarty/compile') as $dir)
|
||||||
|
if (file_exists($dir))
|
||||||
|
foreach (scandir($dir) as $file)
|
||||||
|
if ($file[0] != '.' && $file != 'index.php')
|
||||||
|
self::deleteDirectory($dir.DIRECTORY_SEPARATOR.$file);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display an error according to an error code
|
* Display an error according to an error code
|
||||||
|
|||||||
@@ -791,6 +791,13 @@ class AdminPerformanceControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((bool)Tools::getValue('empty_smarty_cache'))
|
||||||
|
{
|
||||||
|
$redirectAdmin = true;
|
||||||
|
Tools::clearSmartyCache();
|
||||||
|
}
|
||||||
|
|
||||||
if ($redirectAdmin && (!isset($this->errors) || !count($this->errors)))
|
if ($redirectAdmin && (!isset($this->errors) || !count($this->errors)))
|
||||||
{
|
{
|
||||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => ''));
|
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => ''));
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ class InstallModelInstall extends InstallAbstractModel
|
|||||||
public function configureShop(array $data = array())
|
public function configureShop(array $data = array())
|
||||||
{
|
{
|
||||||
// Clear smarty cache
|
// Clear smarty cache
|
||||||
$this->clearSmartyCache();
|
Tools::clearSmartyCache();
|
||||||
|
|
||||||
//clear image cache in tmp folder
|
//clear image cache in tmp folder
|
||||||
Tools::deleteDirectory(_PS_TMP_IMG_DIR_, false);
|
Tools::deleteDirectory(_PS_TMP_IMG_DIR_, false);
|
||||||
@@ -494,18 +494,6 @@ class InstallModelInstall extends InstallAbstractModel
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear smarty cache folders
|
|
||||||
*/
|
|
||||||
public function clearSmartyCache()
|
|
||||||
{
|
|
||||||
foreach (array(_PS_CACHE_DIR_.'smarty/cache', _PS_CACHE_DIR_.'smarty/compile') as $dir)
|
|
||||||
if (file_exists($dir))
|
|
||||||
foreach (scandir($dir) as $file)
|
|
||||||
if ($file[0] != '.' && $file != 'index.php')
|
|
||||||
Tools::deleteDirectory($dir.DIRECTORY_SEPARATOR.$file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getModulesList()
|
public function getModulesList()
|
||||||
{
|
{
|
||||||
// @todo REMOVE DEV MODE
|
// @todo REMOVE DEV MODE
|
||||||
|
|||||||
Reference in new issue
Block a user