mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 14:38:39 +00:00
Fix path check
This commit is contained in:
parent
36ae2f3ea4
commit
54a41f6874
|
|
@ -165,6 +165,10 @@ class File extends FileAbstract implements FileInterface
|
||||||
*/
|
*/
|
||||||
public static function created(string $path) : \DateTime
|
public static function created(string $path) : \DateTime
|
||||||
{
|
{
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
throw new PathException($path);
|
||||||
|
}
|
||||||
|
|
||||||
return self::createFileTime($path, filemtime($path));
|
return self::createFileTime($path, filemtime($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,15 +177,15 @@ class File extends FileAbstract implements FileInterface
|
||||||
*/
|
*/
|
||||||
public static function changed(string $path) : \DateTime
|
public static function changed(string $path) : \DateTime
|
||||||
{
|
{
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
throw new PathException($path);
|
||||||
|
}
|
||||||
|
|
||||||
return self::createFileTime($path, filectime($path));
|
return self::createFileTime($path, filectime($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function createFileTime(string $path, int $time)
|
private static function createFileTime(string $path, int $time)
|
||||||
{
|
{
|
||||||
if (!file_exists($path)) {
|
|
||||||
throw new PathException($path);
|
|
||||||
}
|
|
||||||
|
|
||||||
$fileTime = new \DateTime();
|
$fileTime = new \DateTime();
|
||||||
$fileTime->setTimestamp($time);
|
$fileTime->setTimestamp($time);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user