fix: 减少 glob 和 realpath 等函数的使用,方便后续 phar 使用。

This commit is contained in:
邹景立 2024-09-01 22:22:52 +08:00
parent 7497620aeb
commit 19028ae692
3 changed files with 3 additions and 4 deletions

View File

@ -78,7 +78,7 @@ class ModuleService extends Service
{
$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;
}

View File

@ -56,7 +56,7 @@ class Plugs extends Controller
}
}
$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');
}
/**

View File

@ -52,10 +52,9 @@ class Upload extends Controller
$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');
}
/**