-
Notifications
You must be signed in to change notification settings - Fork 0
/
Data.php
51 lines (49 loc) · 1.46 KB
/
Data.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* @author Amasty Team
* @copyright Amasty
* @package Amasty_Orderattr
*/
class Amasty_Orderattr_Helper_Data extends Mage_Core_Helper_Abstract
{
public function fields($step)
{
return Mage::app()->getLayout()->createBlock('amorderattr/fields')->setStep($step)->toHtml();
}
public function clearCache()
{
$cacheDir = Mage::getBaseDir('var') . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR;
$this->_clearDir($cacheDir);
Mage::app()->cleanCache();
Mage::getConfig()->reinit();
}
protected function _clearDir($dir = '')
{
if($dir)
{
if (is_dir($dir))
{
if ($handle = @opendir($dir))
{
while (($file = readdir($handle)) !== false)
{
if ($file != "." && $file != "..")
{
$fullpath = $dir . '/' . $file;
if (is_dir($fullpath))
{
$this->_clearDir($fullpath);
@rmdir($fullpath);
}
else
{
@unlink($fullpath);
}
}
}
closedir($handle);
}
}
}
}
}