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