|
@@ -88,16 +88,12 @@ class AppearanceImPortForm extends Form implements LazyRenderable
|
|
if ($deleteDirectoryContents) {
|
|
if ($deleteDirectoryContents) {
|
|
return ['status' => false, 'error' => $deleteDirectoryContents];
|
|
return ['status' => false, 'error' => $deleteDirectoryContents];
|
|
}
|
|
}
|
|
-
|
|
|
|
// 获取 $extractPath 下的所有文件和文件夹
|
|
// 获取 $extractPath 下的所有文件和文件夹
|
|
$items = scandir($extractPath);
|
|
$items = scandir($extractPath);
|
|
- var_dump($items);exit;
|
|
|
|
// 过滤掉 '.' 和 '..'
|
|
// 过滤掉 '.' 和 '..'
|
|
$items = array_diff($items, ['.', '..']);
|
|
$items = array_diff($items, ['.', '..']);
|
|
-
|
|
|
|
-
|
|
|
|
// 判断 $extractPath 是否只有一个文件夹
|
|
// 判断 $extractPath 是否只有一个文件夹
|
|
- if (count($items) != 1 || !is_dir($extractPath . '\\' . reset($items))) {
|
|
|
|
|
|
+ if (count($items) != 1) {
|
|
return ['status' => false, 'error' => "Error: unzip file does not contain exactly one folder."];
|
|
return ['status' => false, 'error' => "Error: unzip file does not contain exactly one folder."];
|
|
}
|
|
}
|
|
// 获取文件夹名称
|
|
// 获取文件夹名称
|