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