Skip to content

Commit e9e67ce

Browse files
committed
移除冗余日志
优化插件禁用时文件判断
1 parent e4bd9eb commit e9e67ce

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "addons package for fastadmin",
44
"homepage": "https://github.com/karsonzhang/fastadmin-addons",
55
"license": "Apache-2.0",
6-
"version": "1.2.5",
6+
"version": "1.2.6",
77
"authors": [
88
{
99
"name": "Karson",

src/addons/Service.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,12 @@ public static function download($name, $extend = [])
3232
$addonsTempDir = self::getAddonsBackupDir();
3333
$tmpFile = $addonsTempDir . $name . ".zip";
3434
try {
35-
\think\Log::record(\think\Debug::getUseTime());
3635
$client = self::getClient();
3736
$response = $client->get('/addon/download', ['query' => array_merge(['name' => $name], $extend)]);
38-
\think\Log::record(\think\Debug::getUseTime());
3937
$body = $response->getBody();
4038
$content = $body->getContents();
4139
if (substr($content, 0, 1) === '{') {
4240
$json = (array)json_decode($content, true);
43-
\think\Log::record(\think\Debug::getUseTime());
4441

4542
//如果传回的是一个下载链接,则再次下载
4643
if ($json['data'] && isset($json['data']['url'])) {
@@ -59,7 +56,6 @@ public static function download($name, $extend = [])
5956
if ($write = fopen($tmpFile, 'w')) {
6057
fwrite($write, $content);
6158
fclose($write);
62-
\think\Log::record(\think\Debug::getUseTime());
6359
return $tmpFile;
6460
}
6561
throw new Exception("No permission to write temporary files");
@@ -672,7 +668,9 @@ public static function disable($name, $force = false)
672668
if (!is_dir($itemBaseDir)) {
673669
@mkdir($itemBaseDir, 0755, true);
674670
}
675-
copy(ROOT_PATH . $item, $addonDir . $item);
671+
if (is_file(ROOT_PATH . $item)) {
672+
@copy(ROOT_PATH . $item, $addonDir . $item);
673+
}
676674
}
677675
$list = $config['files'];
678676
}

0 commit comments

Comments
 (0)