Fix /man/* redirects
Forgot to update these functions in the rewrite.
This commit is contained in:
parent
98e4f014ba
commit
a96aeb6310
1 changed files with 4 additions and 7 deletions
11
www/index.pl
11
www/index.pl
|
|
@ -717,7 +717,7 @@ TUWF::get qr{/(?<name>[^/]+)(?:/(?<hash>[0-9a-f]{8}))?} => sub {
|
||||||
# Unfortunately, even in the permalink format with the hash, we don't know
|
# 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
|
# 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
|
# 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.
|
# to deterministically select a good package.
|
||||||
my($man, undef) = $shorthash
|
my($man, undef) = $shorthash
|
||||||
? man_pref undef, sql 'm.name =', \$name, 'AND', sql_hash_prefix 'm.hash', $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;
|
my $man;
|
||||||
if($path !~ m{/}) { # (1)
|
if($path !~ m{/}) { # (1)
|
||||||
($man) = tuwf->dbManPrefName($path, sysid => $sysid);
|
($man) = man_pref_name $path, sql 's.id IN', $sysid;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$path =~ s{/([^/]+)$}{};
|
$path =~ s{/([^/]+)$}{};
|
||||||
my $name = $1;
|
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;
|
return tuwf->resNotFound if !$pkg;
|
||||||
|
|
||||||
my $verid = tuwf->dbVali('SELECT id FROM package_versions WHERE package =', \$pkg->{id}, 'AND version =', \$ver);
|
($man) = man_pref_name $name, sql 's.id IN', $sysid, 'AND p.id =', \$pkg->{id}, $ver ? ('AND v.version =', \$ver) : ();
|
||||||
return tuwf->resNotFound if $ver && !$verid;
|
|
||||||
|
|
||||||
($man) = tuwf->dbManPrefName($name, sysid => $sysid, pkgid => $pkg->{id}, pkgver => $verid);
|
|
||||||
}
|
}
|
||||||
return tuwf->resNotFound if !$man;
|
return tuwf->resNotFound if !$man;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue