Conditions | 9 |
Paths | 9 |
Total Lines | 29 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function cmdCacheClearAsset() |
||
32 | { |
||
33 | $params = $this->getParam(); |
||
34 | |||
35 | if (empty($params)) { |
||
36 | foreach (new DirectoryIterator(GC_DIR_ASSET_COMPILED) as $file) { |
||
37 | if ($file->isDir() && !$file->isDot()) { |
||
38 | gplcart_file_delete_recursive($file->getRealPath()); |
||
39 | } |
||
40 | } |
||
41 | } else { |
||
42 | |||
43 | $file = null; |
||
44 | |||
45 | if (!empty($params['css'])) { |
||
46 | $file = GC_DIR_ASSET_COMPILED . '/css'; |
||
47 | } else if (!empty($params['js'])) { |
||
48 | $file = GC_DIR_ASSET_COMPILED . '/js'; |
||
49 | } |
||
50 | |||
51 | if (empty($file) || !is_dir($file)) { |
||
52 | $this->errorAndExit($this->text('Invalid command')); |
||
53 | } |
||
54 | |||
55 | gplcart_file_delete_recursive($file); |
||
56 | } |
||
57 | |||
58 | $this->output(); |
||
59 | } |
||
60 | |||
62 |