1
0
Fork 0
mirror of synced 2024-06-27 02:31:04 +12:00

Handle mkdir errors with exceptions

This commit is contained in:
eldadfux 2019-11-13 00:32:59 +02:00
parent 51df34477c
commit fdcbb86f43
2 changed files with 4 additions and 2 deletions

View file

@ -113,7 +113,9 @@ class Resize
{
// Create directory with write permissions
if (null !== $path && !file_exists(dirname($path))) {
mkdir(dirname($path), 0777, true);
if (!@mkdir(dirname($path), 0755, true)) {
throw new Exception('Can\'t create directory '.dirname($path));
}
}
switch ($type) {

View file

@ -71,7 +71,7 @@ abstract class Device
}
if (!file_exists(dirname($path))) { // Checks if directory path to file exists
if (!mkdir(dirname($path), 0755, true)) {
if (!@mkdir(dirname($path), 0755, true)) {
throw new Exception('Can\'t create directory '.dirname($path));
}
}