mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Fix UnexpectedValueException if there are permission problems deep inside a directory tree
This commit is contained in:
parent
06f4eca47a
commit
178add54e8
1 changed files with 47 additions and 37 deletions
|
|
@ -672,12 +672,6 @@ class Storage
|
|||
try
|
||||
{
|
||||
$iterator = new \FilesystemIterator($dirname, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS);
|
||||
}
|
||||
catch (\UnexpectedValueException $e)
|
||||
{
|
||||
trigger_error('Cannot read directory: ' . $dirname, \E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
foreach ($iterator as $fileinfo)
|
||||
|
|
@ -691,6 +685,13 @@ class Storage
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (\UnexpectedValueException $e)
|
||||
{
|
||||
trigger_error($e->getMessage(), \E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
sort($result);
|
||||
return $result;
|
||||
}
|
||||
|
|
@ -720,6 +721,9 @@ class Storage
|
|||
|
||||
$rdi_options = \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS;
|
||||
$rii_options = \RecursiveIteratorIterator::CHILD_FIRST;
|
||||
|
||||
try
|
||||
{
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, $rdi_options), $rii_options);
|
||||
|
||||
foreach ($iterator as $path)
|
||||
|
|
@ -752,6 +756,12 @@ class Storage
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (\UnexpectedValueException $e)
|
||||
{
|
||||
trigger_error($e->getMessage(), \E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue