diff --git a/System/File/Local/FileAbstract.php b/System/File/Local/FileAbstract.php index 2176205ea..1e4bbf37c 100644 --- a/System/File/Local/FileAbstract.php +++ b/System/File/Local/FileAbstract.php @@ -185,9 +185,15 @@ abstract class FileAbstract implements ContainerInterface */ public function index() : void { - $this->createdAt->setTimestamp(filemtime($this->path)); - $this->changedAt->setTimestamp(filectime($this->path)); - $this->owner = fileowner($this->path); - $this->permission = (int) substr(sprintf('%o', fileperms($this->path)), -4); + $mtime = \filemtime($this->path); + $ctime = \filectime($this->path); + + $this->createdAt->setTimestamp($mtime === false ? 0 : $mtime); + $this->changedAt->setTimestamp($ctime === false ? 0 : $ctime); + + $owner = \fileowner($this->path); + + $this->owner = $owner === false ? 0 : $owner; + $this->permission = (int) \substr(\sprintf('%o', \fileperms($this->path)), -4); } } diff --git a/System/File/Local/LocalStorage.php b/System/File/Local/LocalStorage.php index fc3860de9..f4e7420bf 100644 --- a/System/File/Local/LocalStorage.php +++ b/System/File/Local/LocalStorage.php @@ -54,13 +54,7 @@ class LocalStorage extends StorageAbstract } /** - * Get the internal class type (directory or file) based on path. - * - * @param string $path Path to the directory or file - * - * @return string Class namespace - * - * @since 1.0.0 + * {@inheritdoc} */ protected static function getClassType(string $path) : string { diff --git a/System/File/StorageAbstract.php b/System/File/StorageAbstract.php index d36e09831..48b1d8d37 100644 --- a/System/File/StorageAbstract.php +++ b/System/File/StorageAbstract.php @@ -43,6 +43,17 @@ abstract class StorageAbstract */ abstract public static function getInstance() : StorageAbstract; + /** + * Get the internal class type (directory or file) based on path. + * + * @param string $path Path to the directory or file + * + * @return string Class namespace + * + * @since 1.0.0 + */ + abstract protected static function getClassType(string $path) : string; + /** * Get storage type. * @@ -265,7 +276,7 @@ abstract class StorageAbstract * @param bool $recursive Consider subdirectories * @param array $ignore Files/paths to ignore (no regex) * - * @return string + * @return int * * @since 1.0.0 */