diff --git a/www/index.pl b/www/index.pl index f8e7b46..b0a9235 100755 --- a/www/index.pl +++ b/www/index.pl @@ -717,7 +717,7 @@ TUWF::get qr{/(?[^/]+)(?:/(?[0-9a-f]{8}))?} => sub { # Unfortunately, even in the permalink format with the hash, we don't know # from which package we're supposed to get the man page. This info is # needed in order to do .so substitution, so we can substitute files from - # the same package as the requested man page. Use the dbManPref logic here + # the same package as the requested man page. Use the man_pref logic here # to deterministically select a good package. my($man, undef) = $shorthash ? man_pref undef, sql 'm.name =', \$name, 'AND', sql_hash_prefix 'm.hash', $shorthash @@ -897,19 +897,16 @@ TUWF::get qr{/man/([^/]+)/(.+)} => sub { my $man; if($path !~ m{/}) { # (1) - ($man) = tuwf->dbManPrefName($path, sysid => $sysid); + ($man) = man_pref_name $path, sql 's.id IN', $sysid; } else { $path =~ s{/([^/]+)$}{}; my $name = $1; - my($pkg, $ver) = pkg_frompath(sql('system IN', $sysid), $path); # Handles (2) and (3) + my($pkg, $ver) = pkg_frompath sql('system IN', $sysid), $path; # Handles (2) and (3) return tuwf->resNotFound if !$pkg; - my $verid = tuwf->dbVali('SELECT id FROM package_versions WHERE package =', \$pkg->{id}, 'AND version =', \$ver); - return tuwf->resNotFound if $ver && !$verid; - - ($man) = tuwf->dbManPrefName($name, sysid => $sysid, pkgid => $pkg->{id}, pkgver => $verid); + ($man) = man_pref_name $name, sql 's.id IN', $sysid, 'AND p.id =', \$pkg->{id}, $ver ? ('AND v.version =', \$ver) : (); } return tuwf->resNotFound if !$man;