Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 344324b47a |
@@ -48,6 +48,10 @@ final class File extends Item
|
||||
* @var bool
|
||||
*/
|
||||
private $isEditable;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $content = null;
|
||||
|
||||
/**
|
||||
* PublicFile constructor.
|
||||
@@ -82,7 +86,15 @@ final class File extends Item
|
||||
$parent = substr($this->path, 0, $parentSep);
|
||||
} else $parent = '/';
|
||||
$this->parent = base64_encode($parent);
|
||||
if ($editable[$extension] ?? false && $file->read() !== false) {
|
||||
|
||||
$isEditable = $editable[$extension] ?? false;
|
||||
$content = false;
|
||||
if ($isEditable) {
|
||||
$content = $file->read();
|
||||
}
|
||||
|
||||
if ($isEditable && $content !== false) {
|
||||
$this->content = $content;
|
||||
$this->isEditable = true;
|
||||
} else {
|
||||
$this->isEditable = false;
|
||||
@@ -175,6 +187,7 @@ final class File extends Item
|
||||
*/
|
||||
public function getContents()
|
||||
{
|
||||
if ($this->content !== null) return $this->content;
|
||||
return $this->file->read();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user