fix FileSystemTest no perm

This commit is contained in:
sunxyw 2023-01-03 23:35:38 +08:00
parent 8f8002608e
commit 2d6896adde
No known key found for this signature in database
GPG Key ID: F391C42B19AFFC98
2 changed files with 6 additions and 1 deletions

View File

@ -25,6 +25,11 @@ class FileSystem
logger()->warning(zm_internal_errcode('E00080') . '扫描目录失败,目录不存在');
return false;
}
// 检查目录是否可读
if (!is_readable($dir)) {
logger()->warning(zm_internal_errcode('E00080') . '扫描目录失败,目录不可读');
return false;
}
logger()->debug('扫描' . $dir);
// 套上 zm_dir
$scan_list = scandir($dir);

View File

@ -127,7 +127,7 @@ class FileSystemTest extends TestCase
$old_perm = $this->vfs->getPermissions();
$this->vfs->chmod(0000);
FileSystem::scanDirFiles($this->vfs->url());
$this->assertLogged('warning', zm_internal_errcode('E00080') . '扫描目录失败,目录无法读取: ' . $this->vfs->url());
$this->assertLogged('warning', zm_internal_errcode('E00080') . '扫描目录失败,目录不可读');
$this->vfs->chmod($old_perm);
}
}