feat:模块禁用时恢复安装备份的文件

This commit is contained in:
妙码生花 2022-09-03 14:15:45 +08:00
parent c489a6c489
commit a4e05dc802

View File

@ -234,6 +234,25 @@ class Manage
del_empty_dir(dirname($file));
}
// 恢复备份文件
if ($zipDir) {
foreach (
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($zipDir, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST
) as $item
) {
$ebakFile = path_transform(root_path() . $iterator->getSubPathName());
if ($item->isDir()) {
if (!is_dir($ebakFile)) {
mkdir($ebakFile, 0755, true);
}
} else {
copy($item, $ebakFile);
}
}
}
deldir($zipDir);
}