mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-03 21:49:56 +09:00
Update to laravel 7
This commit is contained in:
@@ -56,28 +56,58 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
||||
/**
|
||||
* Return an instance of SplFileInfo with support for relative paths.
|
||||
*
|
||||
* @return SplFileInfo File information
|
||||
* @return SplFileInfo
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
// the logic here avoids redoing the same work in all iterations
|
||||
|
||||
if (null === $subPathname = $this->subPath) {
|
||||
$subPathname = $this->subPath = (string) $this->getSubPath();
|
||||
$subPathname = $this->subPath = $this->getSubPath();
|
||||
}
|
||||
if ('' !== $subPathname) {
|
||||
$subPathname .= $this->directorySeparator;
|
||||
}
|
||||
$subPathname .= $this->getFilename();
|
||||
|
||||
return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
|
||||
if ('/' !== $basePath = $this->rootPath) {
|
||||
$basePath .= $this->directorySeparator;
|
||||
}
|
||||
|
||||
return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \RecursiveIterator
|
||||
* @param bool $allowLinks
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function hasChildren($allowLinks = false)
|
||||
{
|
||||
$hasChildren = parent::hasChildren($allowLinks);
|
||||
|
||||
if (!$hasChildren || !$this->ignoreUnreadableDirs) {
|
||||
return $hasChildren;
|
||||
}
|
||||
|
||||
try {
|
||||
parent::getChildren();
|
||||
|
||||
return true;
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
// If directory is unreadable and finder is set to ignore it, skip children
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \RecursiveDirectoryIterator
|
||||
*
|
||||
* @throws AccessDeniedException
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getChildren()
|
||||
{
|
||||
try {
|
||||
@@ -94,18 +124,16 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
||||
|
||||
return $children;
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
if ($this->ignoreUnreadableDirs) {
|
||||
// If directory is unreadable and finder is set to ignore it, a fake empty content is returned.
|
||||
return new \RecursiveArrayIterator([]);
|
||||
} else {
|
||||
throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing for non rewindable stream.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
if (false === $this->isRewindable()) {
|
||||
@@ -118,7 +146,7 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
||||
/**
|
||||
* Checks if the stream is rewindable.
|
||||
*
|
||||
* @return bool true when the stream is rewindable, false otherwise
|
||||
* @return bool
|
||||
*/
|
||||
public function isRewindable()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user