| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | mkdir(dirname($filename)); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Warn about overwriting file if exists and empty it. |
||
| 33 | * |
||
| 34 | * @param string $filename Filename without extension |
||
| 35 | * @param string $fileExtension File extension. Default is '.dat' |
||
| 36 | * |
||
| 37 | * @see Input::dieOnDenyUserConfirm() |
||
| 38 | */ |
||
| 39 | public static function checkIfFileExists($filename, $fileExtension = '.dat') |
||
| 40 | { |
||
| 41 | if (file_exists($filename.$fileExtension)) { |
||
| 42 | Text::message('File '.$filename.$fileExtension.' exists and it will be overwritten!'); |
||
| 43 | |||
| 44 | Input::dieOnDenyUserConfirm(); |
||
| 45 | |||
| 46 | // Empty the file |
||
| 51 |