Skip to content

Commit

Permalink
fix: 减少 glob 和 realpath 等函数的使用,方便后续 phar 使用。
Browse files Browse the repository at this point in the history
  • Loading branch information
zoujingli committed Sep 1, 2024
1 parent 7497620 commit 19028ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugin/think-library/src/service/ModuleService.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static function getModules(array $data = []): array
{
$path = Library::$sapp->getBasePath();
foreach (scandir($path) as $item) if ($item[0] !== '.') {
if (is_dir(realpath($path . $item))) $data[] = $item;
if (is_dir($path . $item)) $data[] = $item;
}
return $data;
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/think-plugs-admin/src/controller/api/Plugs.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function icon()
}
}
$this->field = $this->app->request->get('field', 'icon');
$this->fetch(realpath(__DIR__ . '/../../view/api/icon.html'));
$this->fetch(dirname(__DIR__, 2) . '/view/api/icon.html');
}

/**
Expand Down
3 changes: 1 addition & 2 deletions plugin/think-plugs-admin/src/controller/api/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ public function index(): Response
$allows = str2arr(sysconf('storage.allow_exts|raw'));
if (empty($uuid) && $unid > 0) $allows = array_intersect($exts, $allows);
foreach ($allows as $ext) $data['exts'][$ext] = Storage::mime($ext);
$template = realpath(__DIR__ . '/../../view/api/upload.js');
$data['exts'] = json_encode($data['exts'], JSON_UNESCAPED_UNICODE);
$data['nameType'] = sysconf('storage.name_type|raw') ?: 'xmd5';
return view($template, $data)->contentType('application/x-javascript');
return view(dirname(__DIR__, 2) . '/view/api/upload.js', $data)->contentType('application/x-javascript');
}

/**
Expand Down

0 comments on commit 19028ae

Please sign in to comment.