git.php: local_asset also checks web root (install.sh) for release asset links

这个提交包含在:
JGZYES
2026-09-02 22:04:53 +08:00
父节点 b404d6e1e2
当前提交 f743ad920d
+5 -3
查看文件
@@ -73,10 +73,12 @@ function gh_api(string $url): array {
}
/* Prefer a local copy of a release asset on this server; fall back to GitHub. */
function local_asset(string $name): ?string {
foreach ([__DIR__ . '/downloads/' . $name, __DIR__ . '/mirror/packages/pmm/' . $name] as $p) {
$cands = [__DIR__ . '/downloads/' . $name, __DIR__ . '/mirror/packages/pmm/' . $name, __DIR__ . '/' . $name];
$base = realpath(__DIR__);
foreach ($cands as $p) {
if (@is_file($p)) {
$base = realpath(__DIR__);
return '/' . str_replace('\\', '/', substr(str_replace('\\', '/', realpath($p)), strlen($base) + 1));
$rp = realpath($p);
return '/' . str_replace('\\', '/', substr(str_replace('\\', '/', $rp), strlen($base) + 1));
}
}
return null;