perf: 优化客户端升级

This commit is contained in:
kuaifan
2024-11-14 14:49:14 +08:00
parent da066e40ce
commit 21eab03684
9 changed files with 305 additions and 163 deletions

View File

@@ -13,7 +13,6 @@ use League\CommonMark\Exception\CommonMarkException;
use Overtrue\Pinyin\Pinyin;
use Redirect;
use Request;
use Response;
use Storage;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
use Symfony\Component\HttpFoundation\File\File;
@@ -372,6 +371,34 @@ class Base
}
}
/**
* 复制文件夹
* @param $source
* @param $destination
* @return bool
*/
public static function copyDirectory($source, $destination)
{
if (!is_dir($source)) {
return false;
}
if (!is_dir($destination)) {
Base::makeDir($destination);
}
$dir = opendir($source);
while (false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($source . '/' . $file)) {
self::copyDirectory($source . '/' . $file, $destination . '/' . $file);
} else {
copy($source . '/' . $file, $destination . '/' . $file);
}
}
}
closedir($dir);
return true;
}
/**
*
* 截取字符串